public class StreamUtils extends Object
Constructor and Description |
---|
StreamUtils() |
Modifier and Type | Method and Description |
---|---|
static <T,A,D> Collector<T,?,D> |
maxAll(Comparator<? super T> comparator,
Collector<? super T,A,D> downstream)
A collector that returns all results that are the maximum based on the provided comparator.
|
static <T,A,D> Collector<T,?,D> |
minAll(Comparator<? super T> comparator,
Collector<? super T,A,D> downstream)
A collector that returns all results that are the minimum based on the
provided comparator.
|
static <T> Collector<T,Collection<T>,Collection<T>> |
toImmutableCollection() |
static <T,A extends Collection<T>> |
toImmutableCollection(Supplier<A> collectionFactory) |
public static <T,A,D> Collector<T,?,D> maxAll(Comparator<? super T> comparator, Collector<? super T,A,D> downstream)
T
- The type of objects being streamedA
- The mutable accumulation type of the reduction operationD
- The result type of the reduction operationcomparator
- The comparator to order the items in the streamdownstream
- Which collector to use to combine the resultspublic static <T,A,D> Collector<T,?,D> minAll(Comparator<? super T> comparator, Collector<? super T,A,D> downstream)
T
- The type of objects being streamedA
- The mutable accumulation type of the reduction operationD
- The result type of the reduction operationcomparator
- The comparator to order the items in the streamdownstream
- Which collector to use to combine the resultspublic static <T,A extends Collection<T>> Collector<T,A,Collection<T>> toImmutableCollection(Supplier<A> collectionFactory)
T
- The type of the input elementsA
- The accumulation typecollectionFactory
- The collection factorypublic static <T> Collector<T,Collection<T>,Collection<T>> toImmutableCollection()
T
- The type