This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit 0287bada77011c8ba2d10ce3fee79c2a2003dd22
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Thu Apr 25 08:28:50 2024 -0400

    Javadoc
---
 .../commons/lang3/stream/LangCollectors.java       | 51 +++++++++++++++++-----
 1 file changed, 41 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/commons/lang3/stream/LangCollectors.java 
b/src/main/java/org/apache/commons/lang3/stream/LangCollectors.java
index 1363bda92..a5ba7fdbb 100644
--- a/src/main/java/org/apache/commons/lang3/stream/LangCollectors.java
+++ b/src/main/java/org/apache/commons/lang3/stream/LangCollectors.java
@@ -92,30 +92,43 @@ public final class LangCollectors {
     private static final Set<Collector.Characteristics> CH_NOID = 
Collections.emptySet();
 
     /**
-     * Returns a {@code Collector} that concatenates the input elements, 
separated by the specified delimiter, in encounter
-     * order.
+     * Returns a {@code Collector} that concatenates the input elements, 
separated by the specified delimiter, in encounter order.
      * <p>
      * This is a variation of {@link Collectors#joining()} that works with any 
element class, not just {@code CharSequence}.
      * </p>
+     * <p>
+     * For example:
+     * </p>
+     *
+     * <pre>
+     * Stream.of(Long.valueOf(1), Long.valueOf(2), Long.valueOf(3))
+     *    .collect(LangCollectors.joining())
+     * returns "123"
+     * </pre>
      *
-     * @return A {@code Collector} which concatenates Object elements, 
separated by the specified delimiter, in encounter
-     *         order.
+     * @return A {@code Collector} which concatenates Object elements, 
separated by the specified delimiter, in encounter order.
      */
     public static Collector<Object, ?, String> joining() {
         return new SimpleCollector<>(StringBuilder::new, 
StringBuilder::append, StringBuilder::append, StringBuilder::toString, CH_NOID);
     }
 
     /**
-     * Returns a {@code Collector} that concatenates the input elements, 
separated by the specified delimiter, in encounter
-     * order.
+     * Returns a {@code Collector} that concatenates the input elements, 
separated by the specified delimiter, in encounter order.
      * <p>
-     * This is a variation of {@link Collectors#joining(CharSequence)} that 
works with any element class, not just
-     * {@code CharSequence}.
+     * This is a variation of {@link Collectors#joining(CharSequence)} that 
works with any element class, not just {@code CharSequence}.
      * </p>
+     * <p>
+     * For example:
+     * </p>
+     *
+     * <pre>
+     * Stream.of(Long.valueOf(1), Long.valueOf(2), Long.valueOf(3))
+     *   .collect(LangCollectors.joining("-"))
+     * returns "1-2-3"
+     * </pre>
      *
      * @param delimiter the delimiter to be used between each element.
-     * @return A {@code Collector} which concatenates Object elements, 
separated by the specified delimiter, in encounter
-     *         order.
+     * @return A {@code Collector} which concatenates Object elements, 
separated by the specified delimiter, in encounter order.
      */
     public static Collector<Object, ?, String> joining(final CharSequence 
delimiter) {
         return joining(delimiter, StringUtils.EMPTY, StringUtils.EMPTY);
@@ -128,6 +141,15 @@ public final class LangCollectors {
      * This is a variation of {@link Collectors#joining(CharSequence, 
CharSequence, CharSequence)} that works with any
      * element class, not just {@code CharSequence}.
      * </p>
+     * <p>
+     * For example:
+     * </p>
+     *
+     * <pre>
+     * Stream.of(Long.valueOf(1), Long.valueOf(2), Long.valueOf(3))
+     *   .collect(LangCollectors.joining("-", "[", "]"))
+     * returns "[1-2-3]"
+     * </pre>
      *
      * @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
@@ -146,6 +168,15 @@ public final class LangCollectors {
      * This is a variation of {@link Collectors#joining(CharSequence, 
CharSequence, CharSequence)} that works with any
      * element class, not just {@code CharSequence}.
      * </p>
+     * <p>
+     * For example:
+     * </p>
+     *
+     * <pre>
+     * Stream.of(Long.valueOf(1), null, Long.valueOf(3))
+     *   .collect(LangCollectors.joining("-", "[", "]", o -> 
Objects.toString(o, "NUL")))
+     * returns "[1-NUL-3]"
+     * </pre>
      *
      * @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

Reply via email to