Collector that implement various reduction operations.
This class is called LangCollectors instead of Collectors to avoid clashes with Collectors.
| Modifier and Type | Class and Description |
|---|---|
| private static class | LangCollectors.
the type of elements to be collected T, A, the type of the result R>Simple implementation class for |
| Modifier and Type | Field and Description |
|---|---|
| private static final Set |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static < The type of the array elements. T, the type of the result. R, the intermediate accumulation type of the A> RCollector. | Returns: the result of the reductionthe collector, final T... Collector describing the reduction.The array, assumed to be unmodified during use, a null array treated as an empty array. array)Delegates to |
| public static Collector | Returns: ACollector which concatenates Object elements, separated by the specified delimiter, in encounter order.Returns a |
| public static Collector | Returns: ACollector which concatenates Object elements, separated by the specified delimiter, in encounter order.the delimiter to be used between each element. delimiter)Returns a |
| public static Collector | Returns: ACollector which concatenates CharSequence elements, separated by the specified delimiter, in
encounter orderthe delimiter to be used between each element delimiter, final CharSequence the sequence of characters to be used at the beginning of the joined result prefix, final CharSequence the sequence of characters to be used at the end of the joined result suffix)Returns a |
| public static Collector | Returns: ACollector which concatenates CharSequence elements, separated by the specified delimiter, in encounter orderthe delimiter to be used between each element delimiter, final CharSequence the sequence of characters to be used at the beginning of the joined result prefix, final CharSequence the sequence of characters to be used at the end of the joined result suffix, final Function<Object, String> A function that takes an Object and returns a non-null String. toString)Returns a |
| CH_NOID | back to summary |
|---|---|
| private static final Set<Collector. | |
| LangCollectors | back to summary |
|---|---|
| private LangCollectors() | |
| collect | back to summary |
|---|---|
| public static <T, R, A> R collect(final Collector<? super T, A, R> collector, final T... array) Delegates to
| |
| joining | back to summary |
|---|---|
| public static Collector Returns a
This is a variation of For example: Stream.of(Long.valueOf(1), Long.valueOf(2), Long.valueOf(3)) .collect(LangCollectors.joining()) returns "123" | |
| joining | back to summary |
|---|---|
| public static Collector Returns a
This is a variation of For example:
Stream.of(Long.valueOf(1), Long.valueOf(2), Long.valueOf(3))
.collect(LangCollectors.joining("-"))
returns "1-2-3"
| |
| joining | back to summary |
|---|---|
| public static Collector Returns a
This is a variation of For example:
Stream.of(Long.valueOf(1), Long.valueOf(2), Long.valueOf(3))
.collect(LangCollectors.joining("-", "[", "]"))
returns "[1-2-3]"
| |
| joining | back to summary |
|---|---|
| public static Collector Returns a
This is a variation of For example:
| |
Collector.
| Modifier and Type | Field and Description |
|---|---|
| private final BiConsumer | |
| private final Set | |
| private final BinaryOperator | |
| private final Function | |
| private final Supplier |
| Access | Constructor and Description |
|---|---|
| private | SimpleCollector(final Supplier<A> supplier, final BiConsumer<A, T> accumulator, final BinaryOperator<A> combiner, final Function<A, R> finisher, final Set<Collector.
|
| Modifier and Type | Method and Description |
|---|---|
| public BiConsumer | accumulator()
Implements java. A function that folds a value into a mutable result container. |
| public Set | characteristics()
Implements java. Returns a |
| public BinaryOperator | combiner()
Implements java. A function that accepts two partial results and merges them. |
| public Function | finisher()
Implements java. Perform the final transformation from the intermediate accumulation type
|
| public Supplier | supplier()
Implements java. A function that creates and returns a new mutable result container. |
| accumulator | back to summary |
|---|---|
| private final BiConsumer<A, T> accumulator | |
| characteristics | back to summary |
|---|---|
| private final Set<Collector. | |
| combiner | back to summary |
|---|---|
| private final BinaryOperator<A> combiner | |
| finisher | back to summary |
|---|---|
| private final Function<A, R> finisher | |
| supplier | back to summary |
|---|---|
| private final Supplier<A> supplier | |
| SimpleCollector | back to summary |
|---|---|
| private SimpleCollector(final Supplier<A> supplier, final BiConsumer<A, T> accumulator, final BinaryOperator<A> combiner, final Function<A, R> finisher, final Set<Collector. | |
| accumulator | back to summary |
|---|---|
| public BiConsumer Implements java. Doc from java. A function that folds a value into a mutable result container.
| |
| characteristics | back to summary |
|---|---|
| public Set Implements java. Doc from java. Returns a
| |
| combiner | back to summary |
|---|---|
| public BinaryOperator Implements java. Doc from java. A function that accepts two partial results and merges them. The combiner function may fold state from one argument into the other and return that, or may return a new result container.
| |
| finisher | back to summary |
|---|---|
| public Function Implements java. Doc from java. Perform the final transformation from the intermediate accumulation type
If the characteristic
| |
| supplier | back to summary |
|---|---|
| public Supplier Implements java. Doc from java. A function that creates and returns a new mutable result container.
| |