commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: svn commit: r1407525 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/StrBuilder.java
Date Fri, 09 Nov 2012 16:30:06 GMT
Good one Matt.

G

On Fri, Nov 9, 2012 at 11:26 AM, <mbenson@apache.org> wrote:

> 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;
>
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message