public class MoreCollectors extends Object
Collector.Collectors| Modifier and Type | Method and Description |
|---|---|
static <E> Collector<E,List<E>,List<E>> |
toUnmodifiableList()
Returns a
Collector that accumulates the input elements into a new unmodifiable List. |
static <E,C extends List<E>> |
toUnmodifiableList(Supplier<C> listFactory)
Returns a
Collector that accumulates the input elements into a new unmodifiable List. |
static <E> Collector<E,Set<E>,Set<E>> |
toUnmodifiableSet()
Returns a
Collector that accumulates the input elements into a new unmodifiable Set. |
static <E,C extends Set<E>> |
toUnmodifiableSet(Supplier<C> setFactory)
Returns a
Collector that accumulates the input elements into a new unmodifiable Set. |
public static <E> Collector<E,List<E>,List<E>> toUnmodifiableList()
Collector that accumulates the input elements into a new unmodifiable List.public static <E,C extends List<E>> Collector<E,C,List<E>> toUnmodifiableList(Supplier<C> listFactory)
Collector that accumulates the input elements into a new unmodifiable List.
Uses the given factory to create the internal list.public static <E> Collector<E,Set<E>,Set<E>> toUnmodifiableSet()
Collector that accumulates the input elements into a new unmodifiable Set.