A set of Collectors for Eclipse Collections types and algorithms.
Includes converter Collectors to{Immutable}{Sorted}{List/Set/Bag/Map/BiMap/Multimap}.
Includes Collectors for select, reject, partition.
Includes Collectors for collect, collect{Boolean/Byte/Char/Short/Int/Float/Long/Double}.
Includes Collectors for makeString, zip, chunk.
Includes Collectors for sumBy{Int/Float/Long/Double}.
Use these Collectors with @RichIterable#reduceInPlace(Collector) and @Stream#collect(Collector).
| Modifier and Type | Field and Description |
|---|---|
| private static final Collector | |
| private static final Collector | |
| private static final Collector | |
| private static final Collector | |
| private static final Collector | |
| private static final Collector | |
| private static final Collector | |
| private static final Collector | |
| private static final Collector | |
| private static final Collector | |
| private static final Collector | |
| private static final Collector | |
| private static final Collector | |
| private static final Collector | |
| private static final Collector | |
| private static final Collector. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static <T, K, R extends MutableMapIterable | aggregateBy(Function<? super T, ? extends K> groupBy, Function0<? extends T> zeroValueFactory, Function2<? super T, ? super T, ? extends T> aggregator, Supplier<R> supplier)
Groups the elements using the |
| public static <T> Collector | |
| public static <T, V, R extends Collection | |
| public static <T, R extends MutableBooleanCollection> Collector | collectBoolean(BooleanFunction<? super T> function, Supplier<R> supplier)
Returns a new MutableBooleanCollection with the results of applying the specified BooleanFunction on each element of the source. |
| public static <T, R extends MutableByteCollection> Collector | collectByte(ByteFunction<? super T> function, Supplier<R> supplier)
Returns a new MutableByteCollection with the results of applying the specified ByteFunction on each element of the source. |
| public static <T, R extends MutableCharCollection> Collector | collectChar(CharFunction<? super T> function, Supplier<R> supplier)
Returns a new MutableCharCollection with the results of applying the specified CharFunction on each element of the source. |
| public static <T, R extends MutableDoubleCollection> Collector | collectDouble(DoubleFunction<? super T> function, Supplier<R> supplier)
Returns a new MutableDoubleCollection with the results of applying the specified DoubleFunction on each element of the source. |
| public static <T, R extends MutableFloatCollection> Collector | collectFloat(FloatFunction<? super T> function, Supplier<R> supplier)
Returns a new MutableFloatCollection with the results of applying the specified FloatFunction on each element of the source. |
| public static <T, R extends MutableIntCollection> Collector | collectInt(IntFunction<? super T> function, Supplier<R> supplier)
Returns a new MutableIntCollection with the results of applying the specified IntFunction on each element of the source. |
| public static <T, R extends MutableLongCollection> Collector | collectLong(LongFunction<? super T> function, Supplier<R> supplier)
Returns a new MutableLongCollection with the results of applying the specified LongFunction on each element of the source. |
| public static <T, R extends MutableShortCollection> Collector | collectShort(ShortFunction<? super T> function, Supplier<R> supplier)
Returns a new MutableShortCollection with the results of applying the specified ShortFunction on each element of the source. |
| public static <T, P, V, R extends Collection | collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter, Supplier<R> supplier)
Returns a new collection with the results of applying the specified function on each element of the source collection with the specified parameter. |
| public static <T, K> Collector | |
| public static <T, K> Collector | countByEach(Function<? super T, ? extends Iterable<K>> function)
Same as |
| public static <T, V, R extends Collection | flatCollect(Function<? super T, ? extends Iterable<V>> function, Supplier<R> supplier)
The method |
| public static <T, K, R extends MutableMultimap | |
| public static <T, K, V, R extends MutableMultimap | groupByAndCollect(Function<? super T, ? extends K> groupBy, Function<? super T, ? extends V> valueFunction, Supplier<R> supplier)
Returns the elements as an MutableMultimap grouping each element using the specified groupBy Function and converting each element to the value returned by applying the specified Function valueFunction. |
| private static <T, K, V, A extends MutableMultimap | groupByAndCollectImmutable(Function<? super T, ? extends K> groupBy, Function<? super T, ? extends V> valueFunction, Supplier<A> supplier, Function<A, R> finisher)
|
| public static <T, K, R extends MutableMultimap | groupByEach(Function<? super T, ? extends Iterable<K>> groupBy, Supplier<R> supplier)
Same as |
| private static <T, K, A extends MutableMultimap | groupByImmutable(Function<? super T, ? extends K> groupBy, Supplier<A> supplier, Function<A, R> finisher)
|
| public static <T, K, R extends MutableMapIterable | groupByUniqueKey(Function<? super T, ? extends K> groupBy, Supplier<R> supplier)
Same as |
| public static <T> Collector | |
| public static <T> Collector | makeString(CharSequence separator)
Returns a String composed of elements separated by the specified separator. |
| public static <T> Collector | makeString(CharSequence start, CharSequence separator, CharSequence end)
Returns a String composed of elements separated by the specified separator and beginning with start String and ending with end String. |
| private static <T, R extends Collection | |
| private static <T, R extends PartitionMutableCollection | |
| public static <T, R extends PartitionMutableCollection | |
| public static <T, P, R extends PartitionMutableCollection | partitionWith(Predicate2<? super T, ? super P> predicate, P parameter, Supplier<R> supplier)
Returns all elements of the stream split into a PartitionMutableCollection after evaluating the predicate. |
| public static <T, R extends Collection | |
| public static <T, P, R extends Collection | rejectWith(Predicate2<? super T, ? super P> predicate, P parameter, Supplier<R> supplier)
Returns all elements of the stream that return false when evaluating the predicate with the parameter. |
| public static <T, R extends Collection | |
| public static <T, P, R extends Collection | selectWith(Predicate2<? super T, ? super P> predicate, P parameter, Supplier<R> supplier)
Returns all elements of the stream that return true when evaluating the predicate with the parameter. |
| public static <T, V> Collector | sumByBigDecimal(Function<? super T, ? extends V> groupBy, Function<? super T, BigDecimal> function)
Groups and sums the values using the two specified functions. |
| public static <T, V> Collector | sumByBigInteger(Function<? super T, ? extends V> groupBy, Function<? super T, BigInteger> function)
Groups and sums the values using the two specified functions. |
| public static <T, V> Collector | sumByDouble(Function<? super T, ? extends V> groupBy, DoubleFunction<? super T> function)
Groups and sums the values using the two specified functions. |
| public static <T, V> Collector | sumByFloat(Function<? super T, ? extends V> groupBy, FloatFunction<? super T> function)
Groups and sums the values using the two specified functions. |
| public static <T, V> Collector | sumByInt(Function<? super T, ? extends V> groupBy, IntFunction<? super T> function)
Groups and sums the values using the two specified functions. |
| public static <T, V> Collector | sumByLong(Function<? super T, ? extends V> groupBy, LongFunction<? super T> function)
Groups and sums the values using the two specified functions. |
| public static <T> Collector | summarizingBigDecimal(Function<? super T, BigDecimal> function)
Returns a BigDecimalSummaryStatistics applying the specified function to each element of the stream or collection. |
| public static <T> Collector | summarizingBigInteger(Function<? super T, BigInteger> function)
Returns a BigIntegerSummaryStatistics applying the specified function to each element of the stream or collection. |
| public static <T> Collector | summingBigDecimal(Function<? super T, BigDecimal> function)
Returns a BigDecimal sum applying the specified function to each element of the stream or collection. |
| public static <T> Collector | summingBigInteger(Function<? super T, BigInteger> function)
Returns a BigInteger sum applying the specified function to each element of the stream or collection. |
| public static <T> Collector | |
| public static <T, K> Collector | toBagMultimap(Function<? super T, ? extends K> groupBy)
Returns the elements as an MutableBagMultimap grouping each element using the specified groupBy Function. |
| public static <T, K, V> Collector | toBagMultimap(Function<? super T, ? extends K> groupBy, Function<? super T, ? extends V> valueFunction)
Returns the elements as an MutableBagMultimap grouping each element using the specified groupBy Function and converting each element to the value returned by applying the specified Function valueFunction. |
| public static <T, K, V> Collector | |
| public static <T> Collector | |
| public static <T, K> Collector | toImmutableBagMultimap(Function<? super T, ? extends K> groupBy)
Returns the elements as an ImmutableBagMultimap grouping each element using the specified groupBy Function. |
| public static <T, K, V> Collector | toImmutableBagMultimap(Function<? super T, ? extends K> groupBy, Function<? super T, ? extends V> valueFunction)
Returns the elements as an ImmutableBagMultimap grouping each element using the specified groupBy Function and converting each element to the value returned by applying the specified Function valueFunction. |
| public static <T, K, V> Collector | toImmutableBiMap(Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction)
Returns the elements as an ImmutableBiMap applying the keyFunction and valueFunction to each element. |
| public static <T> Collector | |
| public static <T, K> Collector | toImmutableListMultimap(Function<? super T, ? extends K> groupBy)
Returns the elements as an ImmutableListMultimap grouping each element using the specified groupBy Function. |
| public static <T, K, V> Collector | toImmutableListMultimap(Function<? super T, ? extends K> groupBy, Function<? super T, ? extends V> valueFunction)
Returns the elements as an ImmutableListMultimap grouping each element using the specified groupBy Function and converting each element to the value returned by applying the specified Function valueFunction. |
| public static <T, K, V> Collector | toImmutableMap(Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction)
Returns the elements as an ImmutableMap applying the keyFunction and valueFunction to each element. |
| public static <T> Collector | |
| public static <T, K> Collector | toImmutableSetMultimap(Function<? super T, ? extends K> groupBy)
Returns the elements as an ImmutableSetMultimap grouping each element using the specified groupBy Function. |
| public static <T, K, V> Collector | toImmutableSetMultimap(Function<? super T, ? extends K> groupBy, Function<? super T, ? extends V> valueFunction)
Returns the elements as an ImmutableSetMultimap grouping each element using the specified groupBy Function and converting each element to the value returned by applying the specified Function valueFunction. |
| public static <T> Collector | |
| public static <T> Collector | toImmutableSortedBag(Comparator<? super T> comparator)
Returns the elements as an ImmutableSortedBag using the specified comparator. |
| public static <T, V extends Comparable | toImmutableSortedBagBy(Function<? super T, ? extends V> function)
Returns the elements as a ImmutableSortedBag using the specified function. |
| public static <T> Collector | |
| public static <T> Collector | toImmutableSortedList(Comparator<? super T> comparator)
Returns the elements as an ImmutableList that has been sorted using the specified comparator. |
| public static <T, V extends Comparable | toImmutableSortedListBy(Function<? super T, ? extends V> function)
Returns the elements as a ImmutableList that has been sorted using the specified comparator. |
| public static <T, K, V> Collector | toImmutableSortedMap(Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction)
Returns the elements as a ImmutableSortedMap that has been sorted after applying the keyFunction and valueFunction to each element. |
| public static <T, K, V> Collector | toImmutableSortedMap(Comparator<? super K> comparator, Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction)
Returns the elements as a ImmutableSortedMap that has been sorted using the specified comparator after applying the keyFunction and valueFunction to each element. |
| public static <T, KK extends Comparable | toImmutableSortedMapBy(Function<? super K, KK> sortBy, Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction)
Returns the elements as a ImmutableSortedMap that has been sorted using the specified comparator. |
| public static <T> Collector | |
| public static <T> Collector | toImmutableSortedSet(Comparator<? super T> comparator)
Returns the elements as an ImmutableSortedSet using the specified comparator. |
| public static <T, V extends Comparable | toImmutableSortedSetBy(Function<? super T, ? extends V> function)
Returns the elements as a ImmutableSortedSet using the specified function to compare each element. |
| public static <T> Collector | |
| public static <T> Collector | |
| public static <T, K> Collector | toListMultimap(Function<? super T, ? extends K> groupBy)
Returns the elements as an MutableListMultimap grouping each element using the specified groupBy Function. |
| public static <T, K, V> Collector | toListMultimap(Function<? super T, ? extends K> groupBy, Function<? super T, ? extends V> valueFunction)
Returns the elements as an MutableListMultimap grouping each element using the specified groupBy Function and converting each element to the value returned by applying the specified Function valueFunction. |
| public static <T, K, V> Collector | |
| public static <T> Collector | |
| public static <T, K> Collector | toSetMultimap(Function<? super T, ? extends K> groupBy)
Returns the elements as an MutableSetMultimap grouping each element using the specified groupBy Function. |
| public static <T, K, V> Collector | toSetMultimap(Function<? super T, ? extends K> groupBy, Function<? super T, ? extends V> valueFunction)
Returns the elements as an MutableSetMultimap grouping each element using the specified groupBy Function and converting each element to the value returned by applying the specified Function valueFunction. |
| public static <T> Collector | |
| public static <T> Collector | toSortedBag(Comparator<? super T> comparator)
Returns the elements as a MutableSortedBag using the specified comparator. |
| public static <T, V extends Comparable | toSortedBagBy(Function<? super T, ? extends V> function)
Returns the elements as a MutableSortedBag using the specified function. |
| public static <T> Collector | |
| public static <T> Collector | toSortedList(Comparator<? super T> comparator)
Returns the elements as a MutableList that has been sorted using the specified comparator. |
| public static <T, V extends Comparable | toSortedListBy(Function<? super T, ? extends V> function)
Returns the elements as a MutableList that has been sorted using the specified comparator. |
| public static <T, K, V> Collector | toSortedMap(Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction)
Returns the elements as a MutableSortedMap that has been sorted after applying the keyFunction and valueFunction to each element. |
| public static <T, K, V> Collector | toSortedMap(Comparator<? super K> comparator, Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction)
Returns the elements as a MutableSortedMap that has been sorted using the specified comparator after applying the keyFunction and valueFunction to each element. |
| public static <T, KK extends Comparable | toSortedMapBy(Function<? super K, KK> sortBy, Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction)
Returns the elements as a MutableSortedMap that has been sorted using the specified comparator after applying the keyFunction and valueFunction to each element. |
| public static <T> Collector | |
| public static <T> Collector | toSortedSet(Comparator<? super T> comparator)
Returns the elements as a MutableSortedSet using the specified comparator. |
| public static <T, V extends Comparable | toSortedSetBy(Function<? super T, ? extends V> function)
Returns the elements as a MutableSortedSet using the specified function to compare each element. |
| public static <T> Collector | |
| public static <T, S> Collector | |
| public static <T> Collector |