本文整理了Java中scala.collection.Iterable.toList()
方法的一些代码示例,展示了Iterable.toList()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Iterable.toList()
方法的具体详情如下:
包路径:scala.collection.Iterable
类名称:Iterable
方法名:toList
暂无
代码示例来源:origin: com.typesafe.play/play
/**
* Converts a Java Collection to a Scala Seq.
*
* @param javaCollection the java collection
* @param <A> the type of Seq element
* @return the scala Seq.
*/
public static <A> scala.collection.immutable.Seq<A> asScala(Collection<A> javaCollection) {
return scala.collection.JavaConverters.collectionAsScalaIterableConverter(javaCollection).asScala().toList();
}
代码示例来源:origin: com.typesafe.play/play_2.11
/**
* Converts a Java Collection to a Scala Seq.
*
* @param javaCollection the java collection
* @param <A> the type of Seq element
* @return the scala Seq.
*/
public static <A> scala.collection.immutable.Seq<A> asScala(Collection<A> javaCollection) {
return scala.collection.JavaConverters.collectionAsScalaIterableConverter(javaCollection).asScala().toList();
}
代码示例来源:origin: com.typesafe.play/play_2.12
/**
* Converts a Java Collection to a Scala Seq.
*
* @param javaCollection the java collection
* @param <A> the type of Seq element
* @return the scala Seq.
*/
public static <A> scala.collection.immutable.Seq<A> asScala(Collection<A> javaCollection) {
return scala.collection.JavaConverters.collectionAsScalaIterableConverter(javaCollection).asScala().toList();
}
代码示例来源:origin: com.typesafe.play/play_2.10
/**
* Converts a Java Collection to a Scala Seq.
*/
public static <A> scala.collection.immutable.Seq<A> asScala(Collection<A> javaCollection) {
return scala.collection.JavaConverters.collectionAsScalaIterableConverter(javaCollection).asScala().toList();
}
代码示例来源:origin: com.typesafe.play/play_2.12
@Override
public final Seq<play.api.inject.Binding<?>> bindings(final play.api.Environment environment,
final play.api.Configuration configuration) {
List<play.api.inject.Binding<?>> list = bindings(environment.asJava(), configuration.underlying()).stream()
.map(Binding::asScala)
.collect(Collectors.toList());
return JavaConverters.collectionAsScalaIterableConverter(list).asScala().toList();
}
代码示例来源:origin: com.typesafe.play/play
@Override
public final Seq<play.api.inject.Binding<?>> bindings(final play.api.Environment environment,
final play.api.Configuration configuration) {
List<play.api.inject.Binding<?>> list = bindings(environment.asJava(), configuration.underlying()).stream()
.map(Binding::asScala)
.collect(Collectors.toList());
return JavaConverters.collectionAsScalaIterableConverter(list).asScala().toList();
}
代码示例来源:origin: com.typesafe.play/play_2.11
@Override
public final Seq<play.api.inject.Binding<?>> bindings(final play.api.Environment environment,
final play.api.Configuration configuration) {
List<play.api.inject.Binding<?>> list = bindings(environment.asJava(), configuration.underlying()).stream()
.map(Binding::asScala)
.collect(Collectors.toList());
return JavaConverters.collectionAsScalaIterableConverter(list).asScala().toList();
}
代码示例来源:origin: com.mangofactory.swagger/swagger-models
@Override
public AllowableListValues apply(ApiModelProperty annotation) {
List<String> allowableValues
= Splitter.on(',').omitEmptyStrings().splitToList(nullToEmpty(annotation.allowableValues()));
return new AllowableListValues(JavaConversions.collectionAsScalaIterable(allowableValues).toList(), "LIST");
}
};
代码示例来源:origin: com.sandinh/play-alone
/**
* Converts a Java Collection to a Scala Seq.
*/
public static <A> scala.collection.immutable.Seq<A> asScala(Collection<A> javaCollection) {
return scala.collection.JavaConverters.collectionAsScalaIterableConverter(javaCollection).asScala().toList();
}
代码示例来源:origin: apache/crunch
public static Object scalaIterableCheck(Object array, Schema schema) {
Class collectionClass = ScalaSafeReflectData.getClassProp(schema,
ScalaSafeReflectData.CLASS_PROP);
if (collectionClass != null) {
if (scala.collection.Iterable.class.isAssignableFrom(collectionClass)) {
scala.collection.Iterable it = toIter(array);
if (scala.collection.immutable.List.class.isAssignableFrom(collectionClass)) {
return it.toList();
}
if (scala.collection.mutable.Buffer.class.isAssignableFrom(collectionClass)) {
return it.toBuffer();
}
if (scala.collection.immutable.Set.class.isAssignableFrom(collectionClass)) {
return it.toSet();
}
return it;
}
}
return array;
}
代码示例来源:origin: org.apache.storm/storm-druid
public List<E> update(List<TridentTuple> tuples, TridentCollector collector) {
List<E> events = new ArrayList<>(tuples.size());
for (TridentTuple tuple: tuples) {
events.add(druidEventMapper.getEvent(tuple));
}
LOG.info("Sending [{}] events", events.size());
scala.collection.immutable.List<E> scalaList = scala.collection.JavaConversions.collectionAsScalaIterable(events).toList();
Collection<Future<SendResult>> futureList = scala.collection.JavaConversions.asJavaCollection(beam.sendAll(scalaList));
List<E> discardedEvents = new ArrayList<>();
int index = 0;
for (Future<SendResult> future : futureList) {
try {
SendResult result = Await.result(future);
if (!result.sent()) {
discardedEvents.add(events.get(index));
}
} catch (Exception e) {
LOG.error("Failed in writing messages to Druid", e);
}
index++;
}
return discardedEvents;
}
代码示例来源:origin: com.mangofactory.swagger/swagger-models
public static AllowableValues allowableValues(ResolvedType resolvedType) {
if (isBaseType(simpleTypeName(resolvedType)) && resolvedType.getErasedType().isEnum()) {
List<String> enumValues = getEnumValues(resolvedType.getErasedType());
return new AllowableListValues(JavaConversions.collectionAsScalaIterable(enumValues).toList(), "LIST");
}
return null;
}
代码示例来源:origin: kframework/k
List<KApply> topologicalSorted = mutable(TopologicalSort.tsort(immutable(edges)).toList());
return state.stream().sorted((k1, k2) -> (topologicalSorted.indexOf(k1) - topologicalSorted.indexOf(k2)));
代码示例来源:origin: kframework/k
List<KApply> topologicalSorted = mutable(TopologicalSort.tsort(immutable(edges)).toList());
return state.stream().sorted((k1, k2) -> (topologicalSorted.indexOf(k1) - topologicalSorted.indexOf(k2)));
代码示例来源:origin: com.mangofactory.swagger/swagger-models
@Override
public com.google.common.base.Optional<Model> modelFor(ModelContext modelContext) {
ResolvedType propertiesHost = alternateTypeProvider.alternateFor(modelContext.resolvedType(resolver));
if (isContainerType(propertiesHost)
|| propertiesHost.getErasedType().isEnum()
|| Types.isBaseType(Types.typeNameFor(propertiesHost.getErasedType()))) {
return Optional.absent();
}
Map<String, ModelProperty> properties = newLinkedHashMap();
int index = 0;
for (com.mangofactory.swagger.models.property.ModelProperty each : properties(modelContext, propertiesHost)) {
properties.put(each.getName(), new ModelProperty(each.typeName(modelContext),
each.qualifiedTypeName(),
index,
each.isRequired(),
each.propertyDescription(),
each.allowableValues(),
itemModelRef(each.getType())
));
}
return Optional.of(new Model(typeName(propertiesHost),
typeName(propertiesHost),
simpleQualifiedTypeName(propertiesHost),
toScalaLinkedHashMap(properties),
modelDescription(propertiesHost), Option.apply(""),
Option.<String>empty(),
collectionAsScalaIterable(new ArrayList<String>()).toList()));
}
内容来源于网络,如有侵权,请联系作者删除!