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)
    • toList

      public static <T> Collector<T,?,List<T>> toList()
    • toLinkedList

      public static <T> Collector<T,?,LinkedList<T>> toLinkedList()
    • toImmutableList

      public static <T> Collector<T,?,ImmutableList<T>> toImmutableList()
    • toSet

      public static <T> Collector<T,?,Set<T>> toSet()
    • toLinkedHashSet

      public static <T> Collector<T,?,Set<T>> toLinkedHashSet()
    • toImmutableSet

      public static <T> Collector<T,?,ImmutableSet<T>> toImmutableSet()
    • toQueue

      public static <T> Collector<T,?,Queue<T>> toQueue()
    • toDeque

      public static <T> Collector<T,?,Deque<T>> toDeque()
    • toCollection

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

      public static <T> Collector<T,?,List<T>> toList(int atMostSize)
    • toSet

      public static <T> Collector<T,?,Set<T>> toSet(int atMostSize)
    • toMultiset

      public static <T> Collector<T,?,Multiset<T>> toMultiset()
    • toMultiset

      public static <T> Collector<T,?,Multiset<T>> toMultiset(Supplier<Multiset<T>> supplier)
    • toLongMultiset

      public static <T> Collector<T,?,LongMultiset<T>> toLongMultiset()
    • toLongMultiset

      public static <T> Collector<T,?,LongMultiset<T>> toLongMultiset(Supplier<LongMultiset<T>> supplier)
    • toArray

      public static <T> Collector<T,?,Object[]> toArray()
    • toArray

      public static <T, A> Collector<T,?,A[]> toArray(Supplier<A[]> arraySupplier)
    • toArray

      public static <T, A> Collector<T,?,A[]> toArray(IntFunction<A[]> arraySupplier)
    • toBooleanList

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      public static <T> Collector<T,?,List<T>> first(int n)
      Only works for sequential Stream.
      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.
      Parameters:
      n -
      Returns:
      Throws:
      UnsupportedOperationException - operated by multiple threads
    • joining

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

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

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

      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

      invalid @link
      #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:
      • invalid @see
        #pairing(Collector, Collector, BiFunction)
    • mapping

      public static <T, U> Collector<T,?,List<U>> mapping(Function<? super T,? extends U> mapper)
    • mapping

      public static <T, U, A, R> Collector<T,?,R> mapping(Function<? super T,? extends U> mapper, Collector<? super U,A,R> downstream)
    • flatMapping

      public static <T, U> Collector<T,?,List<U>> flatMapping(Function<? super T,? extends Stream<? extends U>> mapper)
    • flatMapping

      public static <T, U, A, R> Collector<T,?,R> flatMapping(Function<? super T,? extends Stream<? extends U>> mapper, Collector<? super U,A,R> downstream)
    • flattMapping

      public static <T, U> Collector<T,?,List<U>> flattMapping(Function<? super T,? extends Collection<? extends U>> mapper)
    • flattMapping

      public static <T, U, A, R> Collector<T,?,R> flattMapping(Function<? super T,? extends Collection<? extends U>> mapper, Collector<? super U,A,R> downstream)
    • flatMapping

      public static <T, T2, U> Collector<T,?,List<U>> flatMapping(Function<? super T,? extends Stream<? extends T2>> flatMapper, BiFunction<? super T,? super T2,? extends U> mapper)
    • flatMapping

      public static <T, T2, U, A, R> Collector<T,?,R> flatMapping(Function<? super T,? extends Stream<? extends T2>> flatMapper, BiFunction<? super T,? super T2,? extends U> mapper, Collector<? super U,A,R> downstream)
    • flattMapping

      public static <T, T2, U> Collector<T,?,List<U>> flattMapping(Function<? super T,? extends Collection<? extends T2>> flatMapper, BiFunction<? super T,? super T2,? extends U> mapper)
    • flattMapping

      public static <T, T2, U, A, R> Collector<T,?,R> flattMapping(Function<? super T,? extends Collection<? extends T2>> flatMapper, BiFunction<? super T,? super T2,? extends U> mapper, Collector<? super U,A,R> downstream)
    • collectingAndThen

      public static <T, A, R, RR> Collector<T,A,RR> collectingAndThen(Collector<T,A,R> downstream, Function<R,RR> finisher)
    • 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)
    • 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()
    • countingInt

      public static <T> Collector<T,?,Integer> countingInt()
    • min

      public static <T extends Comparable<? super T>> Collector<T,?,u.Optional<T>> min()
    • min

      public static <T> Collector<T,?,u.Optional<T>> min(Comparator<? super T> comparator)
    • minOrGet

      public static <T extends Comparable<? super T>> Collector<T,?,T> minOrGet(Supplier<? extends T> other)
    • minOrGet

      public static <T> Collector<T,?,T> minOrGet(Comparator<? super T> comparator, Supplier<? extends T> other)
    • minOrThrow

      public static <T extends Comparable<? super T>> Collector<T,?,T> minOrThrow()
    • minOrThrow

      public static <T> Collector<T,?,T> minOrThrow(Comparator<? super T> comparator)
    • minOrThrow

      public static <T> Collector<T,?,T> minOrThrow(Comparator<? super T> comparator, Supplier<? extends RuntimeException> exceptionSupplier)
    • minBy

      public static <T> Collector<T,?,u.Optional<T>> minBy(Function<? super T,? extends Comparable> keyMapper)
    • minByOrGet

      public static <T> Collector<T,?,T> minByOrGet(Function<? super T,? extends Comparable> keyMapper, Supplier<? extends T> other)
    • minByOrThrow

      public static <T> Collector<T,?,T> minByOrThrow(Function<? super T,? extends Comparable> keyMapper)
    • minByOrThrow

      public static <T> Collector<T,?,T> minByOrThrow(Function<? super T,? extends Comparable> keyMapper, Supplier<? extends RuntimeException> exceptionSupplier)
    • max

      public static <T extends Comparable<? super T>> Collector<T,?,u.Optional<T>> max()
    • max

      public static <T> Collector<T,?,u.Optional<T>> max(Comparator<? super T> comparator)
    • maxOrGet

      public static <T extends Comparable<? super T>> Collector<T,?,T> maxOrGet(Supplier<? extends T> other)
    • maxOrGet

      public static <T> Collector<T,?,T> maxOrGet(Comparator<? super T> comparator, Supplier<? extends T> other)
    • maxOrThrow

      public static <T extends Comparable<? super T>> Collector<T,?,T> maxOrThrow()
    • maxOrThrow

      public static <T> Collector<T,?,T> maxOrThrow(Comparator<? super T> comparator)
    • maxOrThrow

      public static <T> Collector<T,?,T> maxOrThrow(Comparator<? super T> comparator, Supplier<? extends RuntimeException> exceptionSupplier)
    • maxBy

      public static <T> Collector<T,?,u.Optional<T>> maxBy(Function<? super T,? extends Comparable> keyMapper)
    • maxByOrGet

      public static <T> Collector<T,?,T> maxByOrGet(Function<? super T,? extends Comparable> keyMapper, Supplier<? extends T> other)
    • maxByOrThrow

      public static <T> Collector<T,?,T> maxByOrThrow(Function<? super T,? extends Comparable> keyMapper)
    • maxByOrThrow

      public static <T> Collector<T,?,T> maxByOrThrow(Function<? super T,? extends Comparable> keyMapper, Supplier<? extends RuntimeException> exceptionSupplier)
    • 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)
      Parameters:
      comparator -
      atMostSize -
      Returns:
    • minAll

      public static <T extends Comparable, A, D> Collector<T,?,D> minAll(Collector<T,A,D> 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
      D - 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, D> Collector<T,?,D> minAll(Comparator<? super T> comparator, Collector<T,A,D> 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
      D - 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, A, D> Collector<T,?,u.Optional<Pair<T,D>>> minAlll(Collector<T,A,D> downstream)
    • minAlll

      public static <T, A, D> Collector<T,?,u.Optional<Pair<T,D>>> minAlll(Comparator<? super T> comparator, Collector<? super T,A,D> downstream)
    • minAlll

      public static <T, A, D, R> Collector<T,?,R> minAlll(Comparator<? super T> comparator, Collector<? super T,A,D> downstream, Function<u.Optional<Pair<T,D>>,R> finisher)
    • 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)
      Parameters:
      comparator -
      atMostSize -
      Returns:
    • maxAll

      public static <T extends Comparable, A, D> Collector<T,?,D> maxAll(Collector<T,A,D> 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
      D - 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, A, D> Collector<T,?,D> maxAll(Comparator<? super T> comparator, Collector<? super T,A,D> 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
      D - 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, A, D> Collector<T,?,u.Optional<Pair<T,D>>> maxAlll(Collector<T,A,D> downstream)
    • maxAlll

      public static <T, A, D> Collector<T,?,u.Optional<Pair<T,D>>> maxAlll(Comparator<? super T> comparator, Collector<? super T,A,D> downstream)
    • maxAlll

      public static <T, A, D, R> Collector<T,?,R> maxAlll(Comparator<? super T> comparator, Collector<? super T,A,D> downstream, Function<u.Optional<Pair<T,D>>,R> finisher)
    • minMax

      public static <T extends Comparable> Collector<T,?,u.Optional<Pair<T,T>>> minMax()
    • minMax

      public static <T> Collector<T,?,u.Optional<Pair<T,T>>> minMax(Comparator<? super T> comparator)
      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)
    • 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)
    • minMaxOrThrow

      public static <T extends Comparable<? super T>> Collector<T,?,Pair<T,T>> minMaxOrThrow()
    • minMaxOrThrow

      public static <T> Collector<T,?,Pair<T,T>> minMaxOrThrow(Comparator<? super T> comparator)
    • summingInt

      public static <T> Collector<T,?,Long> summingInt(ToIntFunction<? super T> mapper)
    • summingLong

      public static <T> Collector<T,?,Long> summingLong(ToLongFunction<? super T> mapper)
    • summingDouble

      public static <T> Collector<T,?,Double> summingDouble(ToDoubleFunction<? super T> mapper)
    • summingBigInteger

      public static <T> Collector<T,?,BigInteger> summingBigInteger(Function<? super T,BigInteger> mapper)
    • summingBigDecimal

      public static <T> Collector<T,?,BigDecimal> summingBigDecimal(Function<? super T,BigDecimal> mapper)
    • averagingInt

      public static <T> Collector<T,?,u.OptionalDouble> averagingInt(ToIntFunction<? super T> mapper)
    • averagingIntOrThrow

      public static <T> Collector<T,?,Double> averagingIntOrThrow(ToIntFunction<? super T> mapper)
    • averagingLong

      public static <T> Collector<T,?,u.OptionalDouble> averagingLong(ToLongFunction<? super T> mapper)
    • averagingLongOrThrow

      public static <T> Collector<T,?,Double> averagingLongOrThrow(ToLongFunction<? super T> mapper)
    • averagingDouble

      public static <T> Collector<T,?,u.OptionalDouble> averagingDouble(ToDoubleFunction<? super T> mapper)
    • averagingDoubleOrThrow

      public static <T> Collector<T,?,Double> averagingDoubleOrThrow(ToDoubleFunction<? super T> mapper)
    • averagingBigInteger

      public static <T> Collector<T,?,u.Optional<BigDecimal>> averagingBigInteger(Function<? super T,BigInteger> mapper)
    • averagingBigIntegerOrThrow

      public static <T> Collector<T,?,BigDecimal> averagingBigIntegerOrThrow(Function<? super T,BigInteger> mapper)
    • averagingBigDecimal

      public static <T> Collector<T,?,u.Optional<BigDecimal>> averagingBigDecimal(Function<? super T,BigDecimal> mapper)
    • averagingBigDecimalOrThrow

      public static <T> Collector<T,?,BigDecimal> averagingBigDecimalOrThrow(Function<? super T,BigDecimal> mapper)
    • summarizingChar

      public static <T> Collector<T,?,CharSummaryStatistics> summarizingChar(ToCharFunction<? super T> mapper)
    • summarizingByte

      public static <T> Collector<T,?,ByteSummaryStatistics> summarizingByte(ToByteFunction<? super T> mapper)
    • summarizingShort

      public static <T> Collector<T,?,ShortSummaryStatistics> summarizingShort(ToShortFunction<? super T> mapper)
    • summarizingInt

      public static <T> Collector<T,?,IntSummaryStatistics> summarizingInt(ToIntFunction<? super T> mapper)
    • summarizingLong

      public static <T> Collector<T,?,LongSummaryStatistics> summarizingLong(ToLongFunction<? super T> mapper)
    • summarizingFloat

      public static <T> Collector<T,?,FloatSummaryStatistics> summarizingFloat(ToFloatFunction<? super T> mapper)
    • summarizingDouble

      public static <T> Collector<T,?,DoubleSummaryStatistics> summarizingDouble(ToDoubleFunction<? super T> mapper)
    • summarizingBigInteger

      public static <T> Collector<T,?,BigIntegerSummaryStatistics> summarizingBigInteger(Function<? super T,BigInteger> mapper)
    • summarizingBigDecimal

      public static <T> Collector<T,?,BigDecimalSummaryStatistics> summarizingBigDecimal(Function<? super T,BigDecimal> mapper)
    • reducing

      public static <T> Collector<T,?,T> reducing(T identity, BinaryOperator<T> op)
    • reducing

      public static <T> Collector<T,?,u.Optional<T>> reducing(BinaryOperator<T> op)
    • reducingOrGet

      public static <T> Collector<T,?,T> reducingOrGet(BinaryOperator<T> op, Supplier<? extends T> other)
    • reducingOrThrow

      public static <T> Collector<T,?,T> reducingOrThrow(BinaryOperator<T> op, Supplier<? extends RuntimeException> exceptionSupplier)
    • reducingOrThrow

      public static <T> Collector<T,?,T> reducingOrThrow(BinaryOperator<T> op)
    • reducing

      public static <T, U> Collector<T,?,U> reducing(U identity, Function<? super T,? extends U> mapper, BinaryOperator<U> op)
    • reducing

      public static <T, U> Collector<T,?,u.Optional<U>> reducing(Function<? super T,? extends U> mapper, BinaryOperator<U> op)
    • reducingOrGet

      public static <T, U> Collector<T,?,U> reducingOrGet(Function<? super T,? extends U> mapper, BinaryOperator<U> op, Supplier<? extends U> other)
    • reducingOrThrow

      public static <T, U> Collector<T,?,U> reducingOrThrow(Function<? super T,? extends U> mapper, BinaryOperator<U> op, Supplier<? extends RuntimeException> exceptionSupplier)
    • reducingOrThrow

      public static <T, U> Collector<T,?,U> reducingOrThrow(Function<? super T,? extends U> mapper, BinaryOperator<U> op)
    • 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)
    • 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)
    • 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)
    • 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)
    • groupingByConcurrent

      public static <T, K> Collector<T,?,ConcurrentMap<K,List<T>>> groupingByConcurrent(Function<? super T,? extends K> keyMapper)
    • 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)
    • 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)
    • 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)
    • partitioningBy

      public static <T> Collector<T,?,Map<Boolean,List<T>>> partitioningBy(Predicate<? super T> predicate)
    • partitioningBy

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

      public static <T, K> Collector<T,?,Map<K,Long>> countingBy(Function<? super T,? extends K> keyMapper)
    • countingBy

      public static <T, K, M extends Map<K, Long>> Collector<T,?,M> countingBy(Function<? super T,? extends K> keyMapper, Supplier<? extends M> mapFactory)
    • countingIntBy

      public static <T, K> Collector<T,?,Map<K,Integer>> countingIntBy(Function<? super T,? extends K> keyMapper)
    • countingIntBy

      public static <T, K, M extends Map<K, Integer>> Collector<T,?,M> countingIntBy(Function<? super T,? extends K> keyMapper, Supplier<? extends M> mapFactory)
    • toMap

      public static <K, V> Collector<Map.Entry<K,V>,?,Map<K,V>> toMap()
    • toMap

      public static <K, V> Collector<Map.Entry<K,V>,?,Map<K,V>> toMap(BinaryOperator<V> mergeFunction)
    • toMap

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

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

      public static <T, K, V> Collector<T,?,Map<K,V>> toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
    • 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)
    • 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)
    • 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)
    • toImmutableMap

      public static <K, V> Collector<Map.Entry<K,V>,?,ImmutableMap<K,V>> toImmutableMap()
    • toImmutableMap

      public static <K, V> Collector<Map.Entry<K,V>,?,ImmutableMap<K,V>> toImmutableMap(BinaryOperator<V> mergeFunction)
    • toImmutableMap

      public static <T, K, V> Collector<T,?,ImmutableMap<K,V>> toImmutableMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
    • 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)
    • toLinkedHashMap

      public static <T, K, V> Collector<T,?,Map<K,V>> toLinkedHashMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
      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)
      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)
    • 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)
    • 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)
    • 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)
    • toBiMap

      public static <T, K, V> Collector<T,?,BiMap<K,V>> toBiMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
    • 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)
    • 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)
    • 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)
    • toMultimap

      public static <K, V> Collector<Map.Entry<? extends K,? extends V>,?,ListMultimap<K,V>> toMultimap()
    • toMultimap

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

      public static <T, K> Collector<T,?,ListMultimap<K,T>> toMultimap(Function<? super T,? extends K> keyMapper)
    • 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)
    • toMultimap

      public static <T, K, V> Collector<T,?,ListMultimap<K,V>> toMultimap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
    • 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)
    • flatMappingValueToMultimap

      public static <T, K, V> Collector<T,?,ListMultimap<K,V>> flatMappingValueToMultimap(Function<? super T,K> keyMapper, Function<? super T,? extends Stream<? extends V>> flatValueMapper)
      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 Stream<? extends V>> flatValueMapper, Supplier<? extends M> mapFactory)
      Parameters:
      keyMapper -
      flatValueMapper -
      mapFactory -
      Returns:
      See Also:
    • flattMappingValueToMultimap

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

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

      public static <T, K, V> Collector<T,?,ListMultimap<K,V>> flatMappingKeyToMultimap(Function<? super T,Stream<? extends K>> flatKeyMapper, Function<? super T,V> valueMapper)
      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,Stream<? extends K>> flatKeyMapper, Function<? super T,V> valueMapper, Supplier<? extends M> mapFactory)
      Parameters:
      flatKeyMapper -
      valueMapper -
      mapFactory -
      Returns:
      See Also:
    • flattMappingKeyToMultimap

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

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

      public static <T> Collector<T,?,DataSet> toDataSet()
    • toDataSet

      public static <T> Collector<T,?,DataSet> toDataSet(List<String> columnNames)
    • combine

      public static <T, A1, A2, R1, R2> Collector<T,Tuple.Tuple2<A1,A2>,Tuple.Tuple2<R1,R2>> combine(Collector<? super T,A1,R1> collector1, Collector<? super T,A2,R2> collector2)
    • combine

      public static <T, A1, A2, R1, R2, R> Collector<T,Tuple.Tuple2<A1,A2>,R> combine(Collector<? super T,A1,R1> collector1, Collector<? super T,A2,R2> collector2, BiFunction<? super R1,? super R2,R> finisher)
    • combine

      public static <T, A1, A2, A3, R1, R2, R3> Collector<T,Tuple.Tuple3<A1,A2,A3>,Tuple.Tuple3<R1,R2,R3>> combine(Collector<? super T,A1,R1> collector1, Collector<? super T,A2,R2> collector2, Collector<? super T,A3,R3> collector3)
    • combine

      public static <T, A1, A2, A3, R1, R2, R3, R> Collector<T,Tuple.Tuple3<A1,A2,A3>,R> combine(Collector<? super T,A1,R1> collector1, Collector<? super T,A2,R2> collector2, Collector<? super T,A3,R3> collector3, TriFunction<? super R1,? super R2,? super R3,R> finisher)
    • combine

      public static <T, A1, A2, A3, A4, R1, R2, R3, R4> Collector<T,Tuple.Tuple4<A1,A2,A3,A4>,Tuple.Tuple4<R1,R2,R3,R4>> combine(Collector<? super T,A1,R1> collector1, Collector<? super T,A2,R2> collector2, Collector<? super T,A3,R3> collector3, Collector<? super T,A4,R4> collector4)
    • combine

      public static <T, A1, A2, A3, A4, A5, R1, R2, R3, R4, R5> Collector<T,Tuple.Tuple5<A1,A2,A3,A4,A5>,Tuple.Tuple5<R1,R2,R3,R4,R5>> combine(Collector<? super T,A1,R1> collector1, Collector<? super T,A2,R2> collector2, Collector<? super T,A3,R3> collector3, Collector<? super T,A4,R4> collector4, Collector<? super T,A5,R5> collector5)
    • combine

      public static <T> Collector<T,?,List<?>> combine(Collection<? extends Collector<? super T,?,?>> collectors)
      Parameters:
      collectors -
      Returns:
      See Also: