commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1407525 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
Date Fri, 09 Nov 2012 16:26:45 GMT
Author: mbenson
Date: Fri Nov  9 16:26:44 2012
New Revision: 1407525

URL: http://svn.apache.org/viewvc?rev=1407525&view=rev
Log:
support varargs in StrBuilder.appendAll(); also convert iterable form of method to use enhanced
for loop

Modified:
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java?rev=1407525&r1=1407524&r2=1407525&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
(original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
Fri Nov  9 16:26:44 2012
@@ -992,7 +992,7 @@ public class StrBuilder implements CharS
      * @return this, to enable chaining
      * @since 2.3
      */
-    public StrBuilder appendAll(Object[] array) {
+    public <T> StrBuilder appendAll(T... array) {
         if (array != null && array.length > 0) {
             for (Object element : array) {
                 append(element);
@@ -1012,9 +1012,8 @@ public class StrBuilder implements CharS
      */
     public StrBuilder appendAll(Iterable<?> iterable) {
         if (iterable != null) {
-            Iterator<?> it = iterable.iterator();
-            while (it.hasNext()) {
-                append(it.next());
+            for (Object o : iterable) {
+                append(o);
             }
         }
         return this;



Mime
View raw message