|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.gjt.rec.util.Arrayz
A toolbox full of tools for manupulating arrays.
Arrays
Field Summary | |
static String |
REVISION
|
Method Summary | |
static Object |
add(Object array,
Object element)
Appends a partciular element to a particular array. |
static boolean |
contains(Object array,
Object element)
Checks for the presence of a particular element in a particular array. |
static boolean |
equals(Object firstArray,
Object secondArray)
Compares two arrays to see if they are equal. |
static void |
fill(Object array,
Object value)
Fills an array with a particular value. |
static int |
indexOf(Object array,
Object element)
Scans a particular array for the presence of a particular element. |
static boolean |
isEmpty(Object array)
Determines if there are any elements in a particular array. |
static int |
lastIndexOf(Object array,
Object element)
Scans a particular array for the presence of a particular element. |
static Object |
remove(Object array,
int index)
Removes the element at a particular index from a particular array. |
static int |
size(Object array)
Finds the number of elements in a particular array. |
static Object |
subList(Object array,
int fromIndex,
int toIndex)
Creates a new array containing all elements in a particular array from a particular index up to but not including a particular end index. |
static String |
toString(Object array)
Invoking toString on an array doesn't tell you anything about what is in the array. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String REVISION
Method Detail |
public static int size(Object array)
array
- the array in which to count the elements.
IllegalArgumentException
- if the object supplied as an array is
not an array.public static boolean isEmpty(Object array)
array
- the array in which to count the elements.
IllegalArgumentException
- if the object supplied as an array is
not an array.public static boolean contains(Object array, Object element)
.equals(Object)
.
array
- the array in which to look for the element.element
- the element to try to find in the array.
IllegalArgumentException
- if the object supplied as an array is
not an array.public static int indexOf(Object array, Object element)
.equals(Object)
.
array
- the array in which to look for the element.element
- the element to try to find in the array.
-1
if no such element was found.
IllegalArgumentException
- if the object supplied as an array is
not an array.public static int lastIndexOf(Object array, Object element)
.equals(Object)
.
array
- the array in which to look for the element.element
- the element to try to find in the array.
-1
if no such element was found.
IllegalArgumentException
- if the object supplied as an array is
not an array.public static Object subList(Object array, int fromIndex, int toIndex)
array
- the array from which to take the elements.fromIndex
- the index of the first element to copy in to the new
array.
IllegalArgumentException
- if the object supplied as an array is
not an array.
ArrayIndexOutOfBoundsException
- if toIndex < fromIndex or if
fromIndex < 0 or if the array
size < toIndex.public static Object add(Object array, Object element)
array
- the array to append the element to. if this argument is
null then a new array will be created.
IllegalArgumentException
- if the object supplied for the first
argument is not an array or if the
element to append is the wrong type
for the array.public static Object remove(Object array, int index)
array
- the array to remove the element from.index
- the index of the element to remove.
IllegalArgumentException
- if the object supplied as an array is
not an array or is null.
ArrayIndexOutOfBoundsException
- if the supplied index is out of
range for the supplied array.public static boolean equals(Object firstArray, Object secondArray)
.equals(Object)
.
firstArray
- the first of the two arrays to compare or null.secondArray
- the second of the two arrays to compare or null.
IllegalArgumentException
- if either of the supplied arguments
are not arrays.public static String toString(Object array)
Arrayz.toString(array)
instead, results
in far more information.
array
- the array to work out a toString() for.
IllegalArgumentException
- if the object supplied as an array is
not an array.public static void fill(Object array, Object value)
array
- the array to fill.value
- the value to fill the array with.
IllegalArgumentException
- if the object supplied as an array is
not an array.
NullPointerException
- if array is null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |