commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang ArrayUtils.java
Date Sat, 31 Jan 2004 20:12:16 GMT
ggregory    2004/01/31 12:12:16

  Modified:    lang/src/test/org/apache/commons/lang ArrayUtilsTest.java
               lang/src/java/org/apache/commons/lang ArrayUtils.java
  Log:
  Renamed ArrayUtils.join(Object[],Object[]) to addAll.
  
  Revision  Changes    Path
  1.23      +9 -9      jakarta-commons/lang/src/test/org/apache/commons/lang/ArrayUtilsTest.java
  
  Index: ArrayUtilsTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/ArrayUtilsTest.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ArrayUtilsTest.java	30 Jan 2004 01:39:57 -0000	1.22
  +++ ArrayUtilsTest.java	31 Jan 2004 20:12:15 -0000	1.23
  @@ -116,35 +116,35 @@
       }
       
       public void testJoin() {
  -        assertNull(ArrayUtils.join(null, null));
  +        assertNull(ArrayUtils.addAll(null, null));
           Object[] joinedArray;
           String[] stringArray1 = new String[]{"a", "b", "c"};
           String[] stringArray2 = new String[]{"1", "2", "3"};
  -        joinedArray = ArrayUtils.join(stringArray1, null);
  +        joinedArray = ArrayUtils.addAll(stringArray1, null);
           assertArraysEquals(stringArray1, joinedArray);
           assertArraysEquals(new String[]{"a", "b", "c"}, joinedArray);
           assertEquals(String.class, joinedArray.getClass().getComponentType());
  -        joinedArray = ArrayUtils.join(null, stringArray2);
  +        joinedArray = ArrayUtils.addAll(null, stringArray2);
           assertArraysEquals(stringArray2, joinedArray);
           assertArraysEquals(new String[]{"1", "2", "3"}, joinedArray);
           assertEquals(String.class, joinedArray.getClass().getComponentType());
  -        joinedArray = ArrayUtils.join(stringArray1, stringArray2);
  +        joinedArray = ArrayUtils.addAll(stringArray1, stringArray2);
           assertArraysEquals(new String[]{"a", "b", "c", "1", "2", "3"}, joinedArray);
           assertEquals(String.class, joinedArray.getClass().getComponentType());
  -        joinedArray = ArrayUtils.join(ArrayUtils.EMPTY_STRING_ARRAY, null);
  +        joinedArray = ArrayUtils.addAll(ArrayUtils.EMPTY_STRING_ARRAY, null);
           assertArraysEquals(ArrayUtils.EMPTY_STRING_ARRAY, joinedArray);
           assertArraysEquals(new String[]{}, joinedArray);
           assertEquals(String.class, joinedArray.getClass().getComponentType());
  -        joinedArray = ArrayUtils.join(null, ArrayUtils.EMPTY_STRING_ARRAY);
  +        joinedArray = ArrayUtils.addAll(null, ArrayUtils.EMPTY_STRING_ARRAY);
           assertArraysEquals(ArrayUtils.EMPTY_STRING_ARRAY, joinedArray);
           assertArraysEquals(new String[]{}, joinedArray);
           assertEquals(String.class, joinedArray.getClass().getComponentType());
  -        joinedArray = ArrayUtils.join(ArrayUtils.EMPTY_STRING_ARRAY, ArrayUtils.EMPTY_STRING_ARRAY);
  +        joinedArray = ArrayUtils.addAll(ArrayUtils.EMPTY_STRING_ARRAY, ArrayUtils.EMPTY_STRING_ARRAY);
           assertArraysEquals(ArrayUtils.EMPTY_STRING_ARRAY, joinedArray);
           assertArraysEquals(new String[]{}, joinedArray);
           assertEquals(String.class, joinedArray.getClass().getComponentType());
           String[] stringArrayNull = new String []{null};
  -        joinedArray = ArrayUtils.join(stringArrayNull, stringArrayNull);        
  +        joinedArray = ArrayUtils.addAll(stringArrayNull, stringArrayNull);        
           assertArraysEquals(new String[]{null, null}, joinedArray);
           assertEquals(String.class, joinedArray.getClass().getComponentType());
       }    
  
  
  
  1.39      +15 -15    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.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- ArrayUtils.java	31 Jan 2004 09:57:39 -0000	1.38
  +++ ArrayUtils.java	31 Jan 2004 20:12:16 -0000	1.39
  @@ -2753,26 +2753,26 @@
       }
   
       /**
  -     * <p>Joins the elements of the provided arrays into a single new array.</p>
  -     * <p>The new array contains all of the element of the first array followed
  -     * by all of the elements from the second array.</p>
  +     * <p>Adds all the elements of the provided arrays into a new array.</p>
  +     * <p>The new array contains all of the element of <code>array1</code>
followed
  +     * by all of the elements <code>array2</code>.</p>
        *
        * <pre>
  -     * ArrayUtils.join(null, null)     = null
  -     * ArrayUtils.join(array1, null)   = array1
  -     * ArrayUtils.join(null, array2)   = array2
  -     * ArrayUtils.join([], [])         = []
  -     * ArrayUtils.join([null], [null]) = [null, null]
  -     * ArrayUtils.join(["a", "b", "c"], ["1", "2", "3"]) = ["a", "b", "c", "1", "2", "3"]
  +     * ArrayUtils.addAll(null, null)     = null
  +     * ArrayUtils.addAll(array1, null)   = array1
  +     * ArrayUtils.addAll(null, array2)   = array2
  +     * ArrayUtils.addAll([], [])         = []
  +     * ArrayUtils.addAll([null], [null]) = [null, null]
  +     * ArrayUtils.addAll(["a", "b", "c"], ["1", "2", "3"]) = ["a", "b", "c", "1", "2",
"3"]
        * </pre>
        *
  -     * @param array1  the first array of values to join together, may be null
  -     * @param array2  the second array of values to join together, may be null
  -     * @return The new joined array, <code>null</code> if null array inputs.

  -     *      The type of the joined array is the type of the first array.
  +     * @param array1  the first array whose elements are added to the new array, may be
null
  +     * @param array2  the second array whose elements are added to the new array, may be
null
  +     * @return The new array, <code>null</code> if null array inputs. 
  +     *      The type of the new array is the type of the first array.
        * @since 2.1
        */
  -    public static Object[] join(Object[] array1, Object[] array2) {
  +    public static Object[] addAll(Object[] array1, Object[] array2) {
           if (array1 == null) {
               return array2;
           } else if (array2 == null) {
  
  
  

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