|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.glassfish.grizzly.utils.ArrayUtils
public final class ArrayUtils
Set of utility methods to work with Arrays.
Constructor Summary | |
---|---|
ArrayUtils()
|
Method Summary | ||
---|---|---|
static
|
addUnique(T[] array,
T element)
Add unique element to the array. |
|
static
|
addUnique(T[] array,
T element,
boolean replaceElementIfEquals)
Add unique element to the array. |
|
static int |
binarySearch(int[] a,
int fromIndex,
int toIndex,
int key)
|
|
static
|
indexOf(T[] array,
Object element)
Return the element index in the array. |
|
static
|
remove(T[] array,
Object element)
Removes the element from the array. |
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 int binarySearch(int[] a, int fromIndex, int toIndex, int key)
public static <T> T[] addUnique(T[] array, T element)
T
- type of the array elementarray
- arrayelement
- element to add
public static <T> T[] addUnique(T[] array, T element, boolean replaceElementIfEquals)
T
- type of the array elementarray
- arrayelement
- element to addreplaceElementIfEquals
- if passed element is equal to some element
in the array then depending on this parameter it will be
replaced or not with the passed element.
public static <T> T[] remove(T[] array, Object element)
T
- type of the array elementarray
- arrayelement
- the element to remove
public static <T> int indexOf(T[] array, Object element)
T
- type of the array elementarray
- arrayelement
- the element to look for.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |