Class Collectors

java.lang.Object
com.landawn.abacus.util.stream.Collectors
Direct Known Subclasses:
Collectors.MoreCollectors

public abstract class Collectors extends Object
  • Method Details

    • toCollection

      public static <T, C extends Collection<T>> Collector<T,?,C> toCollection(Supplier<? extends C> collectionFactory)
      Type Parameters:
      T -
      C -
      Parameters:
      collectionFactory -
      Returns:
    • toList

      public static <T> Collector<T,?,List<T>> toList()
      Type Parameters:
      T -
      Returns:
    • toLinkedList

      public static <T> Collector<T,?,LinkedList<T>> toLinkedList()
      Type Parameters:
      T -
      Returns:
    • toImmutableList

      public static <T> Collector<T,?,ImmutableList<T>> toImmutableList()
      Type Parameters:
      T -
      Returns:
    • toSet

      public static <T> Collector<T,?,Set<T>> toSet()
      Type Parameters:
      T -
      Returns:
    • toLinkedHashSet

      public static <T> Collector<T,?,Set<T>> toLinkedHashSet()
      Type Parameters:
      T -
      Returns:
    • toImmutableSet

      public static <T> Collector<T,?,ImmutableSet<T>> toImmutableSet()
      Type Parameters:
      T -
      Returns:
    • toQueue

      public static <T> Collector<T,?,Queue<T>> toQueue()
      Type Parameters:
      T -
      Returns:
    • toDeque

      public static <T> Collector<T,?,Deque<T>> toDeque()
      Type Parameters:
      T -
      Returns:
    • toCollection

      public static <T, C extends Collection<T>> Collector<T,?,C> toCollection(Supplier<? extends C> collectionFactory, int atMostSize)
      Type Parameters:
      T -
      C -
      Parameters:
      collectionFactory -
      atMostSize -
      Returns:
    • toList

      public static <T> Collector<T,?,List<T>> toList(int atMostSize)
      Type Parameters:
      T -
      Parameters:
      atMostSize -
      Returns:
    • toSet

      public static <T> Collector<T,?,Set<T>> toSet(int atMostSize)
      Type Parameters:
      T -
      Parameters:
      atMostSize -
      Returns:
    • toMultiset

      public static <T> Collector<T,?,Multiset<T>> toMultiset()
      Type Parameters:
      T -
      Returns:
    • toMultiset

      public static <T> Collector<T,?,Multiset<T>> toMultiset(Supplier<Multiset<T>> supplier)
      Type Parameters:
      T -
      Parameters:
      supplier -
      Returns:
    • toLongMultiset

      public static <T> Collector<T,?,LongMultiset<T>> toLongMultiset()
      Type Parameters:
      T -
      Returns:
    • toLongMultiset

      public static <T> Collector<T,?,LongMultiset<T>> toLongMultiset(Supplier<LongMultiset<T>> supplier)
      Type Parameters:
      T -
      Parameters:
      supplier -
      Returns:
    • toArray

      public static <T> Collector<T,?,Object[]> toArray()
      Type Parameters:
      T -
      Returns:
    • toArray

      public static <T, A> Collector<T,?,A[]> toArray(Supplier<A[]> arraySupplier)
      Type Parameters:
      T -
      A -
      Parameters:
      arraySupplier -
      Returns:
    • toArray

      public static <T, A> Collector<T,?,A[]> toArray(IntFunction<A[]> arraySupplier)
      Type Parameters:
      T -
      A -
      Parameters:
      arraySupplier -
      Returns:
    • toBooleanList

      public static Collector<Boolean,?,BooleanList> toBooleanList()
      Returns:
    • toBooleanArray

      public static Collector<Boolean,?,boolean[]> toBooleanArray()
      Returns:
    • toCharList

      public static Collector<Character,?,CharList> toCharList()
      Returns:
    • toCharArray

      public static Collector<Character,?,char[]> toCharArray()
      Returns:
    • toByteList

      public static Collector<Byte,?,ByteList> toByteList()
      Returns:
    • toByteArray

      public static Collector<Byte,?,byte[]> toByteArray()
      Returns:
    • toShortList

      public static Collector<Short,?,ShortList> toShortList()
      Returns:
    • toShortArray

      public static Collector<Short,?,short[]> toShortArray()
      Returns:
    • toIntList

      public static Collector<Integer,?,IntList> toIntList()
      Returns:
    • toIntArray

      public static Collector<Integer,?,int[]> toIntArray()
      Returns:
    • toLongList

      public static Collector<Long,?,LongList> toLongList()
      Returns:
    • toLongArray

      public static Collector<Long,?,long[]> toLongArray()
      Returns:
    • toFloatList

      public static Collector<Float,?,FloatList> toFloatList()
      Returns:
    • toFloatArray

      public static Collector<Float,?,float[]> toFloatArray()
      Returns:
    • toDoubleList

      public static Collector<Double,?,DoubleList> toDoubleList()
      Returns:
    • toDoubleArray

      public static Collector<Double,?,double[]> toDoubleArray()
      Returns:
    • onlyOne

      public static <T> Collector<T,?,u.Optional<T>> onlyOne()
      TooManyElementsException is threw if there are more than one values are collected.
      Type Parameters:
      T -
      Returns:
    • onlyOne

      public static <T> Collector<T,?,u.Optional<T>> onlyOne(Predicate<? super T> predicate)
      TooManyElementsException is threw if there are more than one values are collected.
      Type Parameters:
      T -
      Parameters:
      predicate -
      Returns:
    • first

      public static <T> Collector<T,?,u.Optional<T>> first()
      Only works for sequential Stream.
      Type Parameters:
      T -
      Returns:
      Throws:
      UnsupportedOperationException - operated by multiple threads
    • last

      public static <T> Collector<T,?,u.Optional<T>> last()
      Only works for sequential Stream.
      Type Parameters:
      T -
      Returns:
      Throws:
      UnsupportedOperationException - operated by multiple threads
    • first

      public static <T> Collector<T,?,List<T>> first(int n)
      Only works for sequential Stream.
      Type Parameters:
      T -
      Parameters:
      n -
      Returns:
      Throws:
      UnsupportedOperationException - operated by multiple threads
    • last

      public static <T> Collector<T,?,List<T>> last(int n)
      Only works for sequential Stream.
      Type Parameters:
      T -
      Parameters:
      n -
      Returns:
      Throws:
      UnsupportedOperationException - operated by multiple threads
    • joining

      public static Collector<CharSequence,?,String> joining()
      Returns:
    • joining

      public static Collector<CharSequence,?,String> joining(CharSequence delimiter)
      Parameters:
      delimiter -
      Returns:
    • joining

      public static Collector<CharSequence,?,String> joining(CharSequence delimiter, CharSequence prefix, CharSequence suffix)
      Parameters:
      delimiter -
      prefix -
      suffix -
      Returns:
    • filtering

      @Beta public static <T> Collector<T,?,List<T>> filtering(Predicate<? super T> predicate)
      It's copied from StreamEx: https://github.com/amaembo/streamex under Apache License v2 and may be modified.
      Returns a Collector which filters input elements by the supplied predicate, collecting them to the list.

      This method behaves like filtering(predicate, Collectors.toList()).

      There are no guarantees on the type, mutability, serializability, or thread-safety of the List returned.

      Type Parameters:
      T - the type of the input elements
      Parameters:
      predicate - a filter function to be applied to the input elements
      Returns:
      a collector which applies the predicate to the input elements and collects the elements for which predicate returned true to the List
      Since:
      0.6.0
      See Also:
    • filtering

      public static <T, A, R> Collector<T,?,R> filtering(Predicate<? super T> predicate, Collector<? super T,A,R> downstream)
      It's copied from StreamEx: https://github.com/amaembo/streamex under Apache License v2 and may be modified.
      Returns a Collector which passes only those elements to the specified downstream collector which match given predicate.

      This method returns a short-circuiting collector if downstream collector is short-circuiting.

      The operation performed by the returned collector is equivalent to stream.filter(predicate).collect(downstream). This collector is mostly useful as a downstream collector in cascaded operation involving #pairing(Collector, Collector, BiFunction) collector.

      This method is similar to Collectors.filtering method which appears in JDK 9. However when downstream collector is short-circuiting , this method will also return a short-circuiting collector.

      Type Parameters:
      T - the type of the input elements
      A - intermediate accumulation type of the downstream collector
      R - result type of collector
      Parameters:
      predicate - a filter function to be applied to the input elements
      downstream - a collector which will accept filtered values
      Returns:
      a collector which applies the predicate to the input elements and provides the elements for which predicate returned true to the downstream collector
      Since:
      0.4.0
      See Also:
      • #pairing(Collector, Collector, BiFunction)
    • mapping

      @Beta public static <T, U> Collector<T,?,List<U>> mapping(Function<? super T,? extends U> mapper)
      Type Parameters:
      T -
      U -
      Parameters:
      mapper -
      Returns:
    • mapping

      public static <T, U, A, R> Collector<T,?,R> mapping(Function<? super T,? extends U> mapper, Collector<? super U,A,R> downstream)
      Type Parameters:
      T -
      U -
      A -
      R -
      Parameters:
      mapper -
      downstream -
      Returns:
    • flatMaping

      @Beta public static <T, U> Collector<T,?,List<U>> flatMaping(Function<? super T,? extends Stream<? extends U>> mapper)
      Type Parameters:
      T -
      U -
      Parameters:
      mapper -
      Returns:
    • flatMaping

      public static <T, U, A, R> Collector<T,?,R> flatMaping(Function<? super T,? extends Stream<? extends U>> mapper, Collector<? super U,A,R> downstream)
      Type Parameters:
      T -
      U -
      A -
      R -
      Parameters:
      mapper -
      downstream -
      Returns:
    • flattMaping

      @Beta public static <T, U> Collector<T,?,List<U>> flattMaping(Function<? super T,? extends Stream<? extends U>> mapper)
      Type Parameters:
      T -
      U -
      Parameters:
      mapper -
      Returns:
    • flattMaping

      public static <T, U, A, R> Collector<T,?,R> flattMaping(Function<? super T,? extends Stream<? extends U>> mapper, Collector<? super U,A,R> downstream)
      Type Parameters:
      T -
      U -
      A -
      R -
      Parameters:
      mapper -
      downstream -
      Returns:
    • flatmapping

      @Beta public static <T, U> Collector<T,?,List<U>> flatmapping(Function<? super T,? extends Collection<? extends U>> mapper)
      Type Parameters:
      T -
      U -
      Parameters:
      mapper -
      Returns:
    • flatmapping

      public static <T, U, A, R> Collector<T,?,R> flatmapping(Function<? super T,? extends Collection<? extends U>> mapper, Collector<? super U,A,R> downstream)
      Type Parameters:
      T -
      U -
      A -
      R -
      Parameters:
      mapper -
      downstream -
      Returns:
    • flatMaping

      @Beta public static <T, T2, U> Collector<T,?,List<U>> flatMaping(Function<? super T,? extends Stream<? extends T2>> flatMapper, BiFunction<? super T,? super T2,? extends U> mapper)
      Type Parameters:
      T -
      T2 -
      U -
      Parameters:
      flatMapper -
      mapper -
      Returns:
    • flatMaping

      @Beta public static <T, T2, U, A, R> Collector<T,?,R> flatMaping(Function<? super T,? extends Stream<? extends T2>> flatMapper, BiFunction<? super T,? super T2,? extends U> mapper, Collector<? super U,A,R> downstream)
      Type Parameters:
      T -
      T2 -
      U -
      A -
      R -
      Parameters:
      flatMapper -
      mapper -
      downstream -
      Returns:
    • flattMaping

      @Beta public static <T, T2, U> Collector<T,?,List<U>> flattMaping(Function<? super T,? extends Stream<? extends T2>> flatMapper, BiFunction<? super T,? super T2,? extends U> mapper)
      Type Parameters:
      T -
      T2 -
      U -
      Parameters:
      flatMapper -
      mapper -
      Returns:
    • flattMaping

      @Beta public static <T, T2, U, A, R> Collector<T,?,R> flattMaping(Function<? super T,? extends Stream<? extends T2>> flatMapper, BiFunction<? super T,? super T2,? extends U> mapper, Collector<? super U,A,R> downstream)
      Type Parameters:
      T -
      T2 -
      U -
      A -
      R -
      Parameters:
      flatMapper -
      mapper -
      downstream -
      Returns:
    • flatmapping

      @Beta public static <T, T2, U> Collector<T,?,List<U>> flatmapping(Function<? super T,? extends Collection<? extends T2>> flatMapper, BiFunction<? super T,? super T2,? extends U> mapper)
      Type Parameters:
      T -
      T2 -
      U -
      Parameters:
      flatMapper -
      mapper -
      Returns:
    • flatmapping

      @Beta public static <T, T2, U, A, R> Collector<T,?,R> flatmapping(Function<? super T,? extends Collection<? extends T2>> flatMapper, BiFunction<? super T,? super T2,? extends U> mapper, Collector<? super U,A,R> downstream)
      Type Parameters:
      T -
      T2 -
      U -
      A -
      R -
      Parameters:
      flatMapper -
      mapper -
      downstream -
      Returns:
    • collectingAndThen

      public static <T, A, R, RR> Collector<T,A,RR> collectingAndThen(Collector<T,A,R> downstream, Function<R,RR> finisher)
      Type Parameters:
      T -
      A -
      R -
      RR -
      Parameters:
      downstream -
      finisher -
      Returns:
    • collectingOrEmpty

      @Beta public static <T, A, R> Collector<T,A,u.Optional<R>> collectingOrEmpty(Collector<T,A,R> collector)
      Type Parameters:
      T -
      A -
      R -
      Parameters:
      collector -
      Returns:
    • collectingOrElseIfEmpty

      @Beta public static <T, A, R> Collector<T,A,R> collectingOrElseIfEmpty(Collector<T,A,R> collector, R defaultForEmpty)
      Type Parameters:
      T -
      A -
      R -
      Parameters:
      collector -
      defaultForEmpty -
      Returns:
    • collectingOrElseGetIfEmpty

      @Beta public static <T, A, R> Collector<T,A,R> collectingOrElseGetIfEmpty(Collector<T,A,R> collector, Supplier<? extends R> defaultForEmpty)
      Type Parameters:
      T -
      A -
      R -
      Parameters:
      collector -
      defaultForEmpty -
      Returns:
    • collectingOrElseThrowIfEmpty

      @Beta public static <T, A, R> Collector<T,A,R> collectingOrElseThrowIfEmpty(Collector<T,A,R> collector)
      Type Parameters:
      T -
      A -
      R -
      Parameters:
      collector -
      Returns:
    • collectingOrElseThrowIfEmpty

      @Beta public static <T, A, R> Collector<T,A,R> collectingOrElseThrowIfEmpty(Collector<T,A,R> collector, Supplier<? extends RuntimeException> exceptionSupplier)
      Type Parameters:
      T -
      A -
      R -
      Parameters:
      collector -
      exceptionSupplier -
      Returns:
    • distinctBy

      public static <T> Collector<T,?,List<T>> distinctBy(Function<? super T,?> keyExtractor)
      It's copied from StreamEx: https://github.com/amaembo/streamex under Apache License v2 and may be modified.
      Returns a Collector which collects into the List the input elements for which given mapper function returns distinct results.

      For ordered source the order of collected elements is preserved. If the same result is returned by mapper function for several elements, only the first element is included into the resulting list.

      There are no guarantees on the type, mutability, serializability, or thread-safety of the List returned.

      The operation performed by the returned collector is equivalent to stream.distinct(mapper).toList(), but may work faster.

      Type Parameters:
      T - the type of the input elements
      Parameters:
      keyExtractor - a function which classifies input elements.
      Returns:
      a collector which collects distinct elements to the List.
      Since:
      0.3.8
    • distinctBy

      public static <T, C extends Collection<T>> Collector<T,?,C> distinctBy(Function<? super T,?> keyExtractor, Supplier<? extends C> suppplier)
      Type Parameters:
      T -
      C -
      Parameters:
      keyExtractor -
      suppplier -
      Returns:
    • distinctCount

      public static <T> Collector<T,?,Integer> distinctCount(Function<? super T,?> keyExtractor)
      It's copied from StreamEx: https://github.com/amaembo/streamex under Apache License v2 and may be modified.
      Returns a Collector which counts a number of distinct values the mapper function returns for the stream elements.

      The operation performed by the returned collector is equivalent to stream.map(mapper).distinct().count(). This collector is mostly useful as a downstream collector.

      Type Parameters:
      T - the type of the input elements
      Parameters:
      keyExtractor - a function which classifies input elements.
      Returns:
      a collector which counts a number of distinct classes the mapper function returns for the stream elements.
    • counting

      public static <T> Collector<T,?,Long> counting()
      Type Parameters:
      T -
      Returns:
    • countingToInt

      public static <T> Collector<T,?,Integer> countingToInt()
      Type Parameters:
      T -
      Returns:
    • min

      public static <T extends Comparable<? super T>> Collector<T,?,u.Optional<T>> min()
      Type Parameters:
      T -
      Returns:
    • min

      public static <T> Collector<T,?,u.Optional<T>> min(Comparator<? super T> comparator)
      Type Parameters:
      T -
      Parameters:
      comparator -
      Returns:
    • minOrElse

      public static <T extends Comparable<? super T>> Collector<T,?,T> minOrElse(T defaultForEmpty)
      Type Parameters:
      T -
      Parameters:
      defaultForEmpty -
      Returns:
    • minOrElse

      public static <T> Collector<T,?,T> minOrElse(Comparator<? super T> comparator, T defaultForEmpty)
      Type Parameters:
      T -
      Parameters:
      comparator -
      defaultForEmpty -
      Returns:
    • minOrElseGet

      public static <T extends Comparable<? super T>> Collector<T,?,T> minOrElseGet(Supplier<? extends T> supplierForEmpty)
      Type Parameters:
      T -
      Parameters:
      supplierForEmpty -
      Returns:
    • minOrElseGet

      public static <T> Collector<T,?,T> minOrElseGet(Comparator<? super T> comparator, Supplier<? extends T> supplierForEmpty)
      Type Parameters:
      T -
      Parameters:
      comparator -
      supplierForEmpty -
      Returns:
    • minOrElseThrow

      public static <T extends Comparable<? super T>> Collector<T,?,T> minOrElseThrow()
      Type Parameters:
      T -
      Returns:
    • minOrElseThrow

      public static <T> Collector<T,?,T> minOrElseThrow(Comparator<? super T> comparator)
      Type Parameters:
      T -
      Parameters:
      comparator -
      Returns:
    • minOrElseThrow

      public static <T> Collector<T,?,T> minOrElseThrow(Comparator<? super T> comparator, Supplier<? extends RuntimeException> exceptionSupplier)
      Type Parameters:
      T -
      Parameters:
      comparator -
      exceptionSupplier -
      Returns:
    • minBy

      public static <T> Collector<T,?,u.Optional<T>> minBy(Function<? super T,? extends Comparable> keyMapper)
      Type Parameters:
      T -
      Parameters:
      keyMapper -
      Returns:
    • minByOrElseGet

      public static <T> Collector<T,?,T> minByOrElseGet(Function<? super T,? extends Comparable> keyMapper, Supplier<? extends T> supplierForEmpty)
      Type Parameters:
      T -
      Parameters:
      keyMapper -
      supplierForEmpty -
      Returns:
    • minByOrElseThrow

      public static <T> Collector<T,?,T> minByOrElseThrow(Function<? super T,? extends Comparable> keyMapper)
      Type Parameters:
      T -
      Parameters:
      keyMapper -
      Returns:
    • minByOrElseThrow

      public static <T> Collector<T,?,T> minByOrElseThrow(Function<? super T,? extends Comparable> keyMapper, Supplier<? extends RuntimeException> exceptionSupplier)
      Type Parameters:
      T -
      Parameters:
      keyMapper -
      exceptionSupplier -
      Returns:
    • max

      public static <T extends Comparable<? super T>> Collector<T,?,u.Optional<T>> max()
      Type Parameters:
      T -
      Returns:
    • max

      public static <T> Collector<T,?,u.Optional<T>> max(Comparator<? super T> comparator)
      Type Parameters:
      T -
      Parameters:
      comparator -
      Returns:
    • maxOrElse

      public static <T extends Comparable<? super T>> Collector<T,?,T> maxOrElse(T defaultForEmpty)
      Type Parameters:
      T -
      Parameters:
      defaultForEmpty -
      Returns:
    • maxOrElse

      public static <T> Collector<T,?,T> maxOrElse(Comparator<? super T> comparator, T defaultForEmpty)
      Type Parameters:
      T -
      Parameters:
      comparator -
      defaultForEmpty -
      Returns:
    • maxOrElseGet

      public static <T extends Comparable<? super T>> Collector<T,?,T> maxOrElseGet(Supplier<? extends T> supplierForEmpty)
      Type Parameters:
      T -
      Parameters:
      supplierForEmpty -
      Returns:
    • maxOrElseGet

      public static <T> Collector<T,?,T> maxOrElseGet(Comparator<? super T> comparator, Supplier<? extends T> supplierForEmpty)
      Type Parameters:
      T -
      Parameters:
      comparator -
      supplierForEmpty -
      Returns:
    • maxOrElseThrow

      public static <T extends Comparable<? super T>> Collector<T,?,T> maxOrElseThrow()
      Type Parameters:
      T -
      Returns:
    • maxOrElseThrow

      public static <T> Collector<T,?,T> maxOrElseThrow(Comparator<? super T> comparator)
      Type Parameters:
      T -
      Parameters:
      comparator -
      Returns:
    • maxOrElseThrow

      public static <T> Collector<T,?,T> maxOrElseThrow(Comparator<? super T> comparator, Supplier<? extends RuntimeException> exceptionSupplier)
      Type Parameters:
      T -
      Parameters:
      comparator -
      exceptionSupplier -
      Returns:
    • maxBy

      public static <T> Collector<T,?,u.Optional<T>> maxBy(Function<? super T,? extends Comparable> keyMapper)
      Type Parameters:
      T -
      Parameters:
      keyMapper -
      Returns:
    • maxByOrElseGet

      public static <T> Collector<T,?,T> maxByOrElseGet(Function<? super T,? extends Comparable> keyMapper, Supplier<? extends T> supplierForEmpty)
      Type Parameters:
      T -
      Parameters:
      keyMapper -
      supplierForEmpty -
      Returns:
    • maxByOrElseThrow

      public static <T> Collector<T,?,T> maxByOrElseThrow(Function<? super T,? extends Comparable> keyMapper)
      Type Parameters:
      T -
      Parameters:
      keyMapper -
      Returns:
    • maxByOrElseThrow

      public static <T> Collector<T,?,T> maxByOrElseThrow(Function<? super T,? extends Comparable> keyMapper, Supplier<? extends RuntimeException> exceptionSupplier)
      Type Parameters:
      T -
      Parameters:
      keyMapper -
      exceptionSupplier -
      Returns:
    • minAll

      public static <T extends Comparable<? super T>> Collector<T,?,List<T>> minAll()
      It's copied from StreamEx: https://github.com/amaembo/streamex under Apache License v2 and may be modified.
      Returns a Collector which finds all the elements which are equal to each other and smaller than any other element according to the natural order. The found elements are collected to List.
      Type Parameters:
      T - the type of the input elements
      Returns:
      a Collector which finds all the minimal elements and collects them to the List.
      See Also:
    • minAll

      public static <T> Collector<T,?,List<T>> minAll(Comparator<? super T> comparator)
      It's copied from StreamEx: https://github.com/amaembo/streamex under Apache License v2 and may be modified.
      Returns a Collector which finds all the elements which are equal to each other and smaller than any other element according to the specified Comparator. The found elements are collected to List.
      Type Parameters:
      T - the type of the input elements
      Parameters:
      comparator - a Comparator to compare the elements
      Returns:
      a Collector which finds all the minimal elements and collects them to the List.
      See Also:
    • minAll

      public static <T> Collector<T,?,List<T>> minAll(Comparator<? super T> comparator, int atMostSize)
      Type Parameters:
      T -
      Parameters:
      comparator -
      atMostSize -
      Returns:
    • minAll

      public static <T extends Comparable, A, R> Collector<T,?,R> minAll(Collector<T,A,R> downstream)
      It's copied from StreamEx: https://github.com/amaembo/streamex under Apache License v2 and may be modified.
      Returns a Collector which finds all the elements which are equal to each other and smaller than any other element according to the natural order. The found elements are reduced using the specified downstream Collector.
      Type Parameters:
      T - the type of the input elements
      A - the intermediate accumulation type of the downstream collector
      R - the result type of the downstream reduction
      Parameters:
      downstream - a Collector implementing the downstream reduction
      Returns:
      a Collector which finds all the minimal elements.
      See Also:
    • minAll

      public static <T, A, R> Collector<T,?,R> minAll(Comparator<? super T> comparator, Collector<T,A,R> downstream)
      It's copied from StreamEx: https://github.com/amaembo/streamex under Apache License v2 and may be modified.
      Returns a Collector which finds all the elements which are equal to each other and smaller than any other element according to the specified Comparator. The found elements are reduced using the specified downstream Collector.
      Type Parameters:
      T - the type of the input elements
      A - the intermediate accumulation type of the downstream collector
      R - the result type of the downstream reduction
      Parameters:
      comparator - a Comparator to compare the elements
      downstream - a Collector implementing the downstream reduction
      Returns:
      a Collector which finds all the minimal elements.
      See Also:
    • minAlll

      public static <T extends Comparable, R> Collector<T,?,u.Optional<Pair<T,R>>> minAlll(Collector<T,?,R> downstream)
      Type Parameters:
      T -
      R -
      Parameters:
      downstream -
      Returns:
    • minAlll

      public static <T, R> Collector<T,?,u.Optional<Pair<T,R>>> minAlll(Comparator<? super T> comparator, Collector<? super T,?,R> downstream)
      Type Parameters:
      T -
      R -
      Parameters:
      comparator -
      downstream -
      Returns:
    • minAlll

      public static <T, R, RR> Collector<T,?,RR> minAlll(Comparator<? super T> comparator, Collector<? super T,?,R> downstream, Function<u.Optional<Pair<T,R>>,RR> finisher)
      Type Parameters:
      T -
      R -
      RR -
      Parameters:
      comparator -
      downstream -
      finisher -
      Returns:
    • maxAll

      public static <T extends Comparable<? super T>> Collector<T,?,List<T>> maxAll()
      It's copied from StreamEx: https://github.com/amaembo/streamex under Apache License v2 and may be modified.
      Returns a Collector which finds all the elements which are equal to each other and bigger than any other element according to the natural order. The found elements are collected to List.
      Type Parameters:
      T - the type of the input elements
      Returns:
      a Collector which finds all the maximal elements and collects them to the List.
      See Also:
    • maxAll

      public static <T> Collector<T,?,List<T>> maxAll(Comparator<? super T> comparator)
      It's copied from StreamEx: https://github.com/amaembo/streamex under Apache License v2 and may be modified.
      Returns a Collector which finds all the elements which are equal to each other and bigger than any other element according to the specified Comparator. The found elements are collected to List.
      Type Parameters:
      T - the type of the input elements
      Parameters:
      comparator - a Comparator to compare the elements
      Returns:
      a Collector which finds all the maximal elements and collects them to the List.
      See Also:
    • maxAll

      public static <T> Collector<T,?,List<T>> maxAll(Comparator<? super T> comparator, int atMostSize)
      Type Parameters:
      T -
      Parameters:
      comparator -
      atMostSize -
      Returns:
    • maxAll

      public static <T extends Comparable, R> Collector<T,?,R> maxAll(Collector<T,?,R> downstream)
      It's copied from StreamEx: https://github.com/amaembo/streamex under Apache License v2 and may be modified.
      Returns a Collector which finds all the elements which are equal to each other and bigger than any other element according to the natural order. The found elements are reduced using the specified downstream Collector.
      Type Parameters:
      T - the type of the input elements
      A - the intermediate accumulation type of the downstream collector
      R - the result type of the downstream reduction
      Parameters:
      downstream - a Collector implementing the downstream reduction
      Returns:
      a Collector which finds all the maximal elements.
      See Also:
    • maxAll

      public static <T, R> Collector<T,?,R> maxAll(Comparator<? super T> comparator, Collector<? super T,?,R> downstream)
      It's copied from StreamEx: https://github.com/amaembo/streamex under Apache License v2 and may be modified.
      Returns a Collector which finds all the elements which are equal to each other and bigger than any other element according to the specified Comparator. The found elements are reduced using the specified downstream Collector.
      Type Parameters:
      T - the type of the input elements
      A - the intermediate accumulation type of the downstream collector
      R - the result type of the downstream reduction
      Parameters:
      comparator - a Comparator to compare the elements
      downstream - a Collector implementing the downstream reduction
      Returns:
      a Collector which finds all the maximal elements.
      See Also:
    • maxAlll

      public static <T extends Comparable, R> Collector<T,?,u.Optional<Pair<T,R>>> maxAlll(Collector<T,?,R> downstream)
      Type Parameters:
      T -
      R -
      Parameters:
      downstream -
      Returns:
    • maxAlll

      public static <T, R> Collector<T,?,u.Optional<Pair<T,R>>> maxAlll(Comparator<? super T> comparator, Collector<? super T,?,R> downstream)
      Type Parameters:
      T -
      R -
      Parameters:
      comparator -
      downstream -
      Returns:
    • maxAlll

      public static <T, R, RR> Collector<T,?,RR> maxAlll(Comparator<? super T> comparator, Collector<? super T,?,R> downstream, Function<u.Optional<Pair<T,R>>,RR> finisher)
      Type Parameters:
      T -
      R -
      RR -
      Parameters:
      comparator -
      downstream -
      finisher -
      Returns:
    • minMax

      public static <T extends Comparable> Collector<T,?,u.Optional<Pair<T,T>>> minMax()
      Type Parameters:
      T -
      Returns:
    • minMax

      public static <T> Collector<T,?,u.Optional<Pair<T,T>>> minMax(Comparator<? super T> comparator)
      Type Parameters:
      T -
      Parameters:
      comparator -
      Returns:
      See Also:
    • minMax

      public static <T, R> Collector<T,?,u.Optional<R>> minMax(Comparator<? super T> comparator, BiFunction<? super T,? super T,? extends R> finisher)
      It's copied from StreamEx: https://github.com/amaembo/streamex under Apache License v2 and may be modified.
      Returns a Collector which finds the minimal and maximal element according to the supplied comparator, then applies finisher function to them producing the final result.

      This collector produces stable result for ordered stream: if several minimal or maximal elements appear, the collector always selects the first encountered.

      If there are no input elements, the finisher method is not called and empty Optional is returned. Otherwise the finisher result is wrapped into Optional.

      Type Parameters:
      T - the type of the input elements
      R - the type of the result wrapped into Optional
      Parameters:
      comparator - comparator which is used to find minimal and maximal element
      finisher - a BiFunction which takes minimal and maximal element and produces the final result.
      Returns:
      a Collector which finds minimal and maximal elements.
    • minMaxBy

      public static <T> Collector<T,?,u.Optional<Pair<T,T>>> minMaxBy(Function<? super T,? extends Comparable> keyMapper)
      Type Parameters:
      T -
      Parameters:
      keyMapper -
      Returns:
    • minMaxBy

      public static <T, R> Collector<T,?,u.Optional<R>> minMaxBy(Function<? super T,? extends Comparable> keyMapper, BiFunction<? super T,? super T,? extends R> finisher)
      Type Parameters:
      T -
      R -
      Parameters:
      keyMapper -
      finisher -
      Returns:
    • minMaxOrElseGet

      public static <T extends Comparable<? super T>> Collector<T,?,Pair<T,T>> minMaxOrElseGet(Supplier<Pair<? extends T,? extends T>> supplierForEmpty)
      Type Parameters:
      T -
      Parameters:
      supplierForEmpty -
      Returns:
    • minMaxOrElseGet

      public static <T> Collector<T,?,Pair<T,T>> minMaxOrElseGet(Comparator<? super T> comparator, Supplier<Pair<? extends T,? extends T>> supplierForEmpty)
      Type Parameters:
      T -
      Parameters:
      comparator -
      supplierForEmpty -
      Returns:
    • minMaxOrElseThrow

      public static <T extends Comparable<? super T>> Collector<T,?,Pair<T,T>> minMaxOrElseThrow()
      Type Parameters:
      T -
      Returns:
    • minMaxOrElseThrow

      public static <T> Collector<T,?,Pair<T,T>> minMaxOrElseThrow(Comparator<? super T> comparator)
      Type Parameters:
      T -
      Parameters:
      comparator -
      Returns:
    • summingInt

      public static <T> Collector<T,?,Integer> summingInt(ToIntFunction<? super T> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • summingIntToLong

      public static <T> Collector<T,?,Long> summingIntToLong(ToIntFunction<? super T> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • summingLong

      public static <T> Collector<T,?,Long> summingLong(ToLongFunction<? super T> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • summingDouble

      public static <T> Collector<T,?,Double> summingDouble(ToDoubleFunction<? super T> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • summingBigInteger

      public static <T> Collector<T,?,BigInteger> summingBigInteger(Function<? super T,BigInteger> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • summingBigDecimal

      public static <T> Collector<T,?,BigDecimal> summingBigDecimal(Function<? super T,BigDecimal> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • averagingInt

      public static <T> Collector<T,?,u.OptionalDouble> averagingInt(ToIntFunction<? super T> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • averagingIntOrElseThrow

      public static <T> Collector<T,?,Double> averagingIntOrElseThrow(ToIntFunction<? super T> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • averagingLong

      public static <T> Collector<T,?,u.OptionalDouble> averagingLong(ToLongFunction<? super T> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • averagingLongOrElseThrow

      public static <T> Collector<T,?,Double> averagingLongOrElseThrow(ToLongFunction<? super T> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • averagingDouble

      public static <T> Collector<T,?,u.OptionalDouble> averagingDouble(ToDoubleFunction<? super T> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • averagingDoubleOrElseThrow

      public static <T> Collector<T,?,Double> averagingDoubleOrElseThrow(ToDoubleFunction<? super T> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • averagingBigInteger

      public static <T> Collector<T,?,u.Optional<BigDecimal>> averagingBigInteger(Function<? super T,BigInteger> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • averagingBigIntegerOrElseThrow

      public static <T> Collector<T,?,BigDecimal> averagingBigIntegerOrElseThrow(Function<? super T,BigInteger> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • averagingBigDecimal

      public static <T> Collector<T,?,u.Optional<BigDecimal>> averagingBigDecimal(Function<? super T,BigDecimal> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • averagingBigDecimalOrElseThrow

      public static <T> Collector<T,?,BigDecimal> averagingBigDecimalOrElseThrow(Function<? super T,BigDecimal> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • summarizingChar

      public static <T> Collector<T,?,CharSummaryStatistics> summarizingChar(ToCharFunction<? super T> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • summarizingByte

      public static <T> Collector<T,?,ByteSummaryStatistics> summarizingByte(ToByteFunction<? super T> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • summarizingShort

      public static <T> Collector<T,?,ShortSummaryStatistics> summarizingShort(ToShortFunction<? super T> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • summarizingInt

      public static <T> Collector<T,?,IntSummaryStatistics> summarizingInt(ToIntFunction<? super T> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • summarizingLong

      public static <T> Collector<T,?,LongSummaryStatistics> summarizingLong(ToLongFunction<? super T> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • summarizingFloat

      public static <T> Collector<T,?,FloatSummaryStatistics> summarizingFloat(ToFloatFunction<? super T> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • summarizingDouble

      public static <T> Collector<T,?,DoubleSummaryStatistics> summarizingDouble(ToDoubleFunction<? super T> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • summarizingBigInteger

      public static <T> Collector<T,?,BigIntegerSummaryStatistics> summarizingBigInteger(Function<? super T,BigInteger> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • summarizingBigDecimal

      public static <T> Collector<T,?,BigDecimalSummaryStatistics> summarizingBigDecimal(Function<? super T,BigDecimal> mapper)
      Type Parameters:
      T -
      Parameters:
      mapper -
      Returns:
    • reducing

      public static <T> Collector<T,?,T> reducing(T identity, BinaryOperator<T> op)
      Type Parameters:
      T -
      Parameters:
      identity -
      op -
      Returns:
    • reducing

      public static <T> Collector<T,?,u.Optional<T>> reducing(BinaryOperator<T> op)
      Type Parameters:
      T -
      Parameters:
      op -
      Returns:
    • reducingOrElseGet

      public static <T> Collector<T,?,T> reducingOrElseGet(BinaryOperator<T> op, Supplier<? extends T> supplierForEmpty)
      Type Parameters:
      T -
      Parameters:
      op -
      supplierForEmpty -
      Returns:
    • reducingOrElseThrow

      public static <T> Collector<T,?,T> reducingOrElseThrow(BinaryOperator<T> op)
      Type Parameters:
      T -
      Parameters:
      op -
      Returns:
    • reducingOrElseThrow

      public static <T> Collector<T,?,T> reducingOrElseThrow(BinaryOperator<T> op, Supplier<? extends RuntimeException> exceptionSupplier)
      Type Parameters:
      T -
      Parameters:
      op -
      exceptionSupplier -
      Returns:
    • reducing

      public static <T, R> Collector<T,?,R> reducing(R identity, Function<? super T,? extends R> mapper, BinaryOperator<R> op)
      Type Parameters:
      T -
      R -
      Parameters:
      identity -
      mapper -
      op -
      Returns:
    • reducing

      public static <T, R> Collector<T,?,u.Optional<R>> reducing(Function<? super T,? extends R> mapper, BinaryOperator<R> op)
      Type Parameters:
      T -
      R -
      Parameters:
      mapper -
      op -
      Returns:
    • reducingOrElseGet

      public static <T, R> Collector<T,?,R> reducingOrElseGet(Function<? super T,? extends R> mapper, BinaryOperator<R> op, Supplier<? extends R> supplierForEmpty)
      Type Parameters:
      T -
      R -
      Parameters:
      mapper -
      op -
      supplierForEmpty -
      Returns:
    • reducingOrElseThrow

      public static <T, R> Collector<T,?,R> reducingOrElseThrow(Function<? super T,? extends R> mapper, BinaryOperator<R> op, Supplier<? extends RuntimeException> exceptionSupplier)
      Type Parameters:
      T -
      R -
      Parameters:
      mapper -
      op -
      exceptionSupplier -
      Returns:
    • reducingOrElseThrow

      public static <T, R> Collector<T,?,R> reducingOrElseThrow(Function<? super T,? extends R> mapper, BinaryOperator<R> op)
      Type Parameters:
      T -
      R -
      Parameters:
      mapper -
      op -
      Returns:
    • commonPrefix

      public static Collector<CharSequence,?,String> commonPrefix()
      It's copied from StreamEx: https://github.com/amaembo/streamex under Apache License v2 and may be modified.
      Returns a Collector which computes a common prefix of input CharSequence objects returning the result as String. For empty input the empty String is returned.

      The returned Collector handles specially Unicode surrogate pairs: the returned prefix may end with Unicode high-surrogate code unit only if it's not succeeded by Unicode low-surrogate code unit in any of the input sequences. Normally the ending high-surrogate code unit is removed from the prefix.

      This method returns a short-circuiting collector: it may not process all the elements if the common prefix is empty.

      Returns:
      a Collector which computes a common prefix.
      Since:
      0.5.0
    • commonSuffix

      public static Collector<CharSequence,?,String> commonSuffix()
      It's copied from StreamEx: https://github.com/amaembo/streamex under Apache License v2 and may be modified.
      Returns a Collector which computes a common suffix of input CharSequence objects returning the result as String. For empty input the empty String is returned.

      The returned Collector handles specially Unicode surrogate pairs: the returned suffix may start with Unicode low-surrogate code unit only if it's not preceded by Unicode high-surrogate code unit in any of the input sequences. Normally the starting low-surrogate code unit is removed from the suffix.

      This method returns a short-circuiting collector: it may not process all the elements if the common suffix is empty.

      Returns:
      a Collector which computes a common suffix.
      Since:
      0.5.0
    • groupingBy

      public static <T, K> Collector<T,?,Map<K,List<T>>> groupingBy(Function<? super T,? extends K> keyMapper)
      Type Parameters:
      T -
      K -
      Parameters:
      keyMapper -
      Returns:
    • groupingBy

      public static <T, K, M extends Map<K, List<T>>> Collector<T,?,M> groupingBy(Function<? super T,? extends K> keyMapper, Supplier<? extends M> mapFactory)
      Type Parameters:
      T -
      K -
      M -
      Parameters:
      keyMapper -
      mapFactory -
      Returns:
    • groupingBy

      public static <T, K, A, D> Collector<T,?,Map<K,D>> groupingBy(Function<? super T,? extends K> keyMapper, Collector<? super T,A,D> downstream)
      Type Parameters:
      T -
      K -
      A -
      D -
      Parameters:
      keyMapper -
      downstream -
      Returns:
    • groupingBy

      public static <T, K, A, D, M extends Map<K, D>> Collector<T,?,M> groupingBy(Function<? super T,? extends K> keyMapper, Collector<? super T,A,D> downstream, Supplier<? extends M> mapFactory)
      Type Parameters:
      T -
      K -
      A -
      D -
      M -
      Parameters:
      keyMapper -
      downstream -
      mapFactory -
      Returns:
    • groupingByConcurrent

      public static <T, K> Collector<T,?,ConcurrentMap<K,List<T>>> groupingByConcurrent(Function<? super T,? extends K> keyMapper)
      Type Parameters:
      T -
      K -
      Parameters:
      keyMapper -
      Returns:
    • groupingByConcurrent

      public static <T, K, M extends ConcurrentMap<K, List<T>>> Collector<T,?,M> groupingByConcurrent(Function<? super T,? extends K> keyMapper, Supplier<? extends M> mapFactory)
      Type Parameters:
      T -
      K -
      M -
      Parameters:
      keyMapper -
      mapFactory -
      Returns:
    • groupingByConcurrent

      public static <T, K, A, D> Collector<T,?,ConcurrentMap<K,D>> groupingByConcurrent(Function<? super T,? extends K> keyMapper, Collector<? super T,A,D> downstream)
      Type Parameters:
      T -
      K -
      A -
      D -
      Parameters:
      keyMapper -
      downstream -
      Returns:
    • groupingByConcurrent

      public static <T, K, A, D, M extends ConcurrentMap<K, D>> Collector<T,?,M> groupingByConcurrent(Function<? super T,? extends K> keyMapper, Collector<? super T,A,D> downstream, Supplier<? extends M> mapFactory)
      Type Parameters:
      T -
      K -
      A -
      D -
      M -
      Parameters:
      keyMapper -
      downstream -
      mapFactory -
      Returns:
    • partitioningBy

      public static <T> Collector<T,?,Map<Boolean,List<T>>> partitioningBy(Predicate<? super T> predicate)
      Type Parameters:
      T -
      Parameters:
      predicate -
      Returns:
    • partitioningBy

      public static <T, D, A> Collector<T,?,Map<Boolean,D>> partitioningBy(Predicate<? super T> predicate, Collector<? super T,A,D> downstream)
      Type Parameters:
      T -
      D -
      A -
      Parameters:
      predicate -
      downstream -
      Returns:
    • countingBy

      public static <T, K> Collector<T,?,Map<K,Long>> countingBy(Function<? super T,? extends K> keyMapper)
      Type Parameters:
      T -
      K -
      Parameters:
      keyMapper -
      Returns:
    • countingBy

      public static <T, K, M extends Map<K, Long>> Collector<T,?,M> countingBy(Function<? super T,? extends K> keyMapper, Supplier<? extends M> mapFactory)
      Type Parameters:
      T -
      K -
      M -
      Parameters:
      keyMapper -
      mapFactory -
      Returns:
    • countingToIntBy

      public static <T, K> Collector<T,?,Map<K,Integer>> countingToIntBy(Function<? super T,? extends K> keyMapper)
      Type Parameters:
      T -
      K -
      Parameters:
      keyMapper -
      Returns:
    • countingToIntBy

      public static <T, K, M extends Map<K, Integer>> Collector<T,?,M> countingToIntBy(Function<? super T,? extends K> keyMapper, Supplier<? extends M> mapFactory)
      Type Parameters:
      T -
      K -
      M -
      Parameters:
      keyMapper -
      mapFactory -
      Returns:
    • toMap

      public static <K, V> Collector<Map.Entry<K,V>,?,Map<K,V>> toMap()
      Type Parameters:
      K -
      V -
      Returns:
    • toMap

      public static <K, V> Collector<Map.Entry<K,V>,?,Map<K,V>> toMap(BinaryOperator<V> mergeFunction)
      Type Parameters:
      K -
      V -
      Parameters:
      mergeFunction -
      Returns:
    • toMap

      public static <K, V, M extends Map<K, V>> Collector<Map.Entry<K,V>,?,M> toMap(Supplier<? extends M> mapFactory)
      Type Parameters:
      K -
      V -
      M -
      Parameters:
      mapFactory -
      Returns:
    • toMap

      public static <K, V, M extends Map<K, V>> Collector<Map.Entry<K,V>,?,M> toMap(BinaryOperator<V> mergeFunction, Supplier<? extends M> mapFactory)
      Type Parameters:
      K -
      V -
      M -
      Parameters:
      mergeFunction -
      mapFactory -
      Returns:
    • toMap

      public static <T, K, V> Collector<T,?,Map<K,V>> toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      Returns:
    • toMap

      public static <T, K, V> Collector<T,?,Map<K,V>> toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      mergeFunction -
      Returns:
    • toMap

      public static <T, K, V, M extends Map<K, V>> Collector<T,?,M> toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Supplier<? extends M> mapFactory)
      Type Parameters:
      T -
      K -
      V -
      M -
      Parameters:
      keyMapper -
      valueMapper -
      mapFactory -
      Returns:
    • toMap

      public static <T, K, V, M extends Map<K, V>> Collector<T,?,M> toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends M> mapFactory)
      Type Parameters:
      T -
      K -
      V -
      M -
      Parameters:
      keyMapper -
      valueMapper -
      mergeFunction -
      mapFactory -
      Returns:
    • toImmutableMap

      public static <K, V> Collector<Map.Entry<K,V>,?,ImmutableMap<K,V>> toImmutableMap()
      Type Parameters:
      K -
      V -
      Returns:
    • toImmutableMap

      public static <K, V> Collector<Map.Entry<K,V>,?,ImmutableMap<K,V>> toImmutableMap(BinaryOperator<V> mergeFunction)
      Type Parameters:
      K -
      V -
      Parameters:
      mergeFunction -
      Returns:
    • toImmutableMap

      public static <T, K, V> Collector<T,?,ImmutableMap<K,V>> toImmutableMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      Returns:
    • toImmutableMap

      public static <T, K, V> Collector<T,?,ImmutableMap<K,V>> toImmutableMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      mergeFunction -
      Returns:
    • toLinkedHashMap

      public static <T, K, V> Collector<T,?,Map<K,V>> toLinkedHashMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      Returns:
      See Also:
    • toLinkedHashMap

      public static <T, K, V> Collector<T,?,Map<K,V>> toLinkedHashMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      mergeFunction -
      Returns:
      See Also:
    • toConcurrentMap

      public static <T, K, V> Collector<T,?,ConcurrentMap<K,V>> toConcurrentMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      Returns:
    • toConcurrentMap

      public static <T, K, V, M extends ConcurrentMap<K, V>> Collector<T,?,M> toConcurrentMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Supplier<? extends M> mapFactory)
      Type Parameters:
      T -
      K -
      V -
      M -
      Parameters:
      keyMapper -
      valueMapper -
      mapFactory -
      Returns:
    • toConcurrentMap

      public static <T, K, V> Collector<T,?,ConcurrentMap<K,V>> toConcurrentMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      mergeFunction -
      Returns:
    • toConcurrentMap

      public static <T, K, V, M extends ConcurrentMap<K, V>> Collector<T,?,M> toConcurrentMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction, Supplier<? extends M> mapFactory)
      Type Parameters:
      T -
      K -
      V -
      M -
      Parameters:
      keyMapper -
      valueMapper -
      mergeFunction -
      mapFactory -
      Returns:
    • toBiMap

      public static <T, K, V> Collector<T,?,BiMap<K,V>> toBiMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      Returns:
    • toBiMap

      public static <T, K, V> Collector<T,?,BiMap<K,V>> toBiMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Supplier<BiMap<K,V>> mapFactory)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      mapFactory -
      Returns:
    • toBiMap

      public static <T, K, V> Collector<T,?,BiMap<K,V>> toBiMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      mergeFunction -
      Returns:
    • toBiMap

      public static <T, K, V> Collector<T,?,BiMap<K,V>> toBiMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, BinaryOperator<V> mergeFunction, Supplier<BiMap<K,V>> mapFactory)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      mergeFunction -
      mapFactory -
      Returns:
    • toMultimap

      public static <K, V> Collector<Map.Entry<K,V>,?,ListMultimap<K,V>> toMultimap()
      Type Parameters:
      K -
      V -
      Returns:
    • toMultimap

      public static <K, V, C extends Collection<V>, M extends Multimap<K, V, C>> Collector<Map.Entry<K,V>,?,M> toMultimap(Supplier<? extends M> mapFactory)
      Type Parameters:
      K -
      V -
      C -
      M -
      Parameters:
      mapFactory -
      Returns:
    • toMultimap

      public static <T, K> Collector<T,?,ListMultimap<K,T>> toMultimap(Function<? super T,? extends K> keyMapper)
      Type Parameters:
      T -
      K -
      Parameters:
      keyMapper -
      Returns:
    • toMultimap

      public static <T, K, C extends Collection<T>, M extends Multimap<K, T, C>> Collector<T,?,M> toMultimap(Function<? super T,? extends K> keyMapper, Supplier<? extends M> mapFactory)
      Type Parameters:
      T -
      K -
      C -
      M -
      Parameters:
      keyMapper -
      mapFactory -
      Returns:
    • toMultimap

      public static <T, K, V> Collector<T,?,ListMultimap<K,V>> toMultimap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      keyMapper -
      valueMapper -
      Returns:
    • toMultimap

      public static <T, K, V, C extends Collection<V>, M extends Multimap<K, V, C>> Collector<T,?,M> toMultimap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Supplier<? extends M> mapFactory)
      Type Parameters:
      T -
      K -
      V -
      C -
      M -
      Parameters:
      keyMapper -
      valueMapper -
      mapFactory -
      Returns:
    • flatMapingValueToMultimap

      public static <T, K, V> Collector<T,?,ListMultimap<K,V>> flatMapingValueToMultimap(Function<? super T,K> keyMapper, Function<? super T,? extends Stream<? extends V>> flatValueMapper)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      keyMapper -
      flatValueMapper -
      Returns:
      See Also:
    • flatMapingValueToMultimap

      public static <T, K, V, C extends Collection<V>, M extends Multimap<K, V, C>> Collector<T,?,M> flatMapingValueToMultimap(Function<? super T,K> keyMapper, Function<? super T,? extends Stream<? extends V>> flatValueMapper, Supplier<? extends M> mapFactory)
      Type Parameters:
      T -
      K -
      V -
      C -
      M -
      Parameters:
      keyMapper -
      flatValueMapper -
      mapFactory -
      Returns:
      See Also:
    • flattMapingValueToMultimap

      public static <T, K, V> Collector<T,?,ListMultimap<K,V>> flattMapingValueToMultimap(Function<? super T,K> keyMapper, Function<? super T,? extends Stream<? extends V>> flatValueMapper)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      keyMapper -
      flatValueMapper -
      Returns:
      See Also:
    • flattMapingValueToMultimap

      public static <T, K, V, C extends Collection<V>, M extends Multimap<K, V, C>> Collector<T,?,M> flattMapingValueToMultimap(Function<? super T,K> keyMapper, Function<? super T,? extends Stream<? extends V>> flatValueMapper, Supplier<? extends M> mapFactory)
      Type Parameters:
      T -
      K -
      V -
      C -
      M -
      Parameters:
      keyMapper -
      flatValueMapper -
      mapFactory -
      Returns:
      See Also:
    • flatmappingValueToMultimap

      public static <T, K, V> Collector<T,?,ListMultimap<K,V>> flatmappingValueToMultimap(Function<? super T,K> keyMapper, Function<? super T,? extends Collection<? extends V>> flatValueMapper)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      keyMapper -
      flatValueMapper -
      Returns:
      See Also:
    • flatmappingValueToMultimap

      public static <T, K, V, C extends Collection<V>, M extends Multimap<K, V, C>> Collector<T,?,M> flatmappingValueToMultimap(Function<? super T,K> keyMapper, Function<? super T,? extends Collection<? extends V>> flatValueMapper, Supplier<? extends M> mapFactory)
      Type Parameters:
      T -
      K -
      V -
      C -
      M -
      Parameters:
      keyMapper -
      flatValueMapper -
      mapFactory -
      Returns:
      See Also:
    • flatMapingKeyToMultimap

      public static <T, K, V> Collector<T,?,ListMultimap<K,V>> flatMapingKeyToMultimap(Function<? super T,Stream<? extends K>> flatKeyMapper, Function<? super T,V> valueMapper)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      flatKeyMapper -
      valueMapper -
      Returns:
      See Also:
    • flatMapingKeyToMultimap

      public static <T, K, V, C extends Collection<V>, M extends Multimap<K, V, C>> Collector<T,?,M> flatMapingKeyToMultimap(Function<? super T,Stream<? extends K>> flatKeyMapper, Function<? super T,V> valueMapper, Supplier<? extends M> mapFactory)
      Type Parameters:
      T -
      K -
      V -
      C -
      M -
      Parameters:
      flatKeyMapper -
      valueMapper -
      mapFactory -
      Returns:
      See Also:
    • flattMapingKeyToMultimap

      public static <T, K, V> Collector<T,?,ListMultimap<K,V>> flattMapingKeyToMultimap(Function<? super T,Stream<? extends K>> flatKeyMapper, Function<? super T,V> valueMapper)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      flatKeyMapper -
      valueMapper -
      Returns:
      See Also:
    • flattMapingKeyToMultimap

      public static <T, K, V, C extends Collection<V>, M extends Multimap<K, V, C>> Collector<T,?,M> flattMapingKeyToMultimap(Function<? super T,Stream<? extends K>> flatKeyMapper, Function<? super T,V> valueMapper, Supplier<? extends M> mapFactory)
      Type Parameters:
      T -
      K -
      V -
      C -
      M -
      Parameters:
      flatKeyMapper -
      valueMapper -
      mapFactory -
      Returns:
      See Also:
    • flatmappingKeyToMultimap

      public static <T, K, V> Collector<T,?,ListMultimap<K,V>> flatmappingKeyToMultimap(Function<? super T,? extends Collection<? extends K>> flatKeyMapper, Function<? super T,V> valueMapper)
      Type Parameters:
      T -
      K -
      V -
      Parameters:
      flatKeyMapper -
      valueMapper -
      Returns:
      See Also:
    • flatmappingKeyToMultimap

      public static <T, K, V, C extends Collection<V>, M extends Multimap<K, V, C>> Collector<T,?,M> flatmappingKeyToMultimap(Function<? super T,? extends Collection<? extends K>> flatKeyMapper, Function<? super T,V> valueMapper, Supplier<? extends M> mapFactory)
      Type Parameters:
      T -
      K -
      V -
      C -
      M -
      Parameters:
      flatKeyMapper -
      valueMapper -
      mapFactory -
      Returns:
      See Also:
    • teeing

      public static <T, R1, R2, R> Collector<T,?,R> teeing(Collector<? super T,?,R1> downstream1, Collector<? super T,?,R2> downstream2, BiFunction<? super R1,? super R2,R> merger)
      Type Parameters:
      T -
      R1 -
      R2 -
      R -
      Parameters:
      downstream1 -
      downstream2 -
      merger -
      Returns: