@Override public Spliterator<E> spliterator() { return iterable.spliterator(); }
@SuppressWarnings("unchecked") // safe upcast, assuming no one has a crazy Spliterator subclass @Override public Spliterator<T> spliterator() { return (Spliterator<T>) iterable.spliterator(); }
@SuppressWarnings("unchecked") // safe upcast, assuming no one has a crazy Spliterator subclass @Override public Spliterator<T> spliterator() { return (Spliterator<T>) iterable.spliterator(); }
/** * 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); }
static <T> Stream<T> asStream(Iterator<T> sourceIterator) { Iterable<T> iterable = () -> sourceIterator; return StreamSupport.stream(iterable.spliterator(), false); }
/** * 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); }
@Override public Spliterator<T> spliterator() { return CollectSpliterators.map(fromIterable.spliterator(), function); } };
@Override public Spliterator<T> spliterator() { return CollectSpliterators.filter(unfiltered.spliterator(), retainIfTrue); } };
@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; } } };
@Override public Spliterator<T> spliterator() { return CollectSpliterators.map(fromIterable.spliterator(), function); } };
@Override public Spliterator<T> spliterator() { return CollectSpliterators.filter(unfiltered.spliterator(), retainIfTrue); } };
public static List<DimensionSpec> toSpec(Iterable<String> dimensionNames) { return StreamSupport.stream(dimensionNames.spliterator(), false) .map(input -> new DefaultDimensionSpec(input, input)) .collect(Collectors.toList()); }
private List<ValueWithTs<?>> getPrevUpdates(String verifierId) throws Exception { return StreamSupport .stream(prevUpdatesByVerifierId.get(verifierId).get().spliterator(), false) .collect(Collectors.toList()); }
@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)); }
@Override @Nonnull List<String> getInternal(@Nonnull ListState<String> state) throws Exception { return StreamSupport.stream(state.get().spliterator(), false) .collect(Collectors.toList()); }
/** * 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)); }
/** * @param resources {@link Iterable} over resources to close. */ public static <T extends Resource> void closeAll( Iterable<T> resources ) { closeAll( StreamSupport.stream( resources.spliterator(), false ) ); }
public Iterable<File> allFiles() { return StreamSupport.stream( rotationStrategy.candidateFiles().spliterator(), false ) .filter( fs::fileExists ) .collect( Collectors.toList() ); }
@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()))); } })
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() ); }