本文整理了Java中scala.collection.immutable.HashMap
类的一些代码示例,展示了HashMap
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HashMap
类的具体详情如下:
包路径:scala.collection.immutable.HashMap
类名称:HashMap
暂无
代码示例来源:origin: linkedin/kafka-monitor
private static void reassignPartitions(KafkaZkClient zkClient, Collection<Broker> brokers, String topic, int partitionCount, int replicationFactor) {
scala.collection.mutable.ArrayBuffer<BrokerMetadata> brokersMetadata = new scala.collection.mutable.ArrayBuffer<>(brokers.size());
for (Broker broker : brokers) {
brokersMetadata.$plus$eq(new BrokerMetadata(broker.id(), broker.rack()));
}
scala.collection.Map<Object, Seq<Object>> assignedReplicas =
AdminUtils.assignReplicasToBrokers(brokersMetadata, partitionCount, replicationFactor, 0, 0);
scala.collection.immutable.Map<TopicPartition, Seq<Object>> newAssignment = new scala.collection.immutable.HashMap<>();
scala.collection.Iterator<scala.Tuple2<Object, scala.collection.Seq<Object>>> it = assignedReplicas.iterator();
while (it.hasNext()) {
scala.Tuple2<Object, scala.collection.Seq<Object>> scalaTuple = it.next();
TopicPartition tp = new TopicPartition(topic, (Integer) scalaTuple._1);
newAssignment = newAssignment.$plus(new scala.Tuple2<>(tp, scalaTuple._2));
}
scala.collection.immutable.Set<String> topicList = new scala.collection.immutable.Set.Set1<>(topic);
scala.collection.Map<Object, scala.collection.Seq<Object>> currentAssignment = zkClient.getPartitionAssignmentForTopics(topicList).apply(topic);
String currentAssignmentJson = formatAsReassignmentJson(topic, currentAssignment);
String newAssignmentJson = formatAsReassignmentJson(topic, assignedReplicas);
LOG.info("Reassign partitions for topic " + topic);
LOG.info("Current partition replica assignment " + currentAssignmentJson);
LOG.info("New partition replica assignment " + newAssignmentJson);
zkClient.createPartitionReassignment(newAssignment);
}
代码示例来源:origin: org.scala-lang.modules/scala-java8-compat_2.11
/**
* Generates a Stream that traverses the keys of a scala.collection.immutable.HashMap.
* <p>
* Both sequential and parallel operations will be efficient.
*
* @param coll The immutable.HashMap to traverse
* @return A Stream view of the collection which, by default, executes sequentially.
*/
public static <K> Stream<K> streamKeys(scala.collection.immutable.HashMap<K, ? super Object> coll) {
return StreamSupport.stream(new StepsAnyImmHashMapKey<K, Object>(coll, 0, coll.size()), false);
}
代码示例来源:origin: com.softwaremill.reactivekafka/reactive-kafka-core
public Producer withParams(Map<String, String> params) {
this.producerParams = new HashMap<String, String>().$plus$plus(JavaConverters.mapAsScalaMapConverter(params).asScala());
return this;
}
代码示例来源:origin: phuonglh/vn.vitk
scala.collection.immutable.HashMap<String, WrappedArray<Integer>> td = (scala.collection.immutable.HashMap<String, WrappedArray<Integer>>)row.get(2);
Map<String, Set<Integer>> tagDict = new HashMap<String, Set<Integer>>();
Iterator<Tuple2<String, WrappedArray<Integer>>> iterator = td.iterator();
while (iterator.hasNext()) {
Tuple2<String, WrappedArray<Integer>> tuple = iterator.next();
代码示例来源:origin: org.scala-lang.modules/scala-java8-compat_2.12
/**
* Generates a Stream that traverses the values of a scala.collection.immutable.HashMap.
* <p>
* Both sequential and parallel operations will be efficient.
*
* @param coll The immutable.HashMap to traverse
* @return A Stream view of the collection which, by default, executes sequentially.
*/
public static <V> Stream<V> streamValues(scala.collection.immutable.HashMap<? super Object, V> coll) {
return StreamSupport.stream(new StepsAnyImmHashMapValue<Object, V>(coll, 0, coll.size()), false);
}
代码示例来源:origin: com.softwaremill.reactivekafka/reactive-kafka-core
public Consumer withParams(Map<String, String> params) {
this.consumerParams = new HashMap<String, String>().$plus$plus(JavaConverters.mapAsScalaMapConverter(params).asScala());
return this;
}
代码示例来源:origin: com.typesafe.play/play_2.12
/**
* @return an empty Scala Map.
* @param <A> input parameter type
* @param <B> return type.
*/
public static <A, B> scala.collection.immutable.Map<A, B> emptyMap() {
return new scala.collection.immutable.HashMap<A, B>();
}
代码示例来源:origin: org.scala-lang.modules/scala-java8-compat
/**
* Generates a Stream that traverses the values of a scala.collection.immutable.HashMap.
* <p>
* Both sequential and parallel operations will be efficient.
*
* @param coll The immutable.HashMap to traverse
* @return A Stream view of the collection which, by default, executes sequentially.
*/
public static <V> Stream<V> streamValues(scala.collection.immutable.HashMap<? super Object, V> coll) {
return StreamSupport.stream(new StepsAnyImmHashMapValue<Object, V>(coll, 0, coll.size()), false);
}
代码示例来源:origin: com.typesafe.play/play_2.10
/**
* Creates an empty Scala Map.
*/
public static <A,B> scala.collection.immutable.Map<A,B> emptyMap() {
return new scala.collection.immutable.HashMap<A,B>();
}
代码示例来源:origin: org.scala-lang.modules/scala-java8-compat_2.11
/**
* Generates a Stream that traverses the values of a scala.collection.immutable.HashMap.
* <p>
* Both sequential and parallel operations will be efficient.
*
* @param coll The immutable.HashMap to traverse
* @return A Stream view of the collection which, by default, executes sequentially.
*/
public static <V> Stream<V> streamValues(scala.collection.immutable.HashMap<? super Object, V> coll) {
return StreamSupport.stream(new StepsAnyImmHashMapValue<Object, V>(coll, 0, coll.size()), false);
}
代码示例来源:origin: com.typesafe.play/play_2.11
/**
* @return an empty Scala Map.
* @param <A> input parameter type
* @param <B> return type.
*/
public static <A, B> scala.collection.immutable.Map<A, B> emptyMap() {
return new scala.collection.immutable.HashMap<A, B>();
}
代码示例来源:origin: org.scala-lang.modules/scala-java8-compat_2.11
/**
* Generates a Stream that traverses the key-value pairs of a scala.collection.immutable.HashMap.
* The key-value pairs are presented as instances of scala.Tuple2.
* <p>
* Both sequential and parallel operations will be efficient.
*
* @param coll The immutable.HashMap to traverse
* @return A Stream view of the collection which, by default, executes sequentially.
*/
public static <K, V> Stream< scala.Tuple2<K, V> > stream(scala.collection.immutable.HashMap<K, V> coll) {
return StreamSupport.stream(new StepsAnyImmHashMap<K, V>(coll, 0, coll.size()), false);
}
代码示例来源:origin: com.typesafe.play/play
/**
* @return an empty Scala Map.
* @param <A> input parameter type
* @param <B> return type.
*/
public static <A, B> scala.collection.immutable.Map<A, B> emptyMap() {
return new scala.collection.immutable.HashMap<A, B>();
}
代码示例来源:origin: org.scala-lang.modules/scala-java8-compat_2.12
/**
* Generates a Stream that traverses the key-value pairs of a scala.collection.immutable.HashMap.
* The key-value pairs are presented as instances of scala.Tuple2.
* <p>
* Both sequential and parallel operations will be efficient.
*
* @param coll The immutable.HashMap to traverse
* @return A Stream view of the collection which, by default, executes sequentially.
*/
public static <K, V> Stream< scala.Tuple2<K, V> > stream(scala.collection.immutable.HashMap<K, V> coll) {
return StreamSupport.stream(new StepsAnyImmHashMap<K, V>(coll, 0, coll.size()), false);
}
代码示例来源:origin: com.sandinh/play-alone
/**
* Creates an empty Scala Map.
*/
public static <A,B> scala.collection.immutable.Map<A,B> emptyMap() {
return new scala.collection.immutable.HashMap<A,B>();
}
代码示例来源:origin: org.scala-lang.modules/scala-java8-compat
/**
* Generates a Stream that traverses the keys of a scala.collection.immutable.HashMap.
* <p>
* Both sequential and parallel operations will be efficient.
*
* @param coll The immutable.HashMap to traverse
* @return A Stream view of the collection which, by default, executes sequentially.
*/
public static <K> Stream<K> streamKeys(scala.collection.immutable.HashMap<K, ? super Object> coll) {
return StreamSupport.stream(new StepsAnyImmHashMapKey<K, Object>(coll, 0, coll.size()), false);
}
代码示例来源:origin: FINRAOS/DataGenerator
@Override
public ConfigBundle configBundle() {
return new ConfigBundle(
ConfigBundleName.apply(getClass().getName()),
new scala.collection.immutable.HashMap<>()
);
}
}
代码示例来源:origin: org.scala-lang.modules/scala-java8-compat_2.12
/**
* Generates a Stream that traverses the keys of a scala.collection.immutable.HashMap.
* <p>
* Both sequential and parallel operations will be efficient.
*
* @param coll The immutable.HashMap to traverse
* @return A Stream view of the collection which, by default, executes sequentially.
*/
public static <K> Stream<K> streamKeys(scala.collection.immutable.HashMap<K, ? super Object> coll) {
return StreamSupport.stream(new StepsAnyImmHashMapKey<K, Object>(coll, 0, coll.size()), false);
}
代码示例来源:origin: com.mangofactory.swagger/swagger-models
@Override
public com.google.common.base.Optional<Model> modelFor(ModelContext modelContext) {
checkArgument(modelContext.getType() instanceof Class, "Only classes are supported by native swagger implmentation");
@SuppressWarnings({ "ConstantConditions", "unchecked" })
Option<Model> sModel = parser.read((Class) modelContext.getType(), new scala.collection.immutable.HashMap());
return Optional.fromNullable(fromOption(sModel));
}
代码示例来源:origin: org.scala-lang.modules/scala-java8-compat
/**
* Generates a Stream that traverses the key-value pairs of a scala.collection.immutable.HashMap.
* The key-value pairs are presented as instances of scala.Tuple2.
* <p>
* Both sequential and parallel operations will be efficient.
*
* @param coll The immutable.HashMap to traverse
* @return A Stream view of the collection which, by default, executes sequentially.
*/
public static <K, V> Stream< scala.Tuple2<K, V> > stream(scala.collection.immutable.HashMap<K, V> coll) {
return StreamSupport.stream(new StepsAnyImmHashMap<K, V>(coll, 0, coll.size()), false);
}
内容来源于网络,如有侵权,请联系作者删除!