| Constructor and Description |
|---|
GuavaCollectors() |
| Modifier and Type | Method and Description |
|---|---|
static <T> java.util.stream.Collector<T,?,com.google.common.collect.ImmutableList<T>> |
toImmutableList()
Returns a
Collector that accumulates the input elements into an ImmutableList, preserving the
order. |
static <T,K,V> java.util.stream.Collector<T,?,com.google.common.collect.ImmutableMap<K,V>> |
toImmutableMap(java.util.function.Function<? super T,? extends K> keyMapper,
java.util.function.Function<? super T,? extends V> valueMapper)
Returns a
Collector that accumulates elements into an ImmutableMap whose keys and values are the
result of applying the provided mapping functions to the input elements. |
public static <T> java.util.stream.Collector<T,?,com.google.common.collect.ImmutableList<T>> toImmutableList()
Collector that accumulates the input elements into an ImmutableList, preserving the
order.
This works similar to Collectors.toList() except that return value is guaranteed to be immutable and the
return type proves that.
T - the type of the input elementspublic static <T,K,V> java.util.stream.Collector<T,?,com.google.common.collect.ImmutableMap<K,V>> toImmutableMap(java.util.function.Function<? super T,? extends K> keyMapper, java.util.function.Function<? super T,? extends V> valueMapper)
Collector that accumulates elements into an ImmutableMap whose keys and values are the
result of applying the provided mapping functions to the input elements.
This works similar to Collectors.toMap(Function, Function) except that return value is guaranteed to be
immutable and the return type proves that.
T - the type of the input elementsK - the type of the keys in the produced mapV - the type of the values in the produced mapCopyright © 2016. All rights reserved.