commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang ArrayUtils.java StringUtils.java
Date Sun, 23 Mar 2003 04:58:47 GMT
bayard      2003/03/22 20:58:47

  Modified:    lang/src/java/org/apache/commons/lang ArrayUtils.java
                        StringUtils.java
  Log:
  Moved reverseArray method from a private method in StringUtils into ArrayUtils.
  This method exists in Jakarta Collection, so is a duplicate, but it belongs in
  ArrayUtils.
  
  Revision  Changes    Path
  1.9       +22 -1     jakarta-commons/lang/src/java/org/apache/commons/lang/ArrayUtils.java
  
  Index: ArrayUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/ArrayUtils.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ArrayUtils.java	4 Feb 2003 22:06:24 -0000	1.8
  +++ ArrayUtils.java	23 Mar 2003 04:58:47 -0000	1.9
  @@ -1012,4 +1012,25 @@
           return (indexOf(array, objectToFind) != -1);
       }
       
  +    /**
  +     * <p>Reverses an array.</p>
  +     *
  +     * <p>TAKEN FROM CollectionsUtils.</p>
  +     *
  +     * @param array  the array to reverse
  +     */
  +    public static void reverseArray(Object[] array) {
  +        int i = 0;
  +        int j = array.length - 1;
  +        Object tmp;
  +
  +        while (j > i) {
  +            tmp = array[j];
  +            array[j] = array[i];
  +            array[i] = tmp;
  +            j--;
  +            i++;
  +        }
  +    }
  +
   }
  
  
  
  1.34      +3 -23     jakarta-commons/lang/src/java/org/apache/commons/lang/StringUtils.java
  
  Index: StringUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/StringUtils.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- StringUtils.java	17 Mar 2003 05:28:36 -0000	1.33
  +++ StringUtils.java	23 Mar 2003 04:58:47 -0000	1.34
  @@ -75,6 +75,7 @@
    * @author <a href="mailto:fredrik@westermarck.com">Fredrik Westermarck</a>
    * @author Holger Krauth
    * @author <a href="mailto:alex@purpletech.com">Alexander Day Chaffee</a>
  + * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
    * @since 1.0
    * @version $Id$
    */
  @@ -1722,29 +1723,8 @@
           // could implement manually, but simple way is to reuse other, 
           // probably slower, methods.
           String[] strs = split(str, delimiter);
  -        reverseArray(strs);
  +        ArrayUtils.reverseArray(strs);
           return join(strs, delimiter);
  -    }
  -
  -    /**
  -     * <p>Reverses an array.</p>
  -     *
  -     * <p>TAKEN FROM CollectionsUtils.</p>
  -     *
  -     * @param array  the array to reverse
  -     */
  -    private static void reverseArray(Object[] array) {
  -        int i = 0;
  -        int j = array.length - 1;
  -        Object tmp;
  -
  -        while (j > i) {
  -            tmp = array[j];
  -            array[j] = array[i];
  -            array[i] = tmp;
  -            j--;
  -            i++;
  -        }
       }
   
       // Abbreviating
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message