|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.croftsoft.core.util.ArrayLib
public final class ArrayLib
Array manipulation for Java 1.1+.
Java 1.1 compatible.
ArrayLib2
Method Summary | |
---|---|
static int[] |
append(int[] intArray,
int i)
Appends an integer to an integer array. |
static Object[] |
append(Object[] oldArray,
Object o)
Appends an Object to an Object array. |
static boolean |
contains(Object[] objectArray,
Object o)
Determines if an array contains an equivalent object. |
static boolean |
equals(Object[] objectArray1,
Object[] objectArray2)
Compares two object arrays for equivalency. |
static int[] |
insert(int[] intArray,
int i,
int index)
Inserts an integer into an integer array at the index position. |
static Object[] |
insert(Object[] objectArray,
Object o,
int index)
Inserts an Object into an Object array at the index position. |
static void |
main(String[] args)
|
static Object[] |
prepend(Object[] oldArray,
Object o)
Prepends an Object to an Object array. |
static void |
println(Object[] objectArray)
Prints each array element to the standard output. |
static Object[] |
remove(Object[] oldArray,
int index)
Removes an Object from an Object array. |
static Object[] |
remove(Object[] oldArray,
Object o)
|
static Object[] |
removeDuplicates(Object[] array)
Removes duplicate elements from the array. |
static Object[] |
subArray(Object[] objectArray,
int startIndex)
Creates a new subarray from a larger array. |
static Object[] |
subArray(Object[] objectArray,
int startIndex,
int length)
Creates a new subarray from a larger array. |
static boolean |
test(String[] args)
|
static Object[] |
union(Object[] array1,
Object[] array2)
Returns the union of the arrays, discarding duplicates. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void main(String[] args)
public static boolean test(String[] args)
public static Object[] append(Object[] oldArray, Object o)
Example:
String [ ] stringArray
= ( String [ ] ) ArrayLib.append ( new String [ ] { }, "" );
NullArgumentException
- If either argument is null.public static int[] append(int[] intArray, int i)
intArray
- May be null.public static boolean contains(Object[] objectArray, Object o)
objectArray
- May not be null.o
- If null, function will return true if an array element is null.public static boolean equals(Object[] objectArray1, Object[] objectArray2)
A Java 1.1 version of the Java 1.2 method java.util.Arrays.equals().
public static int[] insert(int[] intArray, int i, int index)
public static Object[] insert(Object[] objectArray, Object o, int index)
Example:
String [ ] stringArray
= ( String [ ] ) ArrayLib.insert ( new String [ ] { }, "", 0 );
NullArgumentException
- If objectArray or o is null.
IndexOutOfBoundsException
- If index < 0 or index > objectArray.length.public static Object[] prepend(Object[] oldArray, Object o)
Example:
String [ ] stringArray
= ( String [ ] ) ArrayLib.prepend ( new String [ ] { }, "" );
NullArgumentException
- If either argument is null.public static void println(Object[] objectArray)
public static Object[] remove(Object[] oldArray, int index)
Example:
String [ ] stringArray
= ( String [ ] ) remove ( new String [ ] { "" }, 0 );
NullArgumentException
- If oldArray is null.
ArrayIndexOutOfBoundsException
- If index < 0 or index >= oldArray.length.public static Object[] remove(Object[] oldArray, Object o)
public static Object[] removeDuplicates(Object[] array)
public static Object[] subArray(Object[] objectArray, int startIndex, int length)
To avoid unnecessary object creation, this method returns the original array argument if the requested subarray length is the same and the startIndex is 0. That is to say, if the method arguments are such that the algorithm would have created a shallow clone, the original array is returned instead.
NullArgumentException
- If objectArray is null.
ArrayIndexOutOfBoundsException
- If startIndex, length, or startIndex + length are out of range.public static Object[] subArray(Object[] objectArray, int startIndex)
return subArray (
objectArray, startIndex, objectArray.length - startIndex );
public static Object[] union(Object[] array1, Object[] array2)
|
CroftSoft Javadoc | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |