public class StreamUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> Predicate<T> |
distinctBy(Function<? super T,?> fn) |
static <TItem,TReturn> |
ifEmpty(Stream<TItem> stream,
Supplier<TReturn> trueFunc,
Function<Stream<TItem>,TReturn> falseFunc) |
static <T,R> Stream<R> |
mapOptional(Stream<T> stream,
Function<T,R> transform) |
static <T> Stream<T> |
stream(Iterable<T>... iterables)
Create a
Stream over the elements of the iterables, in order. |
static <T> Stream<T> |
stream(Iterator<T>... iterators)
Create a
Stream over the elements of the iterators, in order. |
static Stream<Element> |
stream(Query... queries)
Create a
Stream containing the results of executing the queries, in order. |
static <T> Collector<T,com.google.common.collect.ImmutableList.Builder<T>,com.google.common.collect.ImmutableList<T>> |
toImmutableList() |
static <T,K,V> Collector<T,com.google.common.collect.ImmutableMap.Builder<K,V>,com.google.common.collect.ImmutableMap<K,V>> |
toImmutableMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper) |
static <T> Collector<T,com.google.common.collect.ImmutableSet.Builder<T>,com.google.common.collect.ImmutableSet<T>> |
toImmutableSet() |
static <T> Iterable<T> |
toIterable(Stream<T> stream) |
static <T> Collector<T,LinkedHashSet<T>,LinkedHashSet<T>> |
toLinkedHashSet() |
public static Stream<Element> stream(Query... queries)
Stream containing the results of executing the queries, in order. The results
are not loaded into memory first.@SafeVarargs public static <T> Stream<T> stream(Iterable<T>... iterables)
Stream over the elements of the iterables, in order. A list of iterators
is first created from the iterables, and passed to stream(Iterator[]). The iterable elements are not
loaded into memory first.@SafeVarargs public static <T> Stream<T> stream(Iterator<T>... iterators)
Stream over the elements of the iterators, in order. The iterator elements
are not loaded into memory first.public static <T> Collector<T,com.google.common.collect.ImmutableList.Builder<T>,com.google.common.collect.ImmutableList<T>> toImmutableList()
public static <T> Collector<T,com.google.common.collect.ImmutableSet.Builder<T>,com.google.common.collect.ImmutableSet<T>> toImmutableSet()
public static <T,K,V> Collector<T,com.google.common.collect.ImmutableMap.Builder<K,V>,com.google.common.collect.ImmutableMap<K,V>> toImmutableMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
public static <T> Collector<T,LinkedHashSet<T>,LinkedHashSet<T>> toLinkedHashSet()
public static <TItem,TReturn> TReturn ifEmpty(Stream<TItem> stream, Supplier<TReturn> trueFunc, Function<Stream<TItem>,TReturn> falseFunc)
Copyright © 2016–2021 MWARE SOLUTIONS. All rights reserved.