net.israfil.foundation.collections
Class ArrayUtils
java.lang.Object
net.israfil.foundation.collections.ArrayUtils
public class ArrayUtils
- extends java.lang.Object
An array utility class. This class is generic, so its usage is similar
to the following:
Foo[] foo1 = new Foo[]{ aFoo, bFoo, cFoo };
Foo[] foo2 = new Foo[]{ dFoo, eFoo, fFoo };
Foo[] fooResult = new ArrayUtils<Foo>().add(new Foo[],foo1,foo2);
fooResult would be equivalent: new Foo[]{ aFoo, bFoo, cFoo, dFoo, eFoo, fFoo }
This util is mostly helpful for putting together large batches of like
arrays into a long single array, such as large groups of parameter lists
or whatever.
- Author:
- Christian Edward Gruber
|
Method Summary |
static java.lang.Object[] |
aggregate(java.lang.Object[] resultBucket,
java.lang.Object[][] arrays)
Adds arrays of like type creating a new array containing
all elements of the added arrays. |
static java.lang.String[] |
aggregate(java.lang.String[][] sArrays)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ArrayUtils
public ArrayUtils()
aggregate
public static java.lang.Object[] aggregate(java.lang.Object[] resultBucket,
java.lang.Object[][] arrays)
- Adds arrays of like type creating a new array containing
all elements of the added arrays. Note that you have to
pass in a typed array, because you can't create an array
from a generic type in the code.
- Parameters:
resultBucket - An array of the type you are attempting to aggregate. Can be empty. If it has sufficient space, it will be used for the aggregated result.arrays - The arrays to be aggregated.
- Returns:
- An array of the provided type, containing the aggregated contents of the provided arrays.
aggregate
public static java.lang.String[] aggregate(java.lang.String[][] sArrays)
Copyright © 2003-2006. All Rights Reserved.