public final class ArrayUtils extends Object
Constructor and Description |
---|
ArrayUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> T[] |
addUnique(T[] array,
T element)
Add unique element to the array.
|
static <T> T[] |
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 <T> int |
indexOf(T[] array,
Object element)
Return the element index in the array.
|
static <T> T[] |
remove(T[] array,
Object element)
Removes the element from the array.
|
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 addpublic 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 removepublic static <T> int indexOf(T[] array, Object element)
T
- type of the array elementarray
- arrayelement
- the element to look for.Copyright © 2014 Oracle Corporation. All rights reserved.