Interface Collectable<T>

All Known Subinterfaces:
Seq<T>, Window<T>

public interface Collectable<T>
A common super type for types like Seq or Window delegating common aggregation functions to collect(Collector)
Author:
Lukas Eder
  • Method Details

    • collect

      <R, A> R collect(Collector<? super T,A,R> collector)
      Collect this collectable.
    • collect

      default <R1, R2, A1, A2> Tuple2<R1,R2> collect(Collector<? super T,A1,R1> collector1, Collector<? super T,A2,R2> collector2)
      Collect this collectable into 2 Collectors.
    • collect

      default <R1, R2, R3, A1, A2, A3> Tuple3<R1,R2,R3> collect(Collector<? super T,A1,R1> collector1, Collector<? super T,A2,R2> collector2, Collector<? super T,A3,R3> collector3)
      Collect this collectable into 3 Collectors.
    • collect

      default <R1, R2, R3, R4, A1, A2, A3, A4> Tuple4<R1,R2,R3,R4> collect(Collector<? super T,A1,R1> collector1, Collector<? super T,A2,R2> collector2, Collector<? super T,A3,R3> collector3, Collector<? super T,A4,R4> collector4)
      Collect this collectable into 4 Collectors.
    • collect

      default <R1, R2, R3, R4, R5, A1, A2, A3, A4, A5> Tuple5<R1,R2,R3,R4,R5> collect(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)
      Collect this collectable into 5 Collectors.
    • collect

      default <R1, R2, R3, R4, R5, R6, A1, A2, A3, A4, A5, A6> Tuple6<R1,R2,R3,R4,R5,R6> collect(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, Collector<? super T,A6,R6> collector6)
      Collect this collectable into 6 Collectors.
    • collect

      default <R1, R2, R3, R4, R5, R6, R7, A1, A2, A3, A4, A5, A6, A7> Tuple7<R1,R2,R3,R4,R5,R6,R7> collect(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, Collector<? super T,A6,R6> collector6, Collector<? super T,A7,R7> collector7)
      Collect this collectable into 7 Collectors.
    • collect

      default <R1, R2, R3, R4, R5, R6, R7, R8, A1, A2, A3, A4, A5, A6, A7, A8> Tuple8<R1,R2,R3,R4,R5,R6,R7,R8> collect(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, Collector<? super T,A6,R6> collector6, Collector<? super T,A7,R7> collector7, Collector<? super T,A8,R8> collector8)
      Collect this collectable into 8 Collectors.
    • collect

      default <R1, R2, R3, R4, R5, R6, R7, R8, R9, A1, A2, A3, A4, A5, A6, A7, A8, A9> Tuple9<R1,R2,R3,R4,R5,R6,R7,R8,R9> collect(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, Collector<? super T,A6,R6> collector6, Collector<? super T,A7,R7> collector7, Collector<? super T,A8,R8> collector8, Collector<? super T,A9,R9> collector9)
      Collect this collectable into 9 Collectors.
    • collect

      default <R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> Tuple10<R1,R2,R3,R4,R5,R6,R7,R8,R9,R10> collect(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, Collector<? super T,A6,R6> collector6, Collector<? super T,A7,R7> collector7, Collector<? super T,A8,R8> collector8, Collector<? super T,A9,R9> collector9, Collector<? super T,A10,R10> collector10)
      Collect this collectable into 10 Collectors.
    • collect

      default <R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11> Tuple11<R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11> collect(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, Collector<? super T,A6,R6> collector6, Collector<? super T,A7,R7> collector7, Collector<? super T,A8,R8> collector8, Collector<? super T,A9,R9> collector9, Collector<? super T,A10,R10> collector10, Collector<? super T,A11,R11> collector11)
      Collect this collectable into 11 Collectors.
    • collect

      default <R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12> Tuple12<R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12> collect(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, Collector<? super T,A6,R6> collector6, Collector<? super T,A7,R7> collector7, Collector<? super T,A8,R8> collector8, Collector<? super T,A9,R9> collector9, Collector<? super T,A10,R10> collector10, Collector<? super T,A11,R11> collector11, Collector<? super T,A12,R12> collector12)
      Collect this collectable into 12 Collectors.
    • collect

      default <R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13> Tuple13<R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,R13> collect(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, Collector<? super T,A6,R6> collector6, Collector<? super T,A7,R7> collector7, Collector<? super T,A8,R8> collector8, Collector<? super T,A9,R9> collector9, Collector<? super T,A10,R10> collector10, Collector<? super T,A11,R11> collector11, Collector<? super T,A12,R12> collector12, Collector<? super T,A13,R13> collector13)
      Collect this collectable into 13 Collectors.
    • collect

      default <R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14> Tuple14<R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,R13,R14> collect(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, Collector<? super T,A6,R6> collector6, Collector<? super T,A7,R7> collector7, Collector<? super T,A8,R8> collector8, Collector<? super T,A9,R9> collector9, Collector<? super T,A10,R10> collector10, Collector<? super T,A11,R11> collector11, Collector<? super T,A12,R12> collector12, Collector<? super T,A13,R13> collector13, Collector<? super T,A14,R14> collector14)
      Collect this collectable into 14 Collectors.
    • collect

      default <R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15> Tuple15<R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,R13,R14,R15> collect(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, Collector<? super T,A6,R6> collector6, Collector<? super T,A7,R7> collector7, Collector<? super T,A8,R8> collector8, Collector<? super T,A9,R9> collector9, Collector<? super T,A10,R10> collector10, Collector<? super T,A11,R11> collector11, Collector<? super T,A12,R12> collector12, Collector<? super T,A13,R13> collector13, Collector<? super T,A14,R14> collector14, Collector<? super T,A15,R15> collector15)
      Collect this collectable into 15 Collectors.
    • collect

      default <R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16> Tuple16<R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,R13,R14,R15,R16> collect(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, Collector<? super T,A6,R6> collector6, Collector<? super T,A7,R7> collector7, Collector<? super T,A8,R8> collector8, Collector<? super T,A9,R9> collector9, Collector<? super T,A10,R10> collector10, Collector<? super T,A11,R11> collector11, Collector<? super T,A12,R12> collector12, Collector<? super T,A13,R13> collector13, Collector<? super T,A14,R14> collector14, Collector<? super T,A15,R15> collector15, Collector<? super T,A16,R16> collector16)
      Collect this collectable into 16 Collectors.
    • count

      long count()
      Count the values in this collectable.
    • count

      long count(Predicate<? super T> predicate)
      Count the values in this collectable, for which a predicate evaluates to true.
    • countDistinct

      long countDistinct()
      Count the distinct values in this collectable.
    • countDistinct

      long countDistinct(Predicate<? super T> predicate)
      Count the distinct values in this collectable, for which a predicate evaluates to true.
    • countDistinctBy

      <U> long countDistinctBy(Function<? super T,? extends U> function)
      Count the distinct values of a given expression in this collectable.
    • countDistinctBy

      <U> long countDistinctBy(Function<? super T,? extends U> function, Predicate<? super U> predicate)
      Count the distinct values of a given expression in this collectable, for which a predicate evaluates to true.
    • mode

      Optional<T> mode()
      Get the mode, i.e. the value that appears most often in the collectable.
    • modeBy

      <U> Optional<T> modeBy(Function<? super T,? extends U> function)
      Get the mode, i.e. the value that appears most often in the collectable.
    • modeAll

      Seq<T> modeAll()
      Get the mode, i.e. the values that appear most often in the collectable.
    • modeAllBy

      <U> Seq<T> modeAllBy(Function<? super T,? extends U> function)
      Get the mode, i.e. the values that appear most often in the collectable.
    • sum

      Optional<T> sum()
      Get the sum of the elements in this collectable.
    • sum

      <U> Optional<U> sum(Function<? super T,? extends U> function)
      Get the sum of the elements in this collectable.
    • sumInt

      int sumInt(ToIntFunction<? super T> function)
      Get the sum of the elements in this collectable as int.
    • sumLong

      long sumLong(ToLongFunction<? super T> function)
      Get the sum of the elements in this collectable as long.
    • sumDouble

      double sumDouble(ToDoubleFunction<? super T> function)
      Get the sum of the elements in this collectable as double.
    • avg

      Optional<T> avg()
      Get the average of the elements in this collectable.
    • avg

      <U> Optional<U> avg(Function<? super T,? extends U> function)
      Get the average of the elements in this collectable.
    • avgInt

      double avgInt(ToIntFunction<? super T> function)
      Get the average of the elements in this collectable as int.
    • avgLong

      double avgLong(ToLongFunction<? super T> function)
      Get the average of the elements in this collectable as long.
    • avgDouble

      double avgDouble(ToDoubleFunction<? super T> function)
      Get the average of the elements in this collectable as double.
    • min

      Optional<T> min()
      Get the minimum value.

      This makes the unsafe assumption that <T extends Comparable<? super T>>

    • min

      Optional<T> min(Comparator<? super T> comparator)
      Get the minimum value by a function.
    • min

      <U extends Comparable<? super U>> Optional<U> min(Function<? super T,? extends U> function)
      Get the minimum value by a function.
    • min

      <U> Optional<U> min(Function<? super T,? extends U> function, Comparator<? super U> comparator)
      Get the minimum value by a function.
    • minBy

      <U extends Comparable<? super U>> Optional<T> minBy(Function<? super T,? extends U> function)
      Get the minimum value by a function.
    • minBy

      <U> Optional<T> minBy(Function<? super T,? extends U> function, Comparator<? super U> comparator)
      Get the minimum value by a function.
    • minAll

      Seq<T> minAll()
      Get the minimum values.

      This makes the unsafe assumption that <T extends Comparable<? super T>>

    • minAll

      Seq<T> minAll(Comparator<? super T> comparator)
      Get the minimum values by a function.
    • minAll

      <U extends Comparable<? super U>> Seq<U> minAll(Function<? super T,? extends U> function)
      Get the minimum values by a function.
    • minAll

      <U> Seq<U> minAll(Function<? super T,? extends U> function, Comparator<? super U> comparator)
      Get the minimum values by a function.
    • minAllBy

      <U extends Comparable<? super U>> Seq<T> minAllBy(Function<? super T,? extends U> function)
      Get the minimum values by a function.
    • minAllBy

      <U> Seq<T> minAllBy(Function<? super T,? extends U> function, Comparator<? super U> comparator)
      Get the minimum values by a function.
    • max

      Optional<T> max()
      Get the maximum value.

      This makes the unsafe assumption that <T extends Comparable<? super T>>

    • max

      Optional<T> max(Comparator<? super T> comparator)
      Get the maximum value by a function.
    • max

      <U extends Comparable<? super U>> Optional<U> max(Function<? super T,? extends U> function)
      Get the maximum value by a function.
    • max

      <U> Optional<U> max(Function<? super T,? extends U> function, Comparator<? super U> comparator)
      Get the maximum value by a function.
    • maxBy

      <U extends Comparable<? super U>> Optional<T> maxBy(Function<? super T,? extends U> function)
      Get the maximum value by a function.
    • maxBy

      <U> Optional<T> maxBy(Function<? super T,? extends U> function, Comparator<? super U> comparator)
      Get the maximum value by a function.
    • maxAll

      Seq<T> maxAll()
      Get the maximum values.

      This makes the unsafe assumption that <T extends Comparable<? super T>>

    • maxAll

      Seq<T> maxAll(Comparator<? super T> comparator)
      Get the maximum values by a function.
    • maxAll

      <U extends Comparable<? super U>> Seq<U> maxAll(Function<? super T,? extends U> function)
      Get the maximum values by a function.
    • maxAll

      <U> Seq<U> maxAll(Function<? super T,? extends U> function, Comparator<? super U> comparator)
      Get the maximum values by a function.
    • maxAllBy

      <U extends Comparable<? super U>> Seq<T> maxAllBy(Function<? super T,? extends U> function)
      Get the maximum values by a function.
    • maxAllBy

      <U> Seq<T> maxAllBy(Function<? super T,? extends U> function, Comparator<? super U> comparator)
      Get the maximum values by a function.
    • median

      Optional<T> median()
      Get the median value.

      This makes the unsafe assumption that <T extends Comparable<? super T>>

    • median

      Optional<T> median(Comparator<? super T> comparator)
      Get the median value.
    • medianBy

      <U extends Comparable<? super U>> Optional<T> medianBy(Function<? super T,? extends U> function)
      Get the median value by a function.
    • medianBy

      <U> Optional<T> medianBy(Function<? super T,? extends U> function, Comparator<? super U> comparator)
      Get the median value by a function.
    • percentile

      Optional<T> percentile(double percentile)
      Get the discrete percentile value.

      This makes the unsafe assumption that <T extends Comparable<? super T>>

    • percentile

      Optional<T> percentile(double percentile, Comparator<? super T> comparator)
      Get the discrete percentile value.
    • percentileBy

      <U extends Comparable<? super U>> Optional<T> percentileBy(double percentile, Function<? super T,? extends U> function)
      Get the discrete percentile value by a function.
    • percentileBy

      <U> Optional<T> percentileBy(double percentile, Function<? super T,? extends U> function, Comparator<? super U> comparator)
      Get the discrete percentile value by a function.
    • allMatch

      boolean allMatch(Predicate<? super T> predicate)
      Whether all elements in the collectable match a given predicate.
    • anyMatch

      boolean anyMatch(Predicate<? super T> predicate)
      Whether any element in the collectable matches a given predicate.
    • noneMatch

      boolean noneMatch(Predicate<? super T> predicate)
      Whether no element in the collectable matches a given predicate.
    • bitAnd

      Optional<T> bitAnd()
      Collect all bits in this stream into a single value by applying bitwise and.
    • bitAnd

      <U> Optional<U> bitAnd(Function<? super T,? extends U> function)
      Collect all bits in this stream into a single value by applying bitwise and.
    • bitAndInt

      int bitAndInt(ToIntFunction<? super T> function)
      Collect all bits in this stream into a single value by applying bitwise and.
    • bitAndLong

      long bitAndLong(ToLongFunction<? super T> function)
      Collect all bits in this stream into a single value by applying bitwise and.
    • bitOr

      Optional<T> bitOr()
      Collect all bits in this stream into a single value by applying bitwise or.
    • bitOr

      <U> Optional<U> bitOr(Function<? super T,? extends U> function)
      Collect all bits in this stream into a single value by applying bitwise or.
    • bitOrInt

      int bitOrInt(ToIntFunction<? super T> function)
      Collect all bits in this stream into a single value by applying bitwise or.
    • bitOrLong

      long bitOrLong(ToLongFunction<? super T> function)
      Collect all bits in this stream into a single value by applying bitwise or.
    • toList

      List<T> toList()
      Collect the collectable into an ArrayList.
    • toList

      <L extends List<T>> L toList(Supplier<L> factory)
      Collect the collectable into a List.
    • toUnmodifiableList

      List<T> toUnmodifiableList()
      Collect the collectable into an unmodifiable List.
    • toSet

      Set<T> toSet()
      Collect the collectable into a LinkedHashSet.
    • toSet

      <S extends Set<T>> S toSet(Supplier<S> factory)
      Collect the collectable into a Set.
    • toUnmodifiableSet

      Set<T> toUnmodifiableSet()
      Collect the collectable into an unmodifiable Set.
    • toCollection

      <C extends Collection<T>> C toCollection(Supplier<C> factory)
      Collect the collectable into a Collection.
    • toMap

      <K, V> Map<K,V> toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
      Collect the collectable into a Map.
    • toMap

      <K> Map<K,T> toMap(Function<? super T,? extends K> keyMapper)
      Collect the collectable into a Map with the given keys and the self element as value.
    • toString

      String toString(CharSequence delimiter)
      Consume a stream and concatenate all elements using a separator.
    • toString

      String toString(CharSequence delimiter, CharSequence prefix, CharSequence suffix)
    • commonPrefix

      String commonPrefix()
      Get the common prefix of all strings (or to-stringed values) in this stream.
    • commonSuffix

      String commonSuffix()
      Get the common prefix of all strings (or to-stringed values) in this stream.