本文整理了Java中java.lang.Iterable.spliterator()
方法的一些代码示例,展示了Iterable.spliterator()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Iterable.spliterator()
方法的具体详情如下:
包路径:java.lang.Iterable
类名称:Iterable
方法名:spliterator
[英]Creates a Spliterator over the elements described by this Iterable.
[中]在此Iterable描述的元素上创建拆分器。
代码示例来源:origin: iluwatar/java-design-patterns
@Override
public Spliterator<E> spliterator() {
return iterable.spliterator();
}
代码示例来源:origin: google/guava
@SuppressWarnings("unchecked") // safe upcast, assuming no one has a crazy Spliterator subclass
@Override
public Spliterator<T> spliterator() {
return (Spliterator<T>) iterable.spliterator();
}
代码示例来源:origin: prestodb/presto
@SuppressWarnings("unchecked") // safe upcast, assuming no one has a crazy Spliterator subclass
@Override
public Spliterator<T> spliterator() {
return (Spliterator<T>) iterable.spliterator();
}
代码示例来源:origin: google/guava
/**
* Returns a sequential {@link Stream} of the contents of {@code iterable}, delegating to {@link
* Collection#stream} if possible.
*/
public static <T> Stream<T> stream(Iterable<T> iterable) {
return (iterable instanceof Collection)
? ((Collection<T>) iterable).stream()
: StreamSupport.stream(iterable.spliterator(), false);
}
代码示例来源:origin: eclipse-vertx/vert.x
static <T> Stream<T> asStream(Iterator<T> sourceIterator) {
Iterable<T> iterable = () -> sourceIterator;
return StreamSupport.stream(iterable.spliterator(), false);
}
代码示例来源:origin: prestodb/presto
/**
* Returns a sequential {@link Stream} of the contents of {@code iterable}, delegating to {@link
* Collection#stream} if possible.
*/
public static <T> Stream<T> stream(Iterable<T> iterable) {
return (iterable instanceof Collection)
? ((Collection<T>) iterable).stream()
: StreamSupport.stream(iterable.spliterator(), false);
}
代码示例来源:origin: google/guava
@Override
public Spliterator<T> spliterator() {
return CollectSpliterators.map(fromIterable.spliterator(), function);
}
};
代码示例来源:origin: google/guava
@Override
public Spliterator<T> spliterator() {
return CollectSpliterators.filter(unfiltered.spliterator(), retainIfTrue);
}
};
代码示例来源:origin: apache/incubator-druid
@Override
public Object apply(String input)
{
final List retVal = StreamSupport.stream(listSplitter.split(input).spliterator(), false)
.map(Strings::emptyToNull)
.collect(Collectors.toList());
if (retVal.size() == 1) {
return retVal.get(0);
} else {
return retVal;
}
}
};
代码示例来源:origin: prestodb/presto
@Override
public Spliterator<T> spliterator() {
return CollectSpliterators.map(fromIterable.spliterator(), function);
}
};
代码示例来源:origin: prestodb/presto
@Override
public Spliterator<T> spliterator() {
return CollectSpliterators.filter(unfiltered.spliterator(), retainIfTrue);
}
};
代码示例来源:origin: apache/incubator-druid
public static List<DimensionSpec> toSpec(Iterable<String> dimensionNames)
{
return StreamSupport.stream(dimensionNames.spliterator(), false)
.map(input -> new DefaultDimensionSpec(input, input))
.collect(Collectors.toList());
}
代码示例来源:origin: apache/flink
private List<ValueWithTs<?>> getPrevUpdates(String verifierId) throws Exception {
return StreamSupport
.stream(prevUpdatesByVerifierId.get(verifierId).get().spliterator(), false)
.collect(Collectors.toList());
}
代码示例来源:origin: apache/flink
@Override
@Nonnull
Map<String, String> getInternal(@Nonnull MapState<String, String> state) throws Exception {
return StreamSupport.stream(state.entries().spliterator(), false)
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
代码示例来源:origin: apache/flink
@Override
@Nonnull
List<String> getInternal(@Nonnull ListState<String> state) throws Exception {
return StreamSupport.stream(state.get().spliterator(), false)
.collect(Collectors.toList());
}
代码示例来源:origin: square/javapoet
/**
* Joins {@code codeBlocks} into a single {@link CodeBlock}, each separated by {@code separator}.
* For example, joining {@code String s}, {@code Object o} and {@code int i} using {@code ", "}
* would produce {@code String s, Object o, int i}.
*/
public static CodeBlock join(Iterable<CodeBlock> codeBlocks, String separator) {
return StreamSupport.stream(codeBlocks.spliterator(), false).collect(joining(separator));
}
代码示例来源:origin: neo4j/neo4j
/**
* @param resources {@link Iterable} over resources to close.
*/
public static <T extends Resource> void closeAll( Iterable<T> resources )
{
closeAll( StreamSupport.stream( resources.spliterator(), false ) );
}
代码示例来源:origin: neo4j/neo4j
public Iterable<File> allFiles()
{
return StreamSupport.stream( rotationStrategy.candidateFiles().spliterator(), false )
.filter( fs::fileExists )
.collect( Collectors.toList() );
}
代码示例来源:origin: apache/flink
@Override
public void apply(
Integer key, TimeWindow window, Iterable<Event> input,
Collector<Tuple2<Integer, List<Event>>> out) throws Exception {
out.collect(Tuple2.of(key, StreamSupport.stream(input.spliterator(), false).collect(Collectors.toList())));
}
})
代码示例来源:origin: neo4j/neo4j
public static <R extends AbstractBaseRecord, A> List<R> records(
Iterable<RecordAccess.RecordProxy<R,A>> changes )
{
return StreamSupport.stream( changes.spliterator(), false ).map(
RecordAccess.RecordProxy::forChangingData ).collect( Collectors.toList() );
}
内容来源于网络,如有侵权,请联系作者删除!