Class Collectors


  • public final class Collectors
    extends Object

    Implementations of Collector that implement various useful reduction operations.

    Since:
    2017.2
    Author:
    Andrey Shcheglov <mailto:andrey.shcheglov@jetbrains.com>
    See Also:
    Collectors
    • Method Detail

      • toUnmodifiableList

        @NotNull
        public static <T> Collector<T,​List<T>,​List<T>> toUnmodifiableList()

        Returns a Collector that accumulates the input elements into a new unmodifiable List. There are no guarantees on the type, serializability, or thread-safety of the List returned; if more control over the returned List is required, use Collectors.toCollection(Supplier).

        Type Parameters:
        T - the type of the input elements.
        Returns:
        a Collector which collects all the input elements into an unmodifiable List, in encounter order.
        See Also:
        Collectors.toList(), Collections.unmodifiableList(List)