Javadoc
This commit is contained in:
parent
0e1314c6b8
commit
7c99d624aa
|
@ -162,28 +162,27 @@ public final class LangCollectors {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@code Collector} that concatenates the input elements, separated by the specified delimiter, with the
|
* Returns a {@code Collector} that concatenates the input elements, separated by the specified delimiter, with the specified prefix and suffix, in
|
||||||
* specified prefix and suffix, in encounter order.
|
* encounter order.
|
||||||
* <p>
|
* <p>
|
||||||
* This is a variation of {@link Collectors#joining(CharSequence, CharSequence, CharSequence)} that works with any
|
* This is a variation of {@link Collectors#joining(CharSequence, CharSequence, CharSequence)} that works with any element class, not just
|
||||||
* element class, not just {@code CharSequence}.
|
* {@code CharSequence}.
|
||||||
* </p>
|
* </p>
|
||||||
* <p>
|
* <p>
|
||||||
* For example:
|
* For example:
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>{@code
|
||||||
* Stream.of(Long.valueOf(1), null, Long.valueOf(3))
|
* Stream.of(Long.valueOf(1), null, Long.valueOf(3))
|
||||||
* .collect(LangCollectors.joining("-", "[", "]", o -> Objects.toString(o, "NUL")))
|
* .collect(LangCollectors.joining("-", "[", "]", o -> Objects.toString(o, "NUL")))
|
||||||
* returns "[1-NUL-3]"
|
* returns "[1-NUL-3]"
|
||||||
* </pre>
|
* }</pre>
|
||||||
*
|
*
|
||||||
* @param delimiter the delimiter to be used between each element
|
* @param delimiter the delimiter to be used between each element
|
||||||
* @param prefix the sequence of characters to be used at the beginning of the joined result
|
* @param prefix the sequence of characters to be used at the beginning of the joined result
|
||||||
* @param suffix the sequence of characters to be used at the end of the joined result
|
* @param suffix the sequence of characters to be used at the end of the joined result
|
||||||
* @param toString A function that takes an Object and returns a non-null String.
|
* @param toString A function that takes an Object and returns a non-null String.
|
||||||
* @return A {@code Collector} which concatenates CharSequence elements, separated by the specified delimiter, in
|
* @return A {@code Collector} which concatenates CharSequence elements, separated by the specified delimiter, in encounter order
|
||||||
* encounter order
|
|
||||||
*/
|
*/
|
||||||
public static Collector<Object, ?, String> joining(final CharSequence delimiter, final CharSequence prefix, final CharSequence suffix,
|
public static Collector<Object, ?, String> joining(final CharSequence delimiter, final CharSequence prefix, final CharSequence suffix,
|
||||||
final Function<Object, String> toString) {
|
final Function<Object, String> toString) {
|
||||||
|
|
Loading…
Reference in New Issue