cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang ArrayUtils.java

2004-07-27 Thread ggregory
ggregory2004/07/27 14:10:34

  Modified:lang/src/java/org/apache/commons/lang ArrayUtils.java
  Log:
  Javadoc.
  
  Revision  ChangesPath
  1.45  +6 -6  
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.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- ArrayUtils.java   6 Jun 2004 03:53:23 -   1.44
  +++ ArrayUtils.java   27 Jul 2004 21:10:33 -  1.45
  @@ -2869,9 +2869,9 @@
   }
   
   /**
  - * Adds all the elements of the provided arrays into a new array.
  + * Adds all the elements of the given arrays into a new array.
* The new array contains all of the element of array1 followed
  - * by all of the elements array2. If an array is returned, it is 
always
  + * by all of the elements array2. When an array is returned, it is 
always
* a new array.
*
* 
  @@ -2883,9 +2883,9 @@
* ArrayUtils.addAll(["a", "b", "c"], ["1", "2", "3"]) = ["a", "b", "c", "1", 
"2", "3"]
* 
*
  - * @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, null if null array inputs. 
  + * @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, null if null array inputs. 
*  The type of the new array is the type of the first array.
* @since 2.1
*/
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang ArrayUtils.java

2004-02-03 Thread ggregory
ggregory2004/02/03 14:14:24

  Modified:lang/src/test/org/apache/commons/lang ArrayUtilsTest.java
LangTestSuite.java
   lang/src/java/org/apache/commons/lang ArrayUtils.java
  Added:   lang/src/test/org/apache/commons/lang ArrayUtilsAddTest.java
  Log:
  Bugzilla Bug 26056 [lang] Add methods to ArrayUtils: add at end and insert-like ops
  Added methods: primitiveType[] add(primitiveType[], primitiveType)
  
  Revision  ChangesPath
  1.24  +1 -98 
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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- ArrayUtilsTest.java   31 Jan 2004 20:12:15 -  1.23
  +++ ArrayUtilsTest.java   3 Feb 2004 22:14:24 -   1.24
  @@ -111,103 +111,6 @@
   assertEquals(false, Modifier.isFinal(ArrayUtils.class.getModifiers()));
   }
   
  -void assertArraysEquals(Object[] array1, Object[] array2) {
  -assertTrue(Arrays.equals(array1, array2));
  -}
  -
  -public void testJoin() {
  -assertNull(ArrayUtils.addAll(null, null));
  -Object[] joinedArray;
  -String[] stringArray1 = new String[]{"a", "b", "c"};
  -String[] stringArray2 = new String[]{"1", "2", "3"};
  -joinedArray = ArrayUtils.addAll(stringArray1, null);
  -assertArraysEquals(stringArray1, joinedArray);
  -assertArraysEquals(new String[]{"a", "b", "c"}, joinedArray);
  -assertEquals(String.class, joinedArray.getClass().getComponentType());
  -joinedArray = ArrayUtils.addAll(null, stringArray2);
  -assertArraysEquals(stringArray2, joinedArray);
  -assertArraysEquals(new String[]{"1", "2", "3"}, joinedArray);
  -assertEquals(String.class, joinedArray.getClass().getComponentType());
  -joinedArray = ArrayUtils.addAll(stringArray1, stringArray2);
  -assertArraysEquals(new String[]{"a", "b", "c", "1", "2", "3"}, joinedArray);
  -assertEquals(String.class, joinedArray.getClass().getComponentType());
  -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.addAll(null, ArrayUtils.EMPTY_STRING_ARRAY);
  -assertArraysEquals(ArrayUtils.EMPTY_STRING_ARRAY, joinedArray);
  -assertArraysEquals(new String[]{}, joinedArray);
  -assertEquals(String.class, joinedArray.getClass().getComponentType());
  -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.addAll(stringArrayNull, stringArrayNull);
  -assertArraysEquals(new String[]{null, null}, joinedArray);
  -assertEquals(String.class, joinedArray.getClass().getComponentType());
  -}
  -
  -public void testAddObjectArrayObject() {
  -Object[] joinedArray;
  -joinedArray = ArrayUtils.add((Object[])null, null);
  -assertArraysEquals(new Object[]{null}, joinedArray);
  -assertEquals(Object.class, joinedArray.getClass().getComponentType());
  -joinedArray = ArrayUtils.add((Object[])null, "a");
  -assertArraysEquals(new String[]{"a"}, joinedArray);
  -assertArraysEquals(new Object[]{"a"}, joinedArray);
  -assertEquals(String.class, joinedArray.getClass().getComponentType());
  -String[] stringArray1 = new String[]{"a", "b", "c"};
  -joinedArray = ArrayUtils.add(stringArray1, null);
  -assertArraysEquals(new String[]{"a", "b", "c", null}, joinedArray);
  -assertEquals(String.class, joinedArray.getClass().getComponentType());
  -joinedArray = ArrayUtils.add(stringArray1, "d");
  -assertArraysEquals(new String[]{"a", "b", "c", "d"}, joinedArray);
  -assertEquals(String.class, joinedArray.getClass().getComponentType());  
  
  -}
  -
  -public void testAddAtIndex() {
  -Object[] joinedArray;
  -joinedArray = ArrayUtils.add((Object[])null, 0, null);
  -assertArraysEquals(new Object[]{null}, joinedArray);
  -assertEquals(Object.class, joinedArray.getClass().getComponentType());
  -joinedArray = ArrayUtils.add((Object[])null, 0, "a");
  -assertA

RE: cvs commit: jakarta-commons/lang/src/java/org/apache/commons/ lang ArrayUtils.java

2004-01-31 Thread Gary Gregory
It does not matter /that/ much to me and I just wanted to record my opinion,
that is all, no biggie.

I still would like to know if JDiff can figure out changes without being
confused by method order changes.

Gary

> -Original Message-
> From: Stephen Colebourne [mailto:[EMAIL PROTECTED]
> Sent: Saturday, January 31, 2004 13:27
> To: Jakarta Commons Developers List
> Subject: Re: cvs commit: jakarta-commons/lang/src/java/org/apache/commons/
> lang ArrayUtils.java
> 
> From: "Martin Cooper" <[EMAIL PROTECTED]>
> > On Sat, 31 Jan 2004, Gary Gregory wrote:
> > > Well I guess we'll just agree to disagree ;-)
> >
> > Perhaps, but a veto is still a veto.
> Gary could argue for it and try to convince me, but as I felt he'd fail, I
> shortened things a little ;-)
> Stephen
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


Re: cvs commit: jakarta-commons/lang/src/java/org/apache/commons/ lang ArrayUtils.java

2004-01-31 Thread Stephen Colebourne
From: "Martin Cooper" <[EMAIL PROTECTED]>
> On Sat, 31 Jan 2004, Gary Gregory wrote:
> > Well I guess we'll just agree to disagree ;-)
>
> Perhaps, but a veto is still a veto.
Gary could argue for it and try to convince me, but as I felt he'd fail, I
shortened things a little ;-)
Stephen


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: cvs commit: jakarta-commons/lang/src/java/org/apache/commons/ lang ArrayUtils.java

