public static class LambdaUtils.Collectors extends Object
collectors
Constructor and Description |
---|
Collectors() |
Modifier and Type | Method and Description |
---|---|
private static <T> BinaryOperator<T> |
_throwingMerger() |
static <T,K,U> Collector<T,?,Map<K,U>> |
toLinkedHashMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends U> valueMapper)
Returns a
Collector that accumulates elements into a
LinkedHashMap whose keys and values are the result of applying the provided
mapping functions to the input elements. |
static <T,R> Collector<T,List<T>,R> |
withListAccumulation(Function<List<T>,R> finisher)
|
public Collectors()
public static <T,K,U> Collector<T,?,Map<K,U>> toLinkedHashMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends U> valueMapper)
Collector
that accumulates elements into a
LinkedHashMap
whose keys and values are the result of applying the provided
mapping functions to the input elements.
Collectors.toMap(Function, Function)
,
but elements are collected into a LinkedHashMap
instead of a HashMap
T
- the type of the input elementsK
- the output type of the key mapping functionU
- the output type of the value mapping functionkeyMapper
- a mapping function to produce keysvalueMapper
- a mapping function to produce valuesCollector
which collects elements into a LinkedHashMap
whose keys and values are the result of applying mapping functions to
the input elementsprivate static <T> BinaryOperator<T> _throwingMerger()
public static <T,R> Collector<T,List<T>,R> withListAccumulation(Function<List<T>,R> finisher)
Collector
which accumulates elements into a List
,
this list being transformed by the provided finisher into the final result.T
- the type of the input elementsR
- the final result typefinisher
- The finisher function for the new collector