|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.jga.util.ArrayUtils
public class ArrayUtils
Miscellaneous utilities for working with arrays.
Copyright © 2004-2009 David A. Hall
| Nested Class Summary | |
|---|---|
static class |
ArrayUtils.ArrayIterable<T>
Iterable wrapper around a given array. |
static class |
ArrayUtils.ArrayIterator<T>
Iterates over an array of objects. |
| Constructor Summary | |
|---|---|
ArrayUtils()
|
|
| Method Summary | ||
|---|---|---|
static
|
allocate(java.lang.Class<? extends T[]> type,
int len)
Returns an uninitialized array of the given type, sized to the given length. |
|
static
|
insert(T[] arr,
int idx,
T... items)
Returns an array containing the contents of the original array with the given items inserted at the given idx. |
|
static
|
iterable(T[] ts)
Adapts the array to the Iterable interface |
|
static
|
iterate(E... arr)
Produce an ArrayIterator over the given array. |
|
static
|
remove(T[] arr,
int idx)
Returns an array containing the contents of the original array with the given position removed; the size of the resulting array will be one less than the input array |
|
static
|
remove(T[] arr,
int idx,
int count)
Returns an array containing the contents of the original array with the given positions removed; the size of the resulting array will be count less than the input array |
|
static java.lang.String |
toString(java.lang.Object[] arr)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ArrayUtils()
| Method Detail |
|---|
public static java.lang.String toString(java.lang.Object[] arr)
public static <T> T[] insert(T[] arr,
int idx,
T... items)
T - tye type of objects stored in the input arrayarr - the input arrayidx - the index at which to insert new itemsitems - the new items to be inserted.
public static <T> T[] remove(T[] arr,
int idx)
T - tye type of objects stored in the input arrayarr - the input arrayidx - the index at which to insert new items
public static <T> T[] remove(T[] arr,
int idx,
int count)
T - tye type of objects stored in the input arrayarr - the input arrayidx - the index at which to insert new items
java.lang.ArrayIndexOutOfBoundsException - if idx >= arr.length
public static <T> T[] allocate(java.lang.Class<? extends T[]> type,
int len)
T - the type of objects to be stored in the arraytype - the type of the array (ie, Array of T)len - the length of the new array
public static <E> ArrayUtils.ArrayIterator<E> iterate(E... arr)
public static <T> java.lang.Iterable<T> iterable(T[] ts)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||