2004-01-31 Thread Martin Cooper
On Sat, 31 Jan 2004, Gary Gregory wrote:

> Hi Stephen,
>
> Well I guess we'll just agree to disagree ;-)

Perhaps, but a veto is still a veto.

Also, given that you're using Eclipse, is really doesn't matter what order
the methods are in, because you can navigate to them so easily anyway.

--
Martin Cooper


>
> >From my POV the simplest layout is best, the one that required my (small)
> brain the least cycles to figure out, which to me is AB, rather than paging
> up and down and - god forbid - think.
>
> Good point WRT deltas b/w versions as far as raw text but would not JDiff
> handle such cases?
>
> Gary
>
> > -Original Message-
> > From: Stephen Colebourne [mailto:[EMAIL PROTECTED]
> > Sent: Saturday, January 31, 2004 01:57
> > To: Jakarta Commons Developers List
> > Subject: Re: cvs commit: jakarta-
> > commons/lang/src/java/org/apache/commons/lang ArrayUtils.java
> >
> > -1
> > An arbitrary layout based on the alphabet is unsuitable. A related methods
> > together is much better. Hashcode should be near Equals. Contains should
> > be
> > near IndexOf and LastIndexOf..
> >
> > Also, this change makes it impossible to determine what really changed
> > between versions. I want 2.0 of lang and 3.0 of collections to represent
> > that fresh start where they are actively maintained (added to/bug fixes),
> > rather than actively developed (refactored/added to/bug fixes).
> >
> > Stephen
> >
> >
> > - Original Message -
> > From: <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, January 30, 2004 2:12 AM
> > Subject: cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang
> > ArrayUtils.java
> >
> >
> > > ggregory2004/01/29 18:12:22
> > >
> > >   Modified:lang/src/java/org/apache/commons/lang ArrayUtils.java
> > >   Log:
> > >   Sort members (Eclipse defaults).
> >
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang ArrayUtils.java

2004-01-31 Thread ggregory
ggregory2004/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  ChangesPath
  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 -  1.22
  +++ ArrayUtilsTest.java   31 Jan 2004 20:12:15 -  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 -  1.38
  +++ ArrayUtils.java   31 Jan 2004 20:12:16 -  1.39
  @@ -2753,26 +2753,26 @@
   }
   
   /**
  - * Joins the elements of the provided arrays into a single new array.
  - * The new array contains all of the element of the first array followed
  - * by all of the elements from the second array.
  + * Adds all the elements of the provided arrays into a new array.
  + * The new array contains all of the element of array1 followed
  + * by all of the elements array2.
*
* 
  - * 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",

RE: cvs commit: jakarta-commons/lang/src/java/org/apache/commons/ lang ArrayUtils.java

2004-01-31 Thread Gary Gregory
Hi Stephen,

Well I guess we'll just agree to disagree ;-)

>From my POV the simplest layout is best, the one that required my (small)
brain the least cycles to figure out, which to me is AB, rather than paging
up and down and - god forbid - think.

Good point WRT deltas b/w versions as far as raw text but would not JDiff
handle such cases?

Gary

> -Original Message-
> From: Stephen Colebourne [mailto:[EMAIL PROTECTED]
> Sent: Saturday, January 31, 2004 01:57
> To: Jakarta Commons Developers List
> Subject: Re: cvs commit: jakarta-
> commons/lang/src/java/org/apache/commons/lang ArrayUtils.java
> 
> -1
> An arbitrary layout based on the alphabet is unsuitable. A related methods
> together is much better. Hashcode should be near Equals. Contains should
> be
> near IndexOf and LastIndexOf..
> 
> Also, this change makes it impossible to determine what really changed
> between versions. I want 2.0 of lang and 3.0 of collections to represent
> that fresh start where they are actively maintained (added to/bug fixes),
> rather than actively developed (refactored/added to/bug fixes).
> 
> Stephen
> 
> 
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, January 30, 2004 2:12 AM
> Subject: cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang
> ArrayUtils.java
> 
> 
> > ggregory2004/01/29 18:12:22
> >
> >   Modified:lang/src/java/org/apache/commons/lang ArrayUtils.java
> >   Log:
> >   Sort members (Eclipse defaults).
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang ArrayUtils.java

2004-01-31 Thread scolebourne
scolebourne2004/01/31 01:57:39

  Modified:lang/src/java/org/apache/commons/lang ArrayUtils.java
  Log:
  Rollback of sort of members
  
  Revision  ChangesPath
  1.38  +1656 
-1656jakarta-commons/lang/src/java/org/apache/commons/lang/ArrayUtils.java
  
  
http://cvs.apache.org/viewcvs/jakarta-commons/lang/src/java/org/apache/commons/lang/ArrayUtils.java.diff?r1=1.37&r2=1.38
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang ArrayUtils.java

2004-01-31 Thread Stephen Colebourne
-1
An arbitrary layout based on the alphabet is unsuitable. A related methods
together is much better. Hashcode should be near Equals. Contains should be
near IndexOf and LastIndexOf..

Also, this change makes it impossible to determine what really changed
between versions. I want 2.0 of lang and 3.0 of collections to represent
that fresh start where they are actively maintained (added to/bug fixes),
rather than actively developed (refactored/added to/bug fixes).

Stephen


- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 30, 2004 2:12 AM
Subject: cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang
ArrayUtils.java


> ggregory2004/01/29 18:12:22
>
>   Modified:lang/src/java/org/apache/commons/lang ArrayUtils.java
>   Log:
>   Sort members (Eclipse defaults).



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang ArrayUtils.java

2004-01-29 Thread ggregory
ggregory2004/01/29 18:12:22

  Modified:lang/src/java/org/apache/commons/lang ArrayUtils.java
  Log:
  Sort members (Eclipse defaults).
  
  Revision  ChangesPath
  1.37  +1701 
-1701jakarta-commons/lang/src/java/org/apache/commons/lang/ArrayUtils.java
  
  
http://cvs.apache.org/viewcvs/jakarta-commons/lang/src/java/org/apache/commons/lang/ArrayUtils.java.diff?r1=1.36&r2=1.37
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang ArrayUtils.java

2004-01-29 Thread ggregory
ggregory2004/01/29 17:51:36

  Modified:lang/src/java/org/apache/commons/lang ArrayUtils.java
  Log:
  Duplicate @author tags for Fredrik Westermarck.
  
  Revision  ChangesPath
  1.36  +1 -2  
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.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- ArrayUtils.java   30 Jan 2004 01:39:58 -  1.35
  +++ ArrayUtils.java   30 Jan 2004 01:51:36 -  1.36
  @@ -80,7 +80,6 @@
* @author Pete Gieser
* @author Gary Gregory
* @author mailto:[EMAIL PROTECTED]">Ashwin S
  - * @author Fredrik Westermarck
* @since 2.0
* @version $Id$
*/
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang ArrayUtils.java

