Package org.springframework.data.util
Interface StreamUtils
public interface StreamUtils
Spring Data specific Java 
Stream utility methods and classes.- Since:
 - 1.10
 - Author:
 - Thomas Darimont, Oliver Gierke
 
- 
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic <T> Stream<T>createStreamFromIterator(Iterator<T> iterator) static <T> Stream<T>createStreamFromIterator(CloseableIterator<T> iterator) Returns aStreambacked by the givenCloseableIteratorand forwarding calls toBaseStream.close()to the iterator.static <T> Stream<T>fromNullable(@Nullable T source) static <T,K, V> Collector<T, MultiValueMap<K, V>, MultiValueMap<K, V>> toMultiMap(Function<T, K> keyFunction, Function<T, V> valueFunction) Returns aCollectorto create aMultiValueMap.static <L,R, T> Stream<T> zip(Stream<L> left, Stream<R> right, BiFunction<L, R, T> combiner) Zips the givenStreams using the givenBiFunction. 
- 
Method Details
- 
createStreamFromIterator
- Parameters:
 iterator- must not be null.- Returns:
 
 - 
createStreamFromIterator
Returns aStreambacked by the givenCloseableIteratorand forwarding calls toBaseStream.close()to the iterator.- Parameters:
 iterator- must not be null.- Returns:
 - Since:
 - 2.0
 
 - 
toUnmodifiableList
- Returns:
 - will never be null.
 
 - 
toUnmodifiableSet
- Returns:
 - will never be null.
 
 - 
toMultiMap
static <T,K, Collector<T,V> MultiValueMap<K, toMultiMapV>, MultiValueMap<K, V>> (Function<T, K> keyFunction, Function<T, V> valueFunction) Returns aCollectorto create aMultiValueMap. - 
fromNullable
 - 
zip
Zips the givenStreams using the givenBiFunction. The resultingStreamwill have the length of the shorter of the two, abbreviating the zipping when the shorter of the twoStreams is exhausted.- Parameters:
 left- must not be null.right- must not be null.combiner- must not be null.- Returns:
 - Since:
 - 2.1
 
 
 -