public interface StreamUtils
Stream utility methods and classes.| Modifier and Type | Method and Description |
|---|---|
static <T> Stream<T> |
createStreamFromIterator(CloseableIterator<T> iterator)
Returns a
Stream backed by the given CloseableIterator and forwarding calls to
BaseStream.close() to the iterator. |
static <T> Stream<T> |
createStreamFromIterator(Iterator<T> iterator)
|
static <T> Stream<T> |
fromNullable(T source)
|
static <T,K,V> Collector<T,MultiValueMap<K,V>,MultiValueMap<K,V>> |
toMultiMap(Function<T,K> keyFunction,
Function<T,V> valueFunction)
Returns a
Collector to create a MultiValueMap. |
static <T> Collector<T,?,List<T>> |
toUnmodifiableList()
|
static <T> Collector<T,?,Set<T>> |
toUnmodifiableSet()
|
static <L,R,T> Stream<T> |
zip(Stream<L> left,
Stream<R> right,
BiFunction<L,R,T> combiner)
Zips the given
Streams using the given BiFunction. |
static <T> Stream<T> createStreamFromIterator(Iterator<T> iterator)
iterator - must not be null.static <T> Stream<T> createStreamFromIterator(CloseableIterator<T> iterator)
Stream backed by the given CloseableIterator and forwarding calls to
BaseStream.close() to the iterator.iterator - must not be null.static <T> Collector<T,?,List<T>> toUnmodifiableList()
static <T,K,V> Collector<T,MultiValueMap<K,V>,MultiValueMap<K,V>> toMultiMap(Function<T,K> keyFunction, Function<T,V> valueFunction)
Collector to create a MultiValueMap.static <L,R,T> Stream<T> zip(Stream<L> left, Stream<R> right, BiFunction<L,R,T> combiner)
Streams using the given BiFunction. The resulting Stream will have the
length of the shorter of the two, abbreviating the zipping when the shorter of the two Streams is
exhausted.left - must not be null.right - must not be null.combiner - must not be null.Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.