2004-01-29 Thread ggregory
ggregory2004/01/29 17:39:58

  Modified:lang/src/test/org/apache/commons/lang ArrayUtilsTest.java
   lang/src/java/org/apache/commons/lang ArrayUtils.java
  Log:
  Three new methods and unit tests: add(Object[],Object), add(Object[],int,Object), 
and join(Object[],Object[]).
  PR: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26056
  Submitted by: Gary Gregory and Maarten Coene
  Reviewed by:  Gary Gregory
  
  Revision  ChangesPath
  1.22  +98 -1 
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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ArrayUtilsTest.java   19 Jan 2004 22:55:05 -  1.21
  +++ ArrayUtilsTest.java   30 Jan 2004 01:39:57 -  1.22
  @@ -111,6 +111,103 @@
   assertEquals(false, Modifier.isFinal(ArrayUtils.class.getModifiers()));
   }
   
  +void assertArraysEquals(Object[] array1, Object[] array2) {
  +assertTrue(Arrays.equals(array1, array2));
  +}
  +
  +public void testJoin() {
  +assertNull(ArrayUtils.join(null, null));
  +Object[] joinedArray;
  +String[] stringArray1 = new String[]{"a", "b", "c"};
  +String[] stringArray2 = new String[]{"1", "2", "3"};
  +joinedArray = ArrayUtils.join(stringArray1, null);
  +assertArraysEquals(stringArray1, joinedArray);
  +assertArraysEquals(new String[]{"a", "b", "c"}, joinedArray);
  +assertEquals(String.class, joinedArray.getClass().getComponentType());
  +joinedArray = ArrayUtils.join(null, stringArray2);
  +assertArraysEquals(stringArray2, joinedArray);
  +assertArraysEquals(new String[]{"1", "2", "3"}, joinedArray);
  +assertEquals(String.class, joinedArray.getClass().getComponentType());
  +joinedArray = ArrayUtils.join(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);
  +assertArraysEquals(ArrayUtils.EMPTY_STRING_ARRAY, joinedArray);
  +assertArraysEquals(new String[]{}, joinedArray);
  +assertEquals(String.class, joinedArray.getClass().getComponentType());
  +joinedArray = ArrayUtils.join(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);
  +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);
  +assertArraysEquals(new String[]{null, null}, joinedArray);
  +assertEquals(String.class, joinedArray.getClass().getComponentType());
  +}
  +
  +public void testAddObjectArrayObject() {
  +Object[] joinedArray;
  +joinedArray = ArrayUtils.add((Object[])null, null);
  +assertArraysEquals(new Object[]{null}, joinedArray);
  +assertEquals(Object.class, joinedArray.getClass().getComponentType());
  +joinedArray = ArrayUtils.add((Object[])null, "a");
  +assertArraysEquals(new String[]{"a"}, joinedArray);
  +assertArraysEquals(new Object[]{"a"}, joinedArray);
  +assertEquals(String.class, joinedArray.getClass().getComponentType());
  +String[] stringArray1 = new String[]{"a", "b", "c"};
  +joinedArray = ArrayUtils.add(stringArray1, null);
  +assertArraysEquals(new String[]{"a", "b", "c", null}, joinedArray);
  +assertEquals(String.class, joinedArray.getClass().getComponentType());
  +joinedArray = ArrayUtils.add(stringArray1, "d");
  +assertArraysEquals(new String[]{"a", "b", "c", "d"}, joinedArray);
  +assertEquals(String.class, joinedArray.getClass().getComponentType());  
  
  +}
  +
  +public void testAddAtIndex() {
  +Object[] joinedArray;
  +joinedArray = ArrayUtils.add((Object[])null, 0, null);
  +assertArraysEquals(new Object[]{null}, joinedArray);
  +assertEquals(Object.class, joinedArray.getClass().getComponentType());
  +joinedArray = ArrayUtils.add((Object[])null, 0, "a");
  +assertArraysEquals(new String[]{"a"}, joinedA

cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang ArrayUtils.java

2004-01-24 Thread tobrien
tobrien 2004/01/24 16:09:10

  Modified:lang/src/java/org/apache/commons/lang ArrayUtils.java
  Log:
  A simple spelling fix for ArrayUtils JavaDoc on the clone(Object[] array) method
  
  Revision  ChangesPath
  1.34  +2 -2  
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.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- ArrayUtils.java   19 Jan 2004 23:24:07 -  1.33
  +++ ArrayUtils.java   25 Jan 2004 00:09:10 -  1.34
  @@ -295,7 +295,7 @@
* Shallow clones an array returning a typecast result and handling
* null.
*
  - * The objecs in the array are not cloned, thus there is no special
  + * The objects in the array are not cloned, thus there is no special
* handling for multi-dimensional arrays.
* 
* This method returns null if null array 
input.
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang ArrayUtils.java CharSetUtils.java Validate.java

2004-01-19 Thread fredrik
fredrik 2004/01/19 15:24:07

  Modified:lang/src/java/org/apache/commons/lang ArrayUtils.java
CharSetUtils.java Validate.java
  Log:
  Using ArrayUtils.isEmpty() when testing arrays.
  
  Revision  ChangesPath
  1.33  +9 -9  
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.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- ArrayUtils.java   19 Jan 2004 21:50:06 -  1.32
  +++ ArrayUtils.java   19 Jan 2004 23:24:07 -  1.33
  @@ -1765,7 +1765,7 @@
*  -1 if not found or null array input
*/
   public static int indexOf(final double[] array, final double valueToFind, int 
startIndex) {
  -if (array == null || array.length == 0) {
  +if (ArrayUtils.isEmpty(array)) {
   return -1;
   }
   if (startIndex < 0) {
  @@ -1797,7 +1797,7 @@
*  -1 if not found or null array input
*/
   public static int indexOf(final double[] array, final double valueToFind, int 
startIndex, double tolerance) {
  -if (array == null || array.length == 0) {
  +if (ArrayUtils.isEmpty(array)) {
   return -1;
   }
   if (startIndex < 0) {
  @@ -1859,7 +1859,7 @@
*  -1 if not found or null array input
*/
   public static int lastIndexOf(final double[] array, final double valueToFind, 
int startIndex) {
  -if (array == null || array.length == 0) {
  +if (ArrayUtils.isEmpty(array)) {
   return -1;
   }
   if (startIndex < 0) {
  @@ -1893,7 +1893,7 @@
*  -1 if not found or null array input
*/
   public static int lastIndexOf(final double[] array, final double valueToFind, 
int startIndex, double tolerance) {
  -if (array == null || array.length == 0) {
  +if (ArrayUtils.isEmpty(array)) {
   return -1;
   }
   if (startIndex < 0) {
  @@ -1972,7 +1972,7 @@
*  -1 if not found or null array input
*/
   public static int indexOf(final float[] array, final float valueToFind, int 
startIndex) {
  -if (array == null || array.length == 0) {
  +if (ArrayUtils.isEmpty(array)) {
   return -1;
   }
   if (startIndex < 0) {
  @@ -2015,7 +2015,7 @@
*  -1 if not found or null array input
*/
   public static int lastIndexOf(final float[] array, final float valueToFind, int 
startIndex) {
  -if (array == null || array.length == 0) {
  +if (ArrayUtils.isEmpty(array)) {
   return -1;
   }
   if (startIndex < 0) {
  @@ -2075,7 +2075,7 @@
*  -1 if not found or null array input
*/
   public static int indexOf(final boolean[] array, final boolean valueToFind, int 
startIndex) {
  -if (array == null || array.length == 0) {
  +if (ArrayUtils.isEmpty(array)) {
   return -1;
   }
   if (startIndex < 0) {
  @@ -2118,7 +2118,7 @@
*  -1 if not found or null array input
*/
   public static int lastIndexOf(final boolean[] array, final boolean valueToFind, 
int startIndex) {
  -if (array == null || array.length == 0) {
  +if (ArrayUtils.isEmpty(array)) {
   return -1;
   }
   if (startIndex < 0) {
  
  
  
  1.30  +6 -6  
jakarta-commons/lang/src/java/org/apache/commons/lang/CharSetUtils.java
  
  Index: CharSetUtils.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/CharSetUtils.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- CharSetUtils.java 4 Nov 2003 21:16:34 -   1.29
  +++ CharSetUtils.java 19 Jan 2004 23:24:07 -  1.30
  @@ -1,7 +1,7 @@
   /* 
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights
  + * Copyright (c) 2002-2004 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -154,7 +154,7 @@
* @return modified String, null if null string input
*/
   public static String squeeze(String str, String[] set) {
  -if (StringUtils.isEmpty(str) || set == null || set.length == 0) {
  +if (StringUtils.isEmpty(str) || ArrayUtils.isEmpty(set)) {
   return str;
   }
   CharSet chars = evaluateSet(set);
  @@ -220,7 +220,7 @@
* @return character count, zero if null string input
*/
   public static int count(

cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang ArrayUtils.java

2003-12-28 Thread ggregory
ggregory2003/12/28 17:08:38

  Modified:lang/src/java/org/apache/commons/lang ArrayUtils.java
  Log:
  Add missing @return tags on subarray methods.
  
  Revision  ChangesPath
  1.30  +19 -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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- ArrayUtils.java   5 Dec 2003 23:37:18 -   1.29
  +++ ArrayUtils.java   29 Dec 2003 01:08:38 -  1.30
  @@ -462,6 +462,8 @@
*  returned subarray. Undervalue (< startIndex) produces
*  empty array, overvalue (>array.length) is demoted to
*  array length.
  + * @return a new array containing the elements between
  + *  the start and end indices.
*/
   public static Object[] subarray(Object[] array, int startIndexInclusive, int 
endIndexExclusive) {
   if (array == null) {
  @@ -498,6 +500,8 @@
*  returned subarray. Undervalue (< startIndex) produces
*  empty array, overvalue (>array.length) is demoted to
*  array length.
  + * @return a new array containing the elements between
  + *  the start and end indices.
*/
   public static long[] subarray(long[] array, int startIndexInclusive, int 
endIndexExclusive) {
   if (array == null) {
  @@ -534,6 +538,8 @@
*  returned subarray. Undervalue (< startIndex) produces
*  empty array, overvalue (>array.length) is demoted to
*  array length.
  + * @return a new array containing the elements between
  + *  the start and end indices.
*/
   public static int[] subarray(int[] array, int startIndexInclusive, int 
endIndexExclusive) {
   if (array == null) {
  @@ -570,6 +576,8 @@
*  returned subarray. Undervalue (< startIndex) produces
*  empty array, overvalue (>array.length) is demoted to
*  array length.
  + * @return a new array containing the elements between
  + *  the start and end indices.
*/
   public static short[] subarray(short[] array, int startIndexInclusive, int 
endIndexExclusive) {
   if (array == null) {
  @@ -606,6 +614,8 @@
*  returned subarray. Undervalue (< startIndex) produces
*  empty array, overvalue (>array.length) is demoted to
*  array length.
  + * @return a new array containing the elements between
  + *  the start and end indices.
*/
   public static char[] subarray(char[] array, int startIndexInclusive, int 
endIndexExclusive) {
   if (array == null) {
  @@ -642,6 +652,8 @@
*  returned subarray. Undervalue (< startIndex) produces
*  empty array, overvalue (>array.length) is demoted to
*  array length.
  + * @return a new array containing the elements between
  + *  the start and end indices.
*/
   public static byte[] subarray(byte[] array, int startIndexInclusive, int 
endIndexExclusive) {
   if (array == null) {
  @@ -678,6 +690,8 @@
*  returned subarray. Undervalue (< startIndex) produces
*  empty array, overvalue (>array.length) is demoted to
*  array length.
  + * @return a new array containing the elements between
  + *  the start and end indices.
*/
   public static double[] subarray(double[] array, int startIndexInclusive, int 
endIndexExclusive) {
   if (array == null) {
  @@ -714,6 +728,8 @@
*  returned subarray. Undervalue (< startIndex) produces
*  empty array, overvalue (>array.length) is demoted to
*  array length.
  + * @return a new array containing the elements between
  + *  the start and end indices.
*/
   public static float[] subarray(float[] array, int startIndexInclusive, int 
endIndexExclusive) {
   if (array == null) {
  @@ -750,6 +766,8 @@
*  returned subarray. Undervalue (< startIndex) produces
*  empty array, overvalue (>array.length) is demoted to
*  array length.
  + * @return a new array containing the elements between
  + *  the start and end indices.
*/
   public static boolean[] subarray(boolean[] array, int startIndexInclusive, int 
endIndexExclusive) {
   if (array == null) {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang ArrayUtils.java

2003-06-25 Thread scolebourne
scolebourne2003/06/25 16:32:08

  Modified:lang/src/java/org/apache/commons/lang ArrayUtils.java
  Log:
  Add new empty array constants for number objects
  Declare variables as final
  Fix null behaviour to be null tolerant
  Javadoc null behaviour
  Fix formatting
  
  Revision  ChangesPath
  1.14  +154 -156  
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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ArrayUtils.java   20 Jun 2003 08:03:51 -  1.13
  +++ ArrayUtils.java   25 Jun 2003 23:32:08 -  1.14
  @@ -81,19 +81,37 @@
   public static final String[] EMPTY_STRING_ARRAY = new String[0];
   /** An empty immutable long array */
   public static final long[] EMPTY_LONG_ARRAY = new long[0];
  +/** An empty immutable Long array */
  +public static final Long[] EMPTY_LONG_OBJECT_ARRAY = new Long[0];
   /** An empty immutable int array */
   public static final int[] EMPTY_INT_ARRAY = new int[0];
  +/** An empty immutable Integer array */
  +public static final Integer[] EMPTY_INTEGER_OBJECT_ARRAY = new Integer[0];
   /** An empty immutable short array */
   public static final short[] EMPTY_SHORT_ARRAY = new short[0];
  +/** An empty immutable Short array */
  +public static final Short[] EMPTY_SHORT_OBJECT_ARRAY = new Short[0];
   /** An empty immutable byte array */
   public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
  +/** An empty immutable Byte array */
  +public static final Byte[] EMPTY_BYTE_OBJECT_ARRAY = new Byte[0];
   /** An empty immutable double array */
   public static final double[] EMPTY_DOUBLE_ARRAY = new double[0];
  +/** An empty immutable Double array */
  +public static final Double[] EMPTY_DOUBLE_OBJECT_ARRAY = new Double[0];
   /** An empty immutable float array */
   public static final float[] EMPTY_FLOAT_ARRAY = new float[0];
  +/** An empty immutable Float array */
  +public static final Float[] EMPTY_FLOAT_OBJECT_ARRAY = new Float[0];
   /** An empty immutable boolean array */
   public static final boolean[] EMPTY_BOOLEAN_ARRAY = new boolean[0];
  -
  +/** An empty immutable Boolean array */
  +public static final Boolean[] EMPTY_BOOLEAN_OBJECT_ARRAY = new Boolean[0];
  +/** An empty immutable char array */
  +public static final char[] EMPTY_CHAR_ARRAY = new char[0];
  +/** An empty immutable Character array */
  +public static final Character[] EMPTY_CHARACTER_OBJECT_ARRAY = new Character[0];
  +
   /**
* ArrayUtils instances should NOT be constructed in standard programming.
* Instead, the class should be used as ArrayUtils.clone(new int[] 
{2}).
  @@ -103,10 +121,9 @@
*/
   public ArrayUtils() {
   }
  -
  +
   // Basic methods handling multi-dimensional arrays
   //---
  -
   /**
* Outputs an array as a String, treating null as an empty 
array.
*
  @@ -118,10 +135,10 @@
* @param array  the array to get a toString for, may be null
* @return a String representation of the array, '{}' if null 
passed in
*/
  -public static String toString(Object array) {
  +public static String toString(final Object array) {
   return toString(array, "{}");
   }
  -
  +
   /**
* Outputs an array as a String handling nulls.
*
  @@ -134,13 +151,13 @@
* @param stringIfNull  the String to return if the array is null
* @return a String representation of the array
*/
  -public static String toString(Object array, String stringIfNull) {
  +public static String toString(final Object array, final String stringIfNull) {
   if (array == null) {
   return stringIfNull;
   }
   return new ToStringBuilder(array, 
ToStringStyle.SIMPLE_STYLE).append(array).toString();
   }
  -
  +
   /**
* Get a hashCode for an array handling multi-dimensional arrays 
correctly.
* 
  @@ -149,10 +166,10 @@
* @param array  the array to get a hashCode for, may be null
* @return a hashCode for the array
*/
  -public static int hashCode(Object array) {
  +public static int hashCode(final Object array) {
   return new HashCodeBuilder().append(array).toHashCode();
   }
  -
  +
   /**
* Compares two arrays, using equals(), handling multi-dimensional arrays
* correctly.
  @@ -163,12 +180,11 @@
* @param array2  the array to get a hashCode for, may be null
* @return true if the arrays are equal
*/
  -public static boo

cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang ArrayUtils.java

2003-06-20 Thread scolebourne
scolebourne2003/06/20 01:03:51

  Modified:lang/src/java/org/apache/commons/lang ArrayUtils.java
  Log:
  Remove unused code
  
  Revision  ChangesPath
  1.13  +1 -106
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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ArrayUtils.java   16 Jun 2003 02:28:16 -  1.12
  +++ ArrayUtils.java   20 Jun 2003 08:03:51 -  1.13
  @@ -220,111 +220,6 @@
   return map;
   }
   
  -///**
  -// * Output the array as a String.
  -// *
  -// * Multi-dimensional arrays are handled by the Object[] method.
  -// *
  -// * The format is that of Java source code, for example {1,2}.
  -// * 
  -// * @param array  the array to get a toString for, must not be 
null
  -// * @return a String representation of the array
  -// * @throws IllegalArgumentException if the array is null
  -// */
  -//public static String toString(long[] array) {
  -//return new ToStringBuilder(array, 
ToStringStyle.SIMPLE_STYLE).append(array).toString();
  -//}
  -//
  -///**
  -// * Output the array as a String.
  -// *
  -// * Multi-dimensional arrays are handled by the Object[] method.
  -// *
  -// * The format is that of Java source code, for example {1,2}.
  -// * 
  -// * @param array  the array to get a toString for, must not be 
null
  -// * @return a String representation of the array
  -// * @throws IllegalArgumentException if the array is null
  -// */
  -//public static String toString(int[] array) {
  -//return new ToStringBuilder(array, 
ToStringStyle.SIMPLE_STYLE).append(array).toString();
  -//}
  -//
  -///**
  -// * Output the array as a String.
  -// *
  -// * Multi-dimensional arrays are handled by the Object[] method.
  -// *
  -// * The format is that of Java source code, for example {1,2}.
  -// * 
  -// * @param array  the array to get a toString for, must not be 
null
  -// * @return a String representation of the array
  -// * @throws IllegalArgumentException if the array is null
  -// */
  -//public static String toString(short[] array) {
  -//return new ToStringBuilder(array, 
ToStringStyle.SIMPLE_STYLE).append(array).toString();
  -//}
  -//
  -///**
  -// * Output the array as a String.
  -// *
  -// * Multi-dimensional arrays are handled by the Object[] method.
  -// *
  -// * The format is that of Java source code, for example {1,2}.
  -// * 
  -// * @param array  the array to get a toString for, must not be 
null
  -// * @return a String representation of the array
  -// * @throws IllegalArgumentException if the array is null
  -// */
  -//public static String toString(byte[] array) {
  -//return new ToStringBuilder(array, 
ToStringStyle.SIMPLE_STYLE).append(array).toString();
  -//}
  -//
  -///**
  -// * Output the array as a String.
  -// *
  -// * Multi-dimensional arrays are handled by the Object[] method.
  -// *
  -// * The format is that of Java source code, for example {1.0,2.0}.
  -// * 
  -// * @param array  the array to get a toString for, must not be 
null
  -// * @return a String representation of the array
  -// * @throws IllegalArgumentException if the array is null
  -// */
  -//public static String toString(double[] array) {
  -//return new ToStringBuilder(array, 
ToStringStyle.SIMPLE_STYLE).append(array).toString();
  -//}
  -//
  -///**
  -// * Output the array as a String.
  -// *
  -// * Multi-dimensional arrays are handled by the Object[] method.
  -// *
  -// * The format is that of Java source code, for example {1.0,2.0}.
  -// *
  -// * @param array  the array to get a toString for, must not be 
null
  -// * @return a String representation of the array
  -// * @throws IllegalArgumentException if the array is null
  -// */
  -//public static String toString(float[] array) {
  -//return new ToStringBuilder(array, 
ToStringStyle.SIMPLE_STYLE).append(array).toString();
  -//}
  -//
  -///**
  -// * Output the array as a String.
  -// *
  -// * Multi-dimensional arrays are handled by the Object[] method.
  -// *
  -// * The format is that of Java source code, for example {true,false}.
  -// * 
  -// * @param array  the array to get a toString for, must not be 
null
  -// * @return a String representation of the array
  -// * @throws IllegalArgumentException if the array is null
  -// */
  -//public static String toString(boolean[] array) 

cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang ArrayUtils.java

2003-06-15 Thread bayard
bayard  2003/06/15 19:28:17

  Modified:lang/src/java/org/apache/commons/lang ArrayUtils.java
  Log:
  Javadoc fix.
  
  Revision  ChangesPath
  1.12  +2 -2  
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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ArrayUtils.java   9 Apr 2003 01:04:47 -   1.11
  +++ ArrayUtils.java   16 Jun 2003 02:28:16 -  1.12
  @@ -61,7 +61,7 @@
   import org.apache.commons.lang.builder.ToStringBuilder;
   import org.apache.commons.lang.builder.ToStringStyle;
   /**
  - * ArrayUtils contains utility methods for working for
  + * ArrayUtils contains utility methods for working with
* arrays.
*
* @author Stephen Colebourne
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang ArrayUtils.java

2003-03-23 Thread scolebourne
scolebourne2003/03/23 09:57:43

  Modified:lang/src/java/org/apache/commons/lang ArrayUtils.java
  Log:
  Remove reverseArray as reverse already exists!
  
  Revision  ChangesPath
  1.10  +1 -22 
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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ArrayUtils.java   23 Mar 2003 04:58:47 -  1.9
  +++ ArrayUtils.java   23 Mar 2003 17:57:42 -  1.10
  @@ -1012,25 +1012,4 @@
   return (indexOf(array, objectToFind) != -1);
   }
   
  -/**
  - * Reverses an array.
  - *
  - * TAKEN FROM CollectionsUtils.
  - *
  - * @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++;
  -}
  -}
  -
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang ArrayUtils.java

2002-10-13 Thread scolebourne

scolebourne2002/10/13 15:42:06

  Added:   lang/src/java/org/apache/commons/lang ArrayUtils.java
  Log:
  Initial version of ArrayUtils, includes toMap
  
  Revision  ChangesPath
  1.1  
jakarta-commons/lang/src/java/org/apache/commons/lang/ArrayUtils.java
  
  Index: ArrayUtils.java
  ===
  /* 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *notice, this list of conditions and the following disclaimer in
   *the documentation and/or other materials provided with the
   *distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *any, must include the following acknowlegement:
   *   "This product includes software developed by the
   *Apache Software Foundation (http://www.apache.org/)."
   *Alternately, this acknowlegement may appear in the software itself,
   *if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *Foundation" must not be used to endorse or promote products derived
   *from this software without prior written permission. For written
   *permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *nor may "Apache" appear in their names without prior written
   *permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * 
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * .
   */
  package org.apache.commons.lang;
  
  import java.util.HashMap;
  import java.util.Map;
  
  import org.apache.commons.lang.builder.ToStringBuilder;
  import org.apache.commons.lang.builder.ToStringStyle;
  /**
   * ArrayUtils contains utility methods for working for
   * arrays.
   *
   * @author mailto:[EMAIL PROTECTED]";>Stephen Colebourne
   * @author Moritz Petersen
   * @version $Id: ArrayUtils.java,v 1.1 2002/10/13 22:42:06 scolebourne Exp $
   */
  public class ArrayUtils {
  
  /** An empty immutable object array */
  public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
  /** An empty immutable class array */
  public static final Class[] EMPTY_CLASS_ARRAY = new Class[0];
  /** An empty immutable string array */
  public static final String[] EMPTY_STRING_ARRAY = new String[0];
  /** An empty immutable long array */
  public static final long[] EMPTY_LONG_ARRAY = new long[0];
  /** An empty immutable int array */
  public static final int[] EMPTY_INT_ARRAY = new int[0];
  /** An empty immutable short array */
  public static final short[] EMPTY_SHORT_ARRAY = new short[0];
  /** An empty immutable byte array */
  public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
  /** An empty immutable double array */
  public static final double[] EMPTY_DOUBLE_ARRAY = new double[0];
  /** An empty immutable float array */
  public static final float[] EMPTY_FLOAT_ARRAY = new float[0];
  /** An empty immutable boolean array */
  public static final boolean[] EMPTY_BOOLEAN_ARRAY = new boolean[0];
  
  /**
   * ArrayUtils instances should NOT be constructed in standard programming.
   * Instead, the class should be used as ArrayUtils.clone(new int[] 
{2}).
   * This constructor is public to permit tools that re