From 57251859b6991277b65a2961b5fdbc5cd2a1a93a Mon Sep 17 00:00:00 2001 From: "Gary D. Gregory" Date: Wed, 9 Nov 2011 17:35:01 +0000 Subject: [PATCH] Eat own dog food: separator == null ? "" : separator -> ObjectUtils.toString(separator) git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1199888 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/commons/lang3/text/StrBuilder.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/text/StrBuilder.java b/src/main/java/org/apache/commons/lang3/text/StrBuilder.java index ee13e94f6..0a6d31e8f 100644 --- a/src/main/java/org/apache/commons/lang3/text/StrBuilder.java +++ b/src/main/java/org/apache/commons/lang3/text/StrBuilder.java @@ -22,6 +22,7 @@ import java.util.Iterator; import java.util.List; import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.SystemUtils; /** @@ -1018,7 +1019,7 @@ public class StrBuilder implements CharSequence, Appendable { */ public StrBuilder appendWithSeparators(Object[] array, String separator) { if (array != null && array.length > 0) { - separator = separator == null ? "" : separator; + separator = ObjectUtils.toString(separator); append(array[0]); for (int i = 1; i < array.length; i++) { append(separator); @@ -1040,7 +1041,7 @@ public class StrBuilder implements CharSequence, Appendable { */ public StrBuilder appendWithSeparators(Iterable iterable, String separator) { if (iterable != null) { - separator = separator == null ? "" : separator; + separator = ObjectUtils.toString(separator); Iterator it = iterable.iterator(); while (it.hasNext()) { append(it.next()); @@ -1064,7 +1065,7 @@ public class StrBuilder implements CharSequence, Appendable { */ public StrBuilder appendWithSeparators(Iterator it, String separator) { if (it != null) { - separator = separator == null ? "" : separator; + separator = ObjectUtils.toString(separator); while (it.hasNext()) { append(it.next()); if (it.hasNext()) {