|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.drools.core.util.ArrayUtils
public class ArrayUtils
Taken from commons lang
Operations on arrays, primitive arrays (like int[]
) and
primitive wrapper arrays (like Integer[]
).
This class tries to handle null
input gracefully.
An exception will not be thrown for a null
array input. However, an Object array that contains a null
element may throw an exception. Each method documents its behaviour.
Field Summary | |
---|---|
static int |
INDEX_NOT_FOUND
|
Constructor Summary | |
---|---|
ArrayUtils()
|
Method Summary | |
---|---|
static List<Integer> |
asList(int[] ints)
|
static boolean |
contains(Object[] array,
Object objectToFind)
Checks if the object is in the given array. |
static Object[] |
copyOf(Object[] original,
int newLength,
Class newType)
|
static boolean |
deepEquals(Object[] a1,
Object[] a2)
|
static boolean |
equals(boolean[] a,
boolean[] a2)
|
static boolean |
equals(byte[] a,
byte[] a2)
|
static boolean |
equals(char[] a,
char[] a2)
|
static boolean |
equals(double[] a,
double[] a2)
|
static boolean |
equals(float[] a,
float[] a2)
|
static boolean |
equals(int[] a,
int[] a2)
|
static boolean |
equals(long[] a,
long[] a2)
|
static boolean |
equals(Object[] a,
Object[] a2)
|
static boolean |
equals(short[] a,
short[] a2)
|
static int |
hashCode(Object[] array)
|
static int |
indexOf(Object[] array,
Object objectToFind)
Finds the index of the given object in the array. |
static int |
indexOf(Object[] array,
Object objectToFind,
int startIndex)
Finds the index of the given object in the array starting at the given index. |
static int[] |
toIntArray(List<Integer> list)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int INDEX_NOT_FOUND
Constructor Detail |
---|
public ArrayUtils()
Method Detail |
---|
public static boolean contains(Object[] array, Object objectToFind)
Checks if the object is in the given array.
The method returns false
if a null
array is passed in.
array
- the array to search throughobjectToFind
- the object to find
true
if the array contains the objectpublic static int indexOf(Object[] array, Object objectToFind)
Finds the index of the given object in the array.
This method returns INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to search through for the object, may be null
objectToFind
- the object to find, may be null
INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int indexOf(Object[] array, Object objectToFind, int startIndex)
Finds the index of the given object in the array starting at the given index.
This method returns INDEX_NOT_FOUND
(-1
) for a null
input array.
A negative startIndex is treated as zero. A startIndex larger than the array
length will return INDEX_NOT_FOUND
(-1
).
array
- the array to search through for the object, may be null
objectToFind
- the object to find, may be null
startIndex
- the index to start searching at
INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int hashCode(Object[] array)
public static Object[] copyOf(Object[] original, int newLength, Class newType)
public static boolean deepEquals(Object[] a1, Object[] a2)
public static boolean equals(long[] a, long[] a2)
public static boolean equals(int[] a, int[] a2)
public static boolean equals(short[] a, short[] a2)
public static boolean equals(char[] a, char[] a2)
public static boolean equals(byte[] a, byte[] a2)
public static boolean equals(boolean[] a, boolean[] a2)
public static boolean equals(double[] a, double[] a2)
public static boolean equals(float[] a, float[] a2)
public static boolean equals(Object[] a, Object[] a2)
public static List<Integer> asList(int[] ints)
public static int[] toIntArray(List<Integer> list)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |