public final class LangCollectors
extends java.lang.Object
Collector
that implement various useful reduction operations.
This class is called LangCollectors
instead of Collectors
to avoid clashes with Collectors
.
Modifier and Type | Method and Description |
---|---|
static java.util.stream.Collector<java.lang.Object,?,java.lang.String> |
joining()
Returns a
Collector that concatenates the input elements, separated by the specified delimiter, in encounter
order. |
static java.util.stream.Collector<java.lang.Object,?,java.lang.String> |
joining(java.lang.CharSequence delimiter)
Returns a
Collector that concatenates the input elements, separated by the specified delimiter, in encounter
order. |
static java.util.stream.Collector<java.lang.Object,?,java.lang.String> |
joining(java.lang.CharSequence delimiter,
java.lang.CharSequence prefix,
java.lang.CharSequence suffix)
Returns a
Collector that concatenates the input elements, separated by the specified delimiter, with the
specified prefix and suffix, in encounter order. |
static java.util.stream.Collector<java.lang.Object,?,java.lang.String> |
joining(java.lang.CharSequence delimiter,
java.lang.CharSequence prefix,
java.lang.CharSequence suffix,
java.util.function.Function<java.lang.Object,java.lang.String> toString)
Returns a
Collector that concatenates the input elements, separated by the specified delimiter, with the
specified prefix and suffix, in encounter order. |
public static java.util.stream.Collector<java.lang.Object,?,java.lang.String> joining()
Collector
that concatenates the input elements, separated by the specified delimiter, in encounter
order.
This is a variation of Collectors.joining()
that works with any element class, not just CharSequence
.
Collector
which concatenates Object elements, separated by the specified delimiter, in encounter
order.public static java.util.stream.Collector<java.lang.Object,?,java.lang.String> joining(java.lang.CharSequence delimiter)
Collector
that concatenates the input elements, separated by the specified delimiter, in encounter
order.
This is a variation of Collectors.joining(CharSequence)
that works with any element class, not just
CharSequence
.
delimiter
- the delimiter to be used between each element.Collector
which concatenates Object elements, separated by the specified delimiter, in encounter
order.public static java.util.stream.Collector<java.lang.Object,?,java.lang.String> joining(java.lang.CharSequence delimiter, java.lang.CharSequence prefix, java.lang.CharSequence suffix)
Collector
that concatenates the input elements, separated by the specified delimiter, with the
specified prefix and suffix, in encounter order.
This is a variation of Collectors.joining(CharSequence, CharSequence, CharSequence)
that works with any
element class, not just CharSequence
.
delimiter
- the delimiter to be used between each elementprefix
- the sequence of characters to be used at the beginning of the joined resultsuffix
- the sequence of characters to be used at the end of the joined resultCollector
which concatenates CharSequence elements, separated by the specified delimiter, in
encounter orderpublic static java.util.stream.Collector<java.lang.Object,?,java.lang.String> joining(java.lang.CharSequence delimiter, java.lang.CharSequence prefix, java.lang.CharSequence suffix, java.util.function.Function<java.lang.Object,java.lang.String> toString)
Collector
that concatenates the input elements, separated by the specified delimiter, with the
specified prefix and suffix, in encounter order.
This is a variation of Collectors.joining(CharSequence, CharSequence, CharSequence)
that works with any
element class, not just CharSequence
.
delimiter
- the delimiter to be used between each elementprefix
- the sequence of characters to be used at the beginning of the joined resultsuffix
- the sequence of characters to be used at the end of the joined resulttoString
- A function that takes an Object and returns a non-null String.Collector
which concatenates CharSequence elements, separated by the specified delimiter, in
encounter orderCopyright © 2010 - 2023 Adobe. All Rights Reserved