Modifier and Type | Method and Description |
---|---|
static <T> Collector<T,?,List<T>> |
toImmutableList()
Returns a
Collector that accumulates the input elements into an immutable List . |
static <T,K,V> Collector<T,?,Map<K,V>> |
toImmutableMap(Function<T,K> keyMapper,
Function<T,V> valueMapper)
Returns a
Collector that accumulates elements into an immutable Map whose keys and values are the result of
applying the provided mapping functions to the input elements. |
public static <T> Collector<T,?,List<T>> toImmutableList()
Collector
that accumulates the input elements into an immutable List
.T
- the type of the input elementsCollector
which collects all the input elements into an immutable List
, in encounter orderpublic static <T,K,V> Collector<T,?,Map<K,V>> toImmutableMap(Function<T,K> keyMapper, Function<T,V> valueMapper)
Collector
that accumulates elements into an immutable Map
whose keys and values are the result of
applying the provided mapping functions to the input elements.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 Map
whose keys and values are the result of applying mapping functions to
the input elementsCopyright © 2018. All rights reserved.