本文整理了Java中scala.collection.immutable.Map.get()
方法的一些代码示例,展示了Map.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Map.get()
方法的具体详情如下:
包路径:scala.collection.immutable.Map
类名称:Map
方法名:get
暂无
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public void get()
{
int localSize = this.size;
String[] localElements = this.elements;
Map<String, String> localScalaMap = this.scalaMap;
for (int i = 0; i < localSize; i++)
{
if (!localScalaMap.get(localElements[i]).isDefined())
{
throw new AssertionError(i);
}
}
}
}
代码示例来源:origin: twosigma/beakerx
@Override
public String getSparkAppId() {
RuntimeConfig conf = getOrCreate().conf();
return conf.getAll().get(SPARK_APP_ID).get();
}
代码示例来源:origin: twosigma/beakerx
@Override
public String getSparkMasterUrl() {
RuntimeConfig conf = getOrCreate().conf();
return conf.getAll().get(SPARK_MASTER).get();
}
代码示例来源:origin: com.hurence.logisland/logisland-connect-spark
private Converter createConverter(Map<String, String> parameters, String classKey, String propertyKey, boolean isKey)
throws ClassNotFoundException, IllegalAccessException, InstantiationException, IOException {
Converter ret = (Converter) Class.forName(parameters.get(classKey).get()).newInstance();
ret.configure(propertiesToMap(parameters.get(propertyKey).get()), isKey);
return ret;
}
代码示例来源:origin: apache/incubator-sentry
public scala.collection.immutable.Set<Acl> getAcls(final Resource resource) {
final Option<scala.collection.immutable.Set<Acl>> acls = getAcls().get(resource);
if (acls.nonEmpty())
return acls.get();
return new scala.collection.immutable.HashSet<Acl>();
}
代码示例来源:origin: com.typesafe.play/play-java_2.10
private PathBindable<?> pathBindableFor(Class<?> clazz) {
PathBindable<?> builtIn = Scala.orNull(PathBindable$.MODULE$.pathBindableRegister().get(clazz));
if (builtIn != null) {
return builtIn;
} else if (play.mvc.PathBindable.class.isAssignableFrom(clazz)) {
return PathBindable$.MODULE$.javaPathBindable((ClassTag) ClassTag$.MODULE$.apply(clazz));
} else if (clazz.equals(Object.class)) {
// Special case for object, treat as a string
return PathBindable.bindableString$.MODULE$;
} else {
throw new IllegalArgumentException("Don't know how to bind argument of type " + clazz);
}
}
代码示例来源:origin: com.typesafe.play/play-java_2.11
private PathBindable<?> pathBindableFor(Class<?> clazz) {
PathBindable<?> builtIn = Scala.orNull(PathBindable$.MODULE$.pathBindableRegister().get(clazz));
if (builtIn != null) {
return builtIn;
} else if (play.mvc.PathBindable.class.isAssignableFrom(clazz)) {
return PathBindable$.MODULE$.javaPathBindable((ClassTag) ClassTag$.MODULE$.apply(clazz));
} else if (clazz.equals(Object.class)) {
// Special case for object, treat as a string
return PathBindable.bindableString$.MODULE$;
} else {
throw new IllegalArgumentException("Don't know how to bind argument of type " + clazz);
}
}
代码示例来源:origin: com.typesafe.play/play-java_2.12
private PathBindable<?> pathBindableFor(Class<?> clazz) {
PathBindable<?> builtIn = Scala.orNull(PathBindable$.MODULE$.pathBindableRegister().get(clazz));
if (builtIn != null) {
return builtIn;
} else if (play.mvc.PathBindable.class.isAssignableFrom(clazz)) {
return PathBindable$.MODULE$.javaPathBindable((ClassTag) ClassTag$.MODULE$.apply(clazz));
} else if (clazz.equals(Object.class)) {
// Special case for object, treat as a string
return PathBindable.bindableString$.MODULE$;
} else {
throw new IllegalArgumentException("Don't know how to bind argument of type " + clazz);
}
}
代码示例来源:origin: com.typesafe.play/play-java
private PathBindable<?> pathBindableFor(Class<?> clazz) {
PathBindable<?> builtIn = Scala.orNull(PathBindable$.MODULE$.pathBindableRegister().get(clazz));
if (builtIn != null) {
return builtIn;
} else if (play.mvc.PathBindable.class.isAssignableFrom(clazz)) {
return PathBindable$.MODULE$.javaPathBindable((ClassTag) ClassTag$.MODULE$.apply(clazz));
} else if (clazz.equals(Object.class)) {
// Special case for object, treat as a string
return PathBindable.bindableString$.MODULE$;
} else {
throw new IllegalArgumentException("Don't know how to bind argument of type " + clazz);
}
}
代码示例来源:origin: pac4j/play-pac4j
/**
* We retrieve the body apart from the request. Otherwise, there is an issue in casting the body between Scala and Java.
*
* @param requestHeader the request without the body
* @param body the body (maybe)
* @param sessionStore the session store
*/
public PlayWebContext(final RequestHeader requestHeader, final Object body, final SessionStore<org.pac4j.play.PlayWebContext> sessionStore) {
this(JavaHelpers$.MODULE$.createJavaContext(requestHeader, JavaHelpers$.MODULE$.createContextComponents()), sessionStore);
this.formParameters = new HashMap<>();
if (body instanceof AnyContentAsFormUrlEncoded) {
final scala.collection.immutable.Map<String, Seq<String>> parameters = ((AnyContentAsFormUrlEncoded) body).asFormUrlEncoded().get();
for (final String key : ScalaCompatibility.scalaSetToJavaSet(parameters.keySet())) {
final Seq<String> v = parameters.get(key).get();
final String[] values = new String[v.size()];
v.copyToArray(values);
formParameters.put(key, values);
}
}
}
代码示例来源:origin: pac4j/play-pac4j
/**
* We retrieve the body apart from the request. Otherwise, there is an issue in casting the body between Scala and Java.
*
* @param requestHeader the request without the body
* @param body the body (maybe)
* @param sessionStore the session store
*/
public PlayWebContext(final RequestHeader requestHeader, final Object body, final SessionStore<org.pac4j.play.PlayWebContext> sessionStore) {
this(JavaHelpers$.MODULE$.createJavaContext(requestHeader, JavaHelpers$.MODULE$.createContextComponents()), sessionStore);
this.formParameters = new HashMap<>();
if (body instanceof AnyContentAsFormUrlEncoded) {
final scala.collection.immutable.Map<String, Seq<String>> parameters = ((AnyContentAsFormUrlEncoded) body).asFormUrlEncoded().get();
for (final String key : ScalaCompatibility.scalaSetToJavaSet(parameters.keySet())) {
final Seq<String> v = parameters.get(key).get();
final String[] values = new String[v.size()];
v.copyToArray(values);
formParameters.put(key, values);
}
}
}
代码示例来源:origin: apache/samza
/**
* Directory loggedStoreDir associated with the logged store storeName is determined to be valid
* if all of the following conditions are true.
* a) If the store has to be persisted to disk.
* b) If there is a valid offset file associated with the logged store.
* c) If the logged store has not gone stale.
*
* @return true if the logged store is valid, false otherwise.
*/
private boolean isLoggedStoreValid(String storeName, File loggedStoreDir) {
long changeLogDeleteRetentionInMs = StorageConfig.DEFAULT_CHANGELOG_DELETE_RETENTION_MS();
if (new StorageConfig(config).getChangeLogDeleteRetentionsInMs().get(storeName).isDefined()) {
changeLogDeleteRetentionInMs =
(long) new StorageConfig(config).getChangeLogDeleteRetentionsInMs().get(storeName).get();
}
return this.taskStores.get(storeName).getStoreProperties().isPersistedToDisk()
&& StorageManagerUtil.isOffsetFileValid(loggedStoreDir, OFFSET_FILE_NAME) && !StorageManagerUtil.isStaleStore(
loggedStoreDir, OFFSET_FILE_NAME, changeLogDeleteRetentionInMs, clock.currentTimeMillis());
}
代码示例来源:origin: com.hurence.logisland/logisland-connect-spark
WorkerConfig workerConfig = null;
java.util.Map<String, String> offsetBackingStoreProperties =
propertiesToMap(parameters.get(StreamOptions.KAFKA_CONNECT_OFFSET_BACKING_STORE_PROPERTIES().getName()).get());
String bs = parameters.get(StreamOptions.KAFKA_CONNECT_OFFSET_BACKING_STORE().getName()).get();
if (StreamOptions.FILE_BACKING_STORE().getValue().equals(bs)) {
offsetBackingStore = new FileOffsetBackingStore();
propertiesToMap(parameters.get(StreamOptions.KAFKA_CONNECT_CONNECTOR_PROPERTIES().getName()).get()),
keyConverter,
valueConverter,
offsetBackingStore,
Integer.parseInt(parameters.get(StreamOptions.KAFKA_CONNECT_MAX_TASKS().getName()).get()),
(Class<? extends SourceConnector>) Class.forName(parameters.get(StreamOptions.KAFKA_CONNECT_CONNECTOR_CLASS().getName()).get()));
} catch (Exception e) {
throw new IllegalArgumentException("Unable to create kafka connect stream source: " + e.getMessage(), e);
代码示例来源:origin: shunfei/DCMonitor
private long getTopicLogSize(String topic, int pid) {
Option<Object> o = ZkUtils.getLeaderForPartition(zkClient, topic, pid);
if (o.isEmpty() || o.get() == null) {
log.error("No broker for partition %s - %s", topic, pid);
return 0;
}
Integer leaderId = Int.unbox(o.get());
SimpleConsumer consumer = consumerMap.get(leaderId);
if (consumer == null) {
consumer = createSimpleConsumer(leaderId);
}
// createSimpleConsumer may fail.
if (consumer == null) {
return 0;
}
consumerMap.put(leaderId, consumer);
TopicAndPartition topicAndPartition = new TopicAndPartition(topic, pid);
PartitionOffsetRequestInfo requestInfo = new PartitionOffsetRequestInfo(OffsetRequest.LatestTime(), 1);
OffsetRequest request = new OffsetRequest(
new Map1<TopicAndPartition, PartitionOffsetRequestInfo>(topicAndPartition, requestInfo),
0,
Request.OrdinaryConsumerId()
);
OffsetResponse response = consumer.getOffsetsBefore(request);
PartitionOffsetsResponse offsetsResponse = response.partitionErrorAndOffsets().get(topicAndPartition).get();
return scala.Long.unbox(offsetsResponse.offsets().head());
}
内容来源于网络,如有侵权,请联系作者删除!