org.apache.commons.lang

Class ArrayUtils


public class ArrayUtils
extends Object

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.

Since:
2.0

Field Summary

static boolean[]
EMPTY_BOOLEAN_ARRAY
An empty immutable boolean array.
static Boolean[]
EMPTY_BOOLEAN_OBJECT_ARRAY
An empty immutable Boolean array.
static byte[]
EMPTY_BYTE_ARRAY
An empty immutable byte array.
static Byte[]
EMPTY_BYTE_OBJECT_ARRAY
An empty immutable Byte array.
static Character[]
EMPTY_CHARACTER_OBJECT_ARRAY
An empty immutable Character array.
static char[]
EMPTY_CHAR_ARRAY
An empty immutable char array.
static Class<T>[]
EMPTY_CLASS_ARRAY
An empty immutable Class array.
static double[]
EMPTY_DOUBLE_ARRAY
An empty immutable double array.
static Double[]
EMPTY_DOUBLE_OBJECT_ARRAY
An empty immutable Double array.
static float[]
EMPTY_FLOAT_ARRAY
An empty immutable float array.
static Float[]
EMPTY_FLOAT_OBJECT_ARRAY
An empty immutable Float array.
static Integer[]
EMPTY_INTEGER_OBJECT_ARRAY
An empty immutable Integer array.
static int[]
EMPTY_INT_ARRAY
An empty immutable int array.
static long[]
EMPTY_LONG_ARRAY
An empty immutable long array.
static Long[]
EMPTY_LONG_OBJECT_ARRAY
An empty immutable Long array.
static Object[]
EMPTY_OBJECT_ARRAY
An empty immutable Object array.
static short[]
EMPTY_SHORT_ARRAY
An empty immutable short array.
static Short[]
EMPTY_SHORT_OBJECT_ARRAY
An empty immutable Short array.
static String[]
EMPTY_STRING_ARRAY
An empty immutable String array.
static int
INDEX_NOT_FOUND
The index value when an element is not found in a list or array: -1.

Constructor Summary

ArrayUtils()
ArrayUtils instances should NOT be constructed in standard programming.

Method Summary

static boolean[]
add(boolean[] array, boolean element)
Copies the given array and adds the given element at the end of the new array.
static boolean[]
add(boolean[] array, int index, boolean element)
Inserts the specified element at the specified position in the array.
static byte[]
add(byte[] array, byte element)
Copies the given array and adds the given element at the end of the new array.
static byte[]
add(byte[] array, int index, byte element)
Inserts the specified element at the specified position in the array.
static char[]
add(char[] array, char element)
Copies the given array and adds the given element at the end of the new array.
static char[]
add(char[] array, int index, char element)
Inserts the specified element at the specified position in the array.
static double[]
add(double[] array, double element)
Copies the given array and adds the given element at the end of the new array.
static double[]
add(double[] array, int index, double element)
Inserts the specified element at the specified position in the array.
static float[]
add(float[] array, float element)
Copies the given array and adds the given element at the end of the new array.
static float[]
add(float[] array, int index, float element)
Inserts the specified element at the specified position in the array.
static int[]
add(int[] array, int element)
Copies the given array and adds the given element at the end of the new array.
static int[]
add(int[] array, int index, int element)
Inserts the specified element at the specified position in the array.
static Object[]
add(Object[] array, int index, Object element)
Inserts the specified element at the specified position in the array.
static Object[]
add(Object[] array, Object element)
Copies the given array and adds the given element at the end of the new array.
static long[]
add(long[] array, int index, long element)
Inserts the specified element at the specified position in the array.
static long[]
add(long[] array, long element)
Copies the given array and adds the given element at the end of the new array.
static short[]
add(short[] array, int index, short element)
Inserts the specified element at the specified position in the array.
static short[]
add(short[] array, short element)
Copies the given array and adds the given element at the end of the new array.
static boolean[]
addAll(boolean[] array1, boolean[] array2)
Adds all the elements of the given arrays into a new array.
static byte[]
addAll(byte[] array1, byte[] array2)
Adds all the elements of the given arrays into a new array.
static char[]
addAll(char[] array1, char[] array2)
Adds all the elements of the given arrays into a new array.
static double[]
addAll(double[] array1, double[] array2)
Adds all the elements of the given arrays into a new array.
static float[]
addAll(float[] array1, float[] array2)
Adds all the elements of the given arrays into a new array.
static int[]
addAll(int[] array1, int[] array2)
Adds all the elements of the given arrays into a new array.
static Object[]
addAll(Object[] array1, Object[] array2)
Adds all the elements of the given arrays into a new array.
static long[]
addAll(long[] array1, long[] array2)
Adds all the elements of the given arrays into a new array.
static short[]
addAll(short[] array1, short[] array2)
Adds all the elements of the given arrays into a new array.
static boolean[]
clone(boolean[] array)
Clones an array returning a typecast result and handling null.
static byte[]
clone(byte[] array)
Clones an array returning a typecast result and handling null.
static char[]
clone(char[] array)
Clones an array returning a typecast result and handling null.
static double[]
clone(double[] array)
Clones an array returning a typecast result and handling null.
static float[]
clone(float[] array)
Clones an array returning a typecast result and handling null.
static int[]
clone(int[] array)
Clones an array returning a typecast result and handling null.
static Object[]
clone(Object[] array)
Shallow clones an array returning a typecast result and handling null.
static long[]
clone(long[] array)
Clones an array returning a typecast result and handling null.
static short[]
clone(short[] array)
Clones an array returning a typecast result and handling null.
static boolean
contains(boolean[] array, boolean valueToFind)
Checks if the value is in the given array.
static boolean
contains(byte[] array, byte valueToFind)
Checks if the value is in the given array.
static boolean
contains(char[] array, char valueToFind)
Checks if the value is in the given array.
static boolean
contains(double[] array, double valueToFind)
Checks if the value is in the given array.
static boolean
contains(double[] array, double valueToFind, double tolerance)
Checks if a value falling within the given tolerance is in the given array.
static boolean
contains(float[] array, float valueToFind)
Checks if the value is in the given array.
static boolean
contains(int[] array, int valueToFind)
Checks if the value is in the given array.
static boolean
contains(Object[] array, Object objectToFind)
Checks if the object is in the given array.
static boolean
contains(long[] array, long valueToFind)
Checks if the value is in the given array.
static boolean
contains(short[] array, short valueToFind)
Checks if the value is in the given array.
static int
getLength(Object array)
Returns the length of the specified array.
static int
hashCode(Object array)
Get a hashCode for an array handling multi-dimensional arrays correctly.
static int
indexOf(boolean[] array, boolean valueToFind)
Finds the index of the given value in the array.
static int
indexOf(boolean[] array, boolean valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
static int
indexOf(byte[] array, byte valueToFind)
Finds the index of the given value in the array.
static int
indexOf(byte[] array, byte valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
static int
indexOf(char[] array, char valueToFind)
Finds the index of the given value in the array.
static int
indexOf(char[] array, char valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
static int
indexOf(double[] array, double valueToFind)
Finds the index of the given value in the array.
static int
indexOf(double[] array, double valueToFind, double tolerance)
Finds the index of the given value within a given tolerance in the array.
static int
indexOf(double[] array, double valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
static int
indexOf(double[] array, double valueToFind, int startIndex, double tolerance)
Finds the index of the given value in the array starting at the given index.
static int
indexOf(float[] array, float valueToFind)
Finds the index of the given value in the array.
static int
indexOf(float[] array, float valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
static int
indexOf(int[] array, int valueToFind)
Finds the index of the given value in the array.
static int
indexOf(int[] array, int valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
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
indexOf(long[] array, long valueToFind)
Finds the index of the given value in the array.
static int
indexOf(long[] array, long valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
static int
indexOf(short[] array, short valueToFind)
Finds the index of the given value in the array.
static int
indexOf(short[] array, short valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
static boolean
isEmpty(boolean[] array)
Checks if an array of primitive booleans is empty or null.
static boolean
isEmpty(byte[] array)
Checks if an array of primitive bytes is empty or null.
static boolean
isEmpty(char[] array)
Checks if an array of primitive chars is empty or null.
static boolean
isEmpty(double[] array)
Checks if an array of primitive doubles is empty or null.
static boolean
isEmpty(float[] array)
Checks if an array of primitive floats is empty or null.
static boolean
isEmpty(int[] array)
Checks if an array of primitive ints is empty or null.
static boolean
isEmpty(Object[] array)
Checks if an array of Objects is empty or null.
static boolean
isEmpty(long[] array)
Checks if an array of primitive longs is empty or null.
static boolean
isEmpty(short[] array)
Checks if an array of primitive shorts is empty or null.
static boolean
isEquals(Object array1, Object array2)
Compares two arrays, using equals(), handling multi-dimensional arrays correctly.
static boolean
isSameLength(boolean[] array1, boolean[] array2)
Checks whether two arrays are the same length, treating null arrays as length 0.
static boolean
isSameLength(byte[] array1, byte[] array2)
Checks whether two arrays are the same length, treating null arrays as length 0.
static boolean
isSameLength(char[] array1, char[] array2)
Checks whether two arrays are the same length, treating null arrays as length 0.
static boolean
isSameLength(double[] array1, double[] array2)
Checks whether two arrays are the same length, treating null arrays as length 0.
static boolean
isSameLength(float[] array1, float[] array2)
Checks whether two arrays are the same length, treating null arrays as length 0.
static boolean
isSameLength(int[] array1, int[] array2)
Checks whether two arrays are the same length, treating null arrays as length 0.
static boolean
isSameLength(Object[] array1, Object[] array2)
Checks whether two arrays are the same length, treating null arrays as length 0.
static boolean
isSameLength(long[] array1, long[] array2)
Checks whether two arrays are the same length, treating null arrays as length 0.
static boolean
isSameLength(short[] array1, short[] array2)
Checks whether two arrays are the same length, treating null arrays as length 0.
static boolean
isSameType(Object array1, Object array2)
Checks whether two arrays are the same type taking into account multi-dimensional arrays.
static int
lastIndexOf(boolean[] array, boolean valueToFind)
Finds the last index of the given value within the array.
static int
lastIndexOf(boolean[] array, boolean valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
static int
lastIndexOf(byte[] array, byte valueToFind)
Finds the last index of the given value within the array.
static int
lastIndexOf(byte[] array, byte valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
static int
lastIndexOf(char[] array, char valueToFind)
Finds the last index of the given value within the array.
static int
lastIndexOf(char[] array, char valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
static int
lastIndexOf(double[] array, double valueToFind)
Finds the last index of the given value within the array.
static int
lastIndexOf(double[] array, double valueToFind, double tolerance)
Finds the last index of the given value within a given tolerance in the array.
static int
lastIndexOf(double[] array, double valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
static int
lastIndexOf(double[] array, double valueToFind, int startIndex, double tolerance)
Finds the last index of the given value in the array starting at the given index.
static int
lastIndexOf(float[] array, float valueToFind)
Finds the last index of the given value within the array.
static int
lastIndexOf(float[] array, float valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
static int
lastIndexOf(int[] array, int valueToFind)
Finds the last index of the given value within the array.
static int
lastIndexOf(int[] array, int valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
static int
lastIndexOf(Object[] array, Object objectToFind)
Finds the last index of the given object within the array.
static int
lastIndexOf(Object[] array, Object objectToFind, int startIndex)
Finds the last index of the given object in the array starting at the given index.
static int
lastIndexOf(long[] array, long valueToFind)
Finds the last index of the given value within the array.
static int
lastIndexOf(long[] array, long valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
static int
lastIndexOf(short[] array, short valueToFind)
Finds the last index of the given value within the array.
static int
lastIndexOf(short[] array, short valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
static boolean[]
remove(boolean[] array, int index)
Removes the element at the specified position from the specified array.
static byte[]
remove(byte[] array, int index)
Removes the element at the specified position from the specified array.
static char[]
remove(char[] array, int index)
Removes the element at the specified position from the specified array.
static double[]
remove(double[] array, int index)
Removes the element at the specified position from the specified array.
static float[]
remove(float[] array, int index)
Removes the element at the specified position from the specified array.
static int[]
remove(int[] array, int index)
Removes the element at the specified position from the specified array.
static Object[]
remove(Object[] array, int index)
Removes the element at the specified position from the specified array.
static long[]
remove(long[] array, int index)
Removes the element at the specified position from the specified array.
static short[]
remove(short[] array, int index)
Removes the element at the specified position from the specified array.
static boolean[]
removeElement(boolean[] array, boolean element)
Removes the first occurrence of the specified element from the specified array.
static byte[]
removeElement(byte[] array, byte element)
Removes the first occurrence of the specified element from the specified array.
static char[]
removeElement(char[] array, char element)
Removes the first occurrence of the specified element from the specified array.
static double[]
removeElement(double[] array, double element)
Removes the first occurrence of the specified element from the specified array.
static float[]
removeElement(float[] array, float element)
Removes the first occurrence of the specified element from the specified array.
static int[]
removeElement(int[] array, int element)
Removes the first occurrence of the specified element from the specified array.
static Object[]
removeElement(Object[] array, Object element)
Removes the first occurrence of the specified element from the specified array.
static long[]
removeElement(long[] array, long element)
Removes the first occurrence of the specified element from the specified array.
static short[]
removeElement(short[] array, short element)
Removes the first occurrence of the specified element from the specified array.
static void
reverse(boolean[] array)
Reverses the order of the given array.
static void
reverse(byte[] array)
Reverses the order of the given array.
static void
reverse(char[] array)
Reverses the order of the given array.
static void
reverse(double[] array)
Reverses the order of the given array.
static void
reverse(float[] array)
Reverses the order of the given array.
static void
reverse(int[] array)
Reverses the order of the given array.
static void
reverse(Object[] array)
Reverses the order of the given array.
static void
reverse(long[] array)
Reverses the order of the given array.
static void
reverse(short[] array)
Reverses the order of the given array.
static boolean[]
subarray(boolean[] array, int startIndexInclusive, int endIndexExclusive)
Produces a new boolean array containing the elements between the start and end indices.
static byte[]
subarray(byte[] array, int startIndexInclusive, int endIndexExclusive)
Produces a new byte array containing the elements between the start and end indices.
static char[]
subarray(char[] array, int startIndexInclusive, int endIndexExclusive)
Produces a new char array containing the elements between the start and end indices.
static double[]
subarray(double[] array, int startIndexInclusive, int endIndexExclusive)
Produces a new double array containing the elements between the start and end indices.
static float[]
subarray(float[] array, int startIndexInclusive, int endIndexExclusive)
Produces a new float array containing the elements between the start and end indices.
static int[]
subarray(int[] array, int startIndexInclusive, int endIndexExclusive)
Produces a new int array containing the elements between the start and end indices.
static Object[]
subarray(Object[] array, int startIndexInclusive, int endIndexExclusive)
Produces a new array containing the elements between the start and end indices.
static long[]
subarray(long[] array, int startIndexInclusive, int endIndexExclusive)
Produces a new long array containing the elements between the start and end indices.
static short[]
subarray(short[] array, int startIndexInclusive, int endIndexExclusive)
Produces a new short array containing the elements between the start and end indices.
static Map<K,V>
toMap(Object[] array)
Converts the given array into a Map.
static Boolean[]
toObject(boolean[] array)
Converts an array of primitive booleans to objects.
static Byte[]
toObject(byte[] array)
Converts an array of primitive bytes to objects.
static Character[]
toObject(char[] array)
Converts an array of primitive chars to objects.
static Double[]
toObject(double[] array)
Converts an array of primitive doubles to objects.
static Float[]
toObject(float[] array)
Converts an array of primitive floats to objects.
static Integer[]
toObject(int[] array)
Converts an array of primitive ints to objects.
static Long[]
toObject(long[] array)
Converts an array of primitive longs to objects.
static Short[]
toObject(short[] array)
Converts an array of primitive shorts to objects.
static boolean[]
toPrimitive(Boolean[] array)
Converts an array of object Booleans to primitives.
static boolean[]
toPrimitive(Boolean[] array, boolean valueForNull)
Converts an array of object Booleans to primitives handling null.
static byte[]
toPrimitive(Byte[] array)
Converts an array of object Bytes to primitives.
static byte[]
toPrimitive(Byte[] array, byte valueForNull)
Converts an array of object Bytes to primitives handling null.
static char[]
toPrimitive(Character[] array)
Converts an array of object Characters to primitives.
static char[]
toPrimitive(Character[] array, char valueForNull)
Converts an array of object Character to primitives handling null.
static double[]
toPrimitive(Double[] array)
Converts an array of object Doubles to primitives.
static double[]
toPrimitive(Double[] array, double valueForNull)
Converts an array of object Doubles to primitives handling null.
static float[]
toPrimitive(Float[] array)
Converts an array of object Floats to primitives.
static float[]
toPrimitive(Float[] array, float valueForNull)
Converts an array of object Floats to primitives handling null.
static int[]
toPrimitive(Integer[] array)
Converts an array of object Integers to primitives.
static int[]
toPrimitive(Integer[] array, int valueForNull)
Converts an array of object Integer to primitives handling null.
static long[]
toPrimitive(Long[] array)
Converts an array of object Longs to primitives.
static long[]
toPrimitive(Long[] array, long valueForNull)
Converts an array of object Long to primitives handling null.
static short[]
toPrimitive(Short[] array)
Converts an array of object Shorts to primitives.
static short[]
toPrimitive(Short[] array, short valueForNull)
Converts an array of object Short to primitives handling null.
static String
toString(Object array)
Outputs an array as a String, treating null as an empty array.
static String
toString(Object array, String stringIfNull)
Outputs an array as a String handling nulls.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

EMPTY_BOOLEAN_ARRAY

public static final boolean[] EMPTY_BOOLEAN_ARRAY
An empty immutable boolean array.

EMPTY_BOOLEAN_OBJECT_ARRAY

public static final Boolean[] EMPTY_BOOLEAN_OBJECT_ARRAY
An empty immutable Boolean array.

EMPTY_BYTE_ARRAY

public static final byte[] EMPTY_BYTE_ARRAY
An empty immutable byte array.
Usages and Demos :

View More Examples of EMPTY_BYTE_ARRAY
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:         final WebResponseData webResponseData = new WebResponseData(
   6:                 ArrayUtils.EMPTY_BYTE_ARRAY, 404, "not found",
   7:                 Collections.EMPTY_LIST);
   8:         final WebResponse webResponse = new WebResponseImpl(webResponseData,
   9:                 URL_FIRST, SubmitMethod.GET, 10);

View Full Code Here

EMPTY_BYTE_OBJECT_ARRAY

public static final Byte[] EMPTY_BYTE_OBJECT_ARRAY
An empty immutable Byte array.

EMPTY_CHARACTER_OBJECT_ARRAY

public static final Character[] EMPTY_CHARACTER_OBJECT_ARRAY
An empty immutable Character array.

EMPTY_CHAR_ARRAY

public static final char[] EMPTY_CHAR_ARRAY
An empty immutable char array.
Usages and Demos :

View More Examples of EMPTY_CHAR_ARRAY
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.SystemUtils;
   4:         ...
   5:         if (size == 0) {
   6:             return ArrayUtils.EMPTY_CHAR_ARRAY;
   7:         }
   8:         ...
   9:         if (len == 0) {
  10:             return ArrayUtils.EMPTY_CHAR_ARRAY;
  11:         }

View Full Code Here

EMPTY_CLASS_ARRAY

public static final Class<T>[] EMPTY_CLASS_ARRAY
An empty immutable Class array.

EMPTY_DOUBLE_ARRAY

public static final double[] EMPTY_DOUBLE_ARRAY
An empty immutable double array.

EMPTY_DOUBLE_OBJECT_ARRAY

public static final Double[] EMPTY_DOUBLE_OBJECT_ARRAY
An empty immutable Double array.

EMPTY_FLOAT_ARRAY

public static final float[] EMPTY_FLOAT_ARRAY
An empty immutable float array.

EMPTY_FLOAT_OBJECT_ARRAY

public static final Float[] EMPTY_FLOAT_OBJECT_ARRAY
An empty immutable Float array.

EMPTY_INTEGER_OBJECT_ARRAY

public static final Integer[] EMPTY_INTEGER_OBJECT_ARRAY
An empty immutable Integer array.

EMPTY_INT_ARRAY

public static final int[] EMPTY_INT_ARRAY
An empty immutable int array.

EMPTY_LONG_ARRAY

public static final long[] EMPTY_LONG_ARRAY
An empty immutable long array.

EMPTY_LONG_OBJECT_ARRAY

public static final Long[] EMPTY_LONG_OBJECT_ARRAY
An empty immutable Long array.

EMPTY_OBJECT_ARRAY

public static final Object[] EMPTY_OBJECT_ARRAY
An empty immutable Object array.
Usages and Demos :

View More Examples of EMPTY_OBJECT_ARRAY
   1: 
   2: import javawebparts.core.org.apache.commons.lang.ArrayUtils;
   3: import javawebparts.core.org.apache.commons.lang.StringUtils;
   4:         ...
   5:     public static boolean isCauseMethodName(String methodName) {
   6:         return ArrayUtils.indexOf(CAUSE_METHOD_NAMES, methodName) >= 0;
   7:     }
   8:         ...
   9:             try {
  10:                 return (Throwable) method.invoke(throwable, ArrayUtils.EMPTY_OBJECT_ARRAY);
  11:             } catch (IllegalAccessException ignored) {
  12:         ...
  13:         if (throwable == null) {
  14:             return ArrayUtils.EMPTY_STRING_ARRAY;

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.ClassUtils;
   4:         ...
   5:         synchronized(CAUSE_METHOD_NAMES) {
   6:             return ArrayUtils.indexOf(CAUSE_METHOD_NAMES, methodName) >= 0;
   7:         }
   8:         ...
   9:             try {
  10:                 return (Throwable) method.invoke(throwable, ArrayUtils.EMPTY_OBJECT_ARRAY);
  11:             } catch (IllegalAccessException ignored) {
  12:         ...
  13:         if (throwable == null) {
  14:             return ArrayUtils.EMPTY_STRING_ARRAY;

View Full Code Here

EMPTY_SHORT_ARRAY

public static final short[] EMPTY_SHORT_ARRAY
An empty immutable short array.

EMPTY_SHORT_OBJECT_ARRAY

public static final Short[] EMPTY_SHORT_OBJECT_ARRAY
An empty immutable Short array.

EMPTY_STRING_ARRAY

public static final String[] EMPTY_STRING_ARRAY
An empty immutable String array.
Usages and Demos :

View More Examples of EMPTY_STRING_ARRAY
   1: import java.util.Set;
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.ClassUtils;
   4:         ...
   5:         if (collection == null) {
   6:             return ArrayUtils.EMPTY_STRING_ARRAY;
   7:         }
   8:         ...
   9:         }
  10:         return (String[]) list.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
  11:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.ClassUtils;
   4:         ...
   5:         synchronized(CAUSE_METHOD_NAMES) {
   6:             return ArrayUtils.indexOf(CAUSE_METHOD_NAMES, methodName) >= 0;
   7:         }
   8:         ...
   9:             try {
  10:                 return (Throwable) method.invoke(throwable, ArrayUtils.EMPTY_OBJECT_ARRAY);
  11:             } catch (IllegalAccessException ignored) {
  12:         ...
  13:         if (throwable == null) {
  14:             return ArrayUtils.EMPTY_STRING_ARRAY;

View Full Code Here

INDEX_NOT_FOUND

public static final int INDEX_NOT_FOUND
The index value when an element is not found in a list or array: -1. This value is returned by methods in this class and can also be used in comparisons with values returned by various method from List.
Field Value:
-1

Constructor Details

ArrayUtils

public ArrayUtils()
ArrayUtils instances should NOT be constructed in standard programming. Instead, the class should be used as ArrayUtils.clone(new int[] {2}).

This constructor is public to permit tools that require a JavaBean instance to operate.

Method Details

add

public static boolean[] add(boolean[] array,
                            boolean element)
Copies the given array and adds the given element at the end of the new array.

The new array contains the same elements of the input array plus the given element in the last position. The component type of the new array is the same as that of the input array.

If the input array is null, a new one element array is returned whose component type is the same as the element.

 ArrayUtils.add(null, true)          = [true]
 ArrayUtils.add([true], false)       = [true, false]
 ArrayUtils.add([true, false], true) = [true, false, true]
 
Parameters:
array - the array to copy and add the element to, may be null
element - the object to add at the last index of the new array
Returns:
A new array containing the existing elements plus the new element
Since:
2.1

add

public static boolean[] add(boolean[] array,
                            int index,
                            boolean element)
Inserts the specified element at the specified position in the array. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

This method returns a new array with the same elements of the input array plus the given element on the specified position. The component type of the returned array is always the same as that of the input array.

If the input array is null, a new one element array is returned whose component type is the same as the element.

 ArrayUtils.add(null, 0, true)          = [true]
 ArrayUtils.add([true], 0, false)       = [false, true]
 ArrayUtils.add([false], 1, true)       = [false, true]
 ArrayUtils.add([true, false], 1, true) = [true, true, false]
 
Parameters:
array - the array to add the element to, may be null
index - the position of the new object
element - the object to add
Returns:
A new array containing the existing elements and the new element
Throws:
IndexOutOfBoundsException - if the index is out of range (index <320 || index > array.length).

add

public static byte[] add(byte[] array,
                         byte element)
Copies the given array and adds the given element at the end of the new array.

The new array contains the same elements of the input array plus the given element in the last position. The component type of the new array is the same as that of the input array.

If the input array is null, a new one element array is returned whose component type is the same as the element.

 ArrayUtils.add(null, 0)   = [0]
 ArrayUtils.add([1], 0)    = [1, 0]
 ArrayUtils.add([1, 0], 1) = [1, 0, 1]
 
Parameters:
array - the array to copy and add the element to, may be null
element - the object to add at the last index of the new array
Returns:
A new array containing the existing elements plus the new element
Since:
2.1

add

public static byte[] add(byte[] array,
                         int index,
                         byte element)
Inserts the specified element at the specified position in the array. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

This method returns a new array with the same elements of the input array plus the given element on the specified position. The component type of the returned array is always the same as that of the input array.

If the input array is null, a new one element array is returned whose component type is the same as the element.

 ArrayUtils.add([1], 0, 2)         = [2, 1]
 ArrayUtils.add([2, 6], 2, 3)      = [2, 6, 3]
 ArrayUtils.add([2, 6], 0, 1)      = [1, 2, 6]
 ArrayUtils.add([2, 6, 3], 2, 1)   = [2, 6, 1, 3]
 
Parameters:
array - the array to add the element to, may be null
index - the position of the new object
element - the object to add
Returns:
A new array containing the existing elements and the new element
Throws:
IndexOutOfBoundsException - if the index is out of range (index <320 || index > array.length).

add

public static char[] add(char[] array,
                         char element)
Copies the given array and adds the given element at the end of the new array.

The new array contains the same elements of the input array plus the given element in the last position. The component type of the new array is the same as that of the input array.

If the input array is null, a new one element array is returned whose component type is the same as the element.

 ArrayUtils.add(null, '0')       = ['0']
 ArrayUtils.add(['1'], '0')      = ['1', '0']
 ArrayUtils.add(['1', '0'], '1') = ['1', '0', '1']
 
Parameters:
array - the array to copy and add the element to, may be null
element - the object to add at the last index of the new array
Returns:
A new array containing the existing elements plus the new element
Since:
2.1

add

public static char[] add(char[] array,
                         int index,
                         char element)
Inserts the specified element at the specified position in the array. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

This method returns a new array with the same elements of the input array plus the given element on the specified position. The component type of the returned array is always the same as that of the input array.

If the input array is null, a new one element array is returned whose component type is the same as the element.

 ArrayUtils.add(null, 0, 'a')            = ['a']
 ArrayUtils.add(['a'], 0, 'b')           = ['b', 'a']
 ArrayUtils.add(['a', 'b'], 0, 'c')      = ['c', 'a', 'b']
 ArrayUtils.add(['a', 'b'], 1, 'k')      = ['a', 'k', 'b']
 ArrayUtils.add(['a', 'b', 'c'], 1, 't') = ['a', 't', 'b', 'c']
 
Parameters:
array - the array to add the element to, may be null
index - the position of the new object
element - the object to add
Returns:
A new array containing the existing elements and the new element
Throws:
IndexOutOfBoundsException - if the index is out of range (index <320 || index > array.length).

add

public static double[] add(double[] array,
                           double element)
Copies the given array and adds the given element at the end of the new array.

The new array contains the same elements of the input array plus the given element in the last position. The component type of the new array is the same as that of the input array.

If the input array is null, a new one element array is returned whose component type is the same as the element.

 ArrayUtils.add(null, 0)   = [0]
 ArrayUtils.add([1], 0)    = [1, 0]
 ArrayUtils.add([1, 0], 1) = [1, 0, 1]
 
Parameters:
array - the array to copy and add the element to, may be null
element - the object to add at the last index of the new array
Returns:
A new array containing the existing elements plus the new element
Since:
2.1

add

public static double[] add(double[] array,
                           int index,
                           double element)
Inserts the specified element at the specified position in the array. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

This method returns a new array with the same elements of the input array plus the given element on the specified position. The component type of the returned array is always the same as that of the input array.

If the input array is null, a new one element array is returned whose component type is the same as the element.

 ArrayUtils.add([1.1], 0, 2.2)              = [2.2, 1.1]
 ArrayUtils.add([2.3, 6.4], 2, 10.5)        = [2.3, 6.4, 10.5]
 ArrayUtils.add([2.6, 6.7], 0, -4.8)        = [-4.8, 2.6, 6.7]
 ArrayUtils.add([2.9, 6.0, 0.3], 2, 1.0)    = [2.9, 6.0, 1.0, 0.3]
 
Parameters:
array - the array to add the element to, may be null
index - the position of the new object
element - the object to add
Returns:
A new array containing the existing elements and the new element
Throws:
IndexOutOfBoundsException - if the index is out of range (index <320 || index > array.length).

add

public static float[] add(float[] array,
                          float element)
Copies the given array and adds the given element at the end of the new array.

The new array contains the same elements of the input array plus the given element in the last position. The component type of the new array is the same as that of the input array.

If the input array is null, a new one element array is returned whose component type is the same as the element.

 ArrayUtils.add(null, 0)   = [0]
 ArrayUtils.add([1], 0)    = [1, 0]
 ArrayUtils.add([1, 0], 1) = [1, 0, 1]
 
Parameters:
array - the array to copy and add the element to, may be null
element - the object to add at the last index of the new array
Returns:
A new array containing the existing elements plus the new element
Since:
2.1

add

public static float[] add(float[] array,
                          int index,
                          float element)
Inserts the specified element at the specified position in the array. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

This method returns a new array with the same elements of the input array plus the given element on the specified position. The component type of the returned array is always the same as that of the input array.

If the input array is null, a new one element array is returned whose component type is the same as the element.

 ArrayUtils.add([1.1f], 0, 2.2f)               = [2.2f, 1.1f]
 ArrayUtils.add([2.3f, 6.4f], 2, 10.5f)        = [2.3f, 6.4f, 10.5f]
 ArrayUtils.add([2.6f, 6.7f], 0, -4.8f)        = [-4.8f, 2.6f, 6.7f]
 ArrayUtils.add([2.9f, 6.0f, 0.3f], 2, 1.0f)   = [2.9f, 6.0f, 1.0f, 0.3f]
 
Parameters:
array - the array to add the element to, may be null
index - the position of the new object
element - the object to add
Returns:
A new array containing the existing elements and the new element
Throws:
IndexOutOfBoundsException - if the index is out of range (index <320 || index > array.length).

add

public static int[] add(int[] array,
                        int element)
Copies the given array and adds the given element at the end of the new array.

The new array contains the same elements of the input array plus the given element in the last position. The component type of the new array is the same as that of the input array.

If the input array is null, a new one element array is returned whose component type is the same as the element.

 ArrayUtils.add(null, 0)   = [0]
 ArrayUtils.add([1], 0)    = [1, 0]
 ArrayUtils.add([1, 0], 1) = [1, 0, 1]
 
Parameters:
array - the array to copy and add the element to, may be null
element - the object to add at the last index of the new array
Returns:
A new array containing the existing elements plus the new element
Since:
2.1

add

public static int[] add(int[] array,
                        int index,
                        int element)
Inserts the specified element at the specified position in the array. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

This method returns a new array with the same elements of the input array plus the given element on the specified position. The component type of the returned array is always the same as that of the input array.

If the input array is null, a new one element array is returned whose component type is the same as the element.

 ArrayUtils.add([1], 0, 2)         = [2, 1]
 ArrayUtils.add([2, 6], 2, 10)     = [2, 6, 10]
 ArrayUtils.add([2, 6], 0, -4)     = [-4, 2, 6]
 ArrayUtils.add([2, 6, 3], 2, 1)   = [2, 6, 1, 3]
 
Parameters:
array - the array to add the element to, may be null
index - the position of the new object
element - the object to add
Returns:
A new array containing the existing elements and the new element
Throws:
IndexOutOfBoundsException - if the index is out of range (index <320 || index > array.length).

add

public static Object[] add(Object[] array,
                           int index,
                           Object element)
Inserts the specified element at the specified position in the array. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

This method returns a new array with the same elements of the input array plus the given element on the specified position. The component type of the returned array is always the same as that of the input array.

If the input array is null, a new one element array is returned whose component type is the same as the element.

 ArrayUtils.add(null, 0, null)      = [null]
 ArrayUtils.add(null, 0, "a")       = ["a"]
 ArrayUtils.add(["a"], 1, null)     = ["a", null]
 ArrayUtils.add(["a"], 1, "b")      = ["a", "b"]
 ArrayUtils.add(["a", "b"], 3, "c") = ["a", "b", "c"]
 
Parameters:
array - the array to add the element to, may be null
index - the position of the new object
element - the object to add
Returns:
A new array containing the existing elements and the new element
Throws:
IndexOutOfBoundsException - if the index is out of range (index <320 || index > array.length).

add

public static Object[] add(Object[] array,
                           Object element)
Copies the given array and adds the given element at the end of the new array.

The new array contains the same elements of the input array plus the given element in the last position. The component type of the new array is the same as that of the input array.

If the input array is null, a new one element array is returned whose component type is the same as the element.

 ArrayUtils.add(null, null)      = [null]
 ArrayUtils.add(null, "a")       = ["a"]
 ArrayUtils.add(["a"], null)     = ["a", null]
 ArrayUtils.add(["a"], "b")      = ["a", "b"]
 ArrayUtils.add(["a", "b"], "c") = ["a", "b", "c"]
 
Parameters:
array - the array to "add" the element to, may be null
element - the object to add
Returns:
A new array containing the existing elements plus the new element
Since:
2.1

add

public static long[] add(long[] array,
                         int index,
                         long element)
Inserts the specified element at the specified position in the array. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

This method returns a new array with the same elements of the input array plus the given element on the specified position. The component type of the returned array is always the same as that of the input array.

If the input array is null, a new one element array is returned whose component type is the same as the element.

 ArrayUtils.add([1L], 0, 2L)           = [2L, 1L]
 ArrayUtils.add([2L, 6L], 2, 10L)      = [2L, 6L, 10L]
 ArrayUtils.add([2L, 6L], 0, -4L)      = [-4L, 2L, 6L]
 ArrayUtils.add([2L, 6L, 3L], 2, 1L)   = [2L, 6L, 1L, 3L]
 
Parameters:
array - the array to add the element to, may be null
index - the position of the new object
element - the object to add
Returns:
A new array containing the existing elements and the new element
Throws:
IndexOutOfBoundsException - if the index is out of range (index <320 || index > array.length).

add

public static long[] add(long[] array,
                         long element)
Copies the given array and adds the given element at the end of the new array.

The new array contains the same elements of the input array plus the given element in the last position. The component type of the new array is the same as that of the input array.

If the input array is null, a new one element array is returned whose component type is the same as the element.

 ArrayUtils.add(null, 0)   = [0]
 ArrayUtils.add([1], 0)    = [1, 0]
 ArrayUtils.add([1, 0], 1) = [1, 0, 1]
 
Parameters:
array - the array to copy and add the element to, may be null
element - the object to add at the last index of the new array
Returns:
A new array containing the existing elements plus the new element
Since:
2.1

add

public static short[] add(short[] array,
                          int index,
                          short element)
Inserts the specified element at the specified position in the array. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

This method returns a new array with the same elements of the input array plus the given element on the specified position. The component type of the returned array is always the same as that of the input array.

If the input array is null, a new one element array is returned whose component type is the same as the element.

 ArrayUtils.add([1], 0, 2)         = [2, 1]
 ArrayUtils.add([2, 6], 2, 10)     = [2, 6, 10]
 ArrayUtils.add([2, 6], 0, -4)     = [-4, 2, 6]
 ArrayUtils.add([2, 6, 3], 2, 1)   = [2, 6, 1, 3]
 
Parameters:
array - the array to add the element to, may be null
index - the position of the new object
element - the object to add
Returns:
A new array containing the existing elements and the new element
Throws:
IndexOutOfBoundsException - if the index is out of range (index <320 || index > array.length).

add

public static short[] add(short[] array,
                          short element)
Copies the given array and adds the given element at the end of the new array.

The new array contains the same elements of the input array plus the given element in the last position. The component type of the new array is the same as that of the input array.

If the input array is null, a new one element array is returned whose component type is the same as the element.

 ArrayUtils.add(null, 0)   = [0]
 ArrayUtils.add([1], 0)    = [1, 0]
 ArrayUtils.add([1, 0], 1) = [1, 0, 1]
 
Parameters:
array - the array to copy and add the element to, may be null
element - the object to add at the last index of the new array
Returns:
A new array containing the existing elements plus the new element
Since:
2.1

addAll

public static boolean[] addAll(boolean[] array1,
                               boolean[] array2)
Adds all the elements of the given arrays into a new array.

The new array contains all of the element of array1 followed by all of the elements array2. When an array is returned, it is always a new array.

 ArrayUtils.addAll(array1, null)   = cloned copy of array1
 ArrayUtils.addAll(null, array2)   = cloned copy of array2
 ArrayUtils.addAll([], [])         = []
 
Parameters:
array1 - the first array whose elements are added to the new array.
array2 - the second array whose elements are added to the new array.
Returns:
The new boolean[] array.
Since:
2.1
Usages and Demos :

View More Examples of addAll(boolean[] array1,boolean[] array2)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:     public static byte[] subarray(byte[] data, int beginIndex, int endIndex) {
   6:         return ArrayUtils.subarray(data, beginIndex, endIndex);
   7:     }
   8:         ...
   9:     public static byte[] add (byte[] data1, byte[] data2) {
  10:         return ArrayUtils.addAll(data1, data2);
  11:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.rrexky.security.crypto.jcef.core.Protection;
   4:         ...
   5:                 } else {
   6:                     result = ArrayUtils.addAll(result, out);
   7:                 }
   8:         ...
   9:                 } else {
  10:                     result = ArrayUtils.addAll(result, out);
  11:                 }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5: 
   6:         webConnection.setDefaultResponse(ArrayUtils.addAll(markerUTF8, script), 200, "OK", "text/javascript");
   7:         webConnection.setResponse(URL_FIRST, html);
   8:         webClient.setWebConnection( webConnection );

View Full Code Here

addAll

public static byte[] addAll(byte[] array1,
                            byte[] array2)
Adds all the elements of the given arrays into a new array.

The new array contains all of the element of array1 followed by all of the elements array2. When an array is returned, it is always a new array.

 ArrayUtils.addAll(array1, null)   = cloned copy of array1
 ArrayUtils.addAll(null, array2)   = cloned copy of array2
 ArrayUtils.addAll([], [])         = []
 
Parameters:
array1 - the first array whose elements are added to the new array.
array2 - the second array whose elements are added to the new array.
Returns:
The new byte[] array.
Since:
2.1
Usages and Demos :

View More Examples of addAll(byte[] array1,byte[] array2)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:     public static byte[] subarray(byte[] data, int beginIndex, int endIndex) {
   6:         return ArrayUtils.subarray(data, beginIndex, endIndex);
   7:     }
   8:         ...
   9:     public static byte[] add (byte[] data1, byte[] data2) {
  10:         return ArrayUtils.addAll(data1, data2);
  11:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.rrexky.security.crypto.jcef.core.Protection;
   4:         ...
   5:                 } else {
   6:                     result = ArrayUtils.addAll(result, out);
   7:                 }
   8:         ...
   9:                 } else {
  10:                     result = ArrayUtils.addAll(result, out);
  11:                 }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5: 
   6:         webConnection.setDefaultResponse(ArrayUtils.addAll(markerUTF8, script), 200, "OK", "text/javascript");
   7:         webConnection.setResponse(URL_FIRST, html);
   8:         webClient.setWebConnection( webConnection );

View Full Code Here

addAll

public static char[] addAll(char[] array1,
                            char[] array2)
Adds all the elements of the given arrays into a new array.

The new array contains all of the element of array1 followed by all of the elements array2. When an array is returned, it is always a new array.

 ArrayUtils.addAll(array1, null)   = cloned copy of array1
 ArrayUtils.addAll(null, array2)   = cloned copy of array2
 ArrayUtils.addAll([], [])         = []
 
Parameters:
array1 - the first array whose elements are added to the new array.
array2 - the second array whose elements are added to the new array.
Returns:
The new char[] array.
Since:
2.1
Usages and Demos :

View More Examples of addAll(char[] array1,char[] array2)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:     public static byte[] subarray(byte[] data, int beginIndex, int endIndex) {
   6:         return ArrayUtils.subarray(data, beginIndex, endIndex);
   7:     }
   8:         ...
   9:     public static byte[] add (byte[] data1, byte[] data2) {
  10:         return ArrayUtils.addAll(data1, data2);
  11:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.rrexky.security.crypto.jcef.core.Protection;
   4:         ...
   5:                 } else {
   6:                     result = ArrayUtils.addAll(result, out);
   7:                 }
   8:         ...
   9:                 } else {
  10:                     result = ArrayUtils.addAll(result, out);
  11:                 }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5: 
   6:         webConnection.setDefaultResponse(ArrayUtils.addAll(markerUTF8, script), 200, "OK", "text/javascript");
   7:         webConnection.setResponse(URL_FIRST, html);
   8:         webClient.setWebConnection( webConnection );

View Full Code Here

addAll

public static double[] addAll(double[] array1,
                              double[] array2)
Adds all the elements of the given arrays into a new array.

The new array contains all of the element of array1 followed by all of the elements array2. When an array is returned, it is always a new array.

 ArrayUtils.addAll(array1, null)   = cloned copy of array1
 ArrayUtils.addAll(null, array2)   = cloned copy of array2
 ArrayUtils.addAll([], [])         = []
 
Parameters:
array1 - the first array whose elements are added to the new array.
array2 - the second array whose elements are added to the new array.
Returns:
The new double[] array.
Since:
2.1
Usages and Demos :

View More Examples of addAll(double[] array1,double[] array2)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:     public static byte[] subarray(byte[] data, int beginIndex, int endIndex) {
   6:         return ArrayUtils.subarray(data, beginIndex, endIndex);
   7:     }
   8:         ...
   9:     public static byte[] add (byte[] data1, byte[] data2) {
  10:         return ArrayUtils.addAll(data1, data2);
  11:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.rrexky.security.crypto.jcef.core.Protection;
   4:         ...
   5:                 } else {
   6:                     result = ArrayUtils.addAll(result, out);
   7:                 }
   8:         ...
   9:                 } else {
  10:                     result = ArrayUtils.addAll(result, out);
  11:                 }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5: 
   6:         webConnection.setDefaultResponse(ArrayUtils.addAll(markerUTF8, script), 200, "OK", "text/javascript");
   7:         webConnection.setResponse(URL_FIRST, html);
   8:         webClient.setWebConnection( webConnection );

View Full Code Here

addAll

public static float[] addAll(float[] array1,
                             float[] array2)
Adds all the elements of the given arrays into a new array.

The new array contains all of the element of array1 followed by all of the elements array2. When an array is returned, it is always a new array.

 ArrayUtils.addAll(array1, null)   = cloned copy of array1
 ArrayUtils.addAll(null, array2)   = cloned copy of array2
 ArrayUtils.addAll([], [])         = []
 
Parameters:
array1 - the first array whose elements are added to the new array.
array2 - the second array whose elements are added to the new array.
Returns:
The new float[] array.
Since:
2.1
Usages and Demos :

View More Examples of addAll(float[] array1,float[] array2)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:     public static byte[] subarray(byte[] data, int beginIndex, int endIndex) {
   6:         return ArrayUtils.subarray(data, beginIndex, endIndex);
   7:     }
   8:         ...
   9:     public static byte[] add (byte[] data1, byte[] data2) {
  10:         return ArrayUtils.addAll(data1, data2);
  11:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.rrexky.security.crypto.jcef.core.Protection;
   4:         ...
   5:                 } else {
   6:                     result = ArrayUtils.addAll(result, out);
   7:                 }
   8:         ...
   9:                 } else {
  10:                     result = ArrayUtils.addAll(result, out);
  11:                 }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5: 
   6:         webConnection.setDefaultResponse(ArrayUtils.addAll(markerUTF8, script), 200, "OK", "text/javascript");
   7:         webConnection.setResponse(URL_FIRST, html);
   8:         webClient.setWebConnection( webConnection );

View Full Code Here

addAll

public static int[] addAll(int[] array1,
                           int[] array2)
Adds all the elements of the given arrays into a new array.

The new array contains all of the element of array1 followed by all of the elements array2. When an array is returned, it is always a new array.

 ArrayUtils.addAll(array1, null)   = cloned copy of array1
 ArrayUtils.addAll(null, array2)   = cloned copy of array2
 ArrayUtils.addAll([], [])         = []
 
Parameters:
array1 - the first array whose elements are added to the new array.
array2 - the second array whose elements are added to the new array.
Returns:
The new int[] array.
Since:
2.1
Usages and Demos :

View More Examples of addAll(int[] array1,int[] array2)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:     public static byte[] subarray(byte[] data, int beginIndex, int endIndex) {
   6:         return ArrayUtils.subarray(data, beginIndex, endIndex);
   7:     }
   8:         ...
   9:     public static byte[] add (byte[] data1, byte[] data2) {
  10:         return ArrayUtils.addAll(data1, data2);
  11:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.rrexky.security.crypto.jcef.core.Protection;
   4:         ...
   5:                 } else {
   6:                     result = ArrayUtils.addAll(result, out);
   7:                 }
   8:         ...
   9:                 } else {
  10:                     result = ArrayUtils.addAll(result, out);
  11:                 }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5: 
   6:         webConnection.setDefaultResponse(ArrayUtils.addAll(markerUTF8, script), 200, "OK", "text/javascript");
   7:         webConnection.setResponse(URL_FIRST, html);
   8:         webClient.setWebConnection( webConnection );

View Full Code Here

addAll

public static Object[] addAll(Object[] array1,
                              Object[] array2)
Adds all the elements of the given arrays into a new array.

The new array contains all of the element of array1 followed by all of the elements array2. When an array is returned, it is always a new array.

 ArrayUtils.addAll(null, null)     = null
 ArrayUtils.addAll(array1, null)   = cloned copy of array1
 ArrayUtils.addAll(null, array2)   = cloned copy of array2
 ArrayUtils.addAll([], [])         = []
 ArrayUtils.addAll([null], [null]) = [null, null]
 ArrayUtils.addAll(["a", "b", "c"], ["1", "2", "3"]) = ["a", "b", "c", "1", "2", "3"]
 
Parameters:
array1 - the first array whose elements are added to the new array, may be null
array2 - the second array whose elements are added to the new array, may be null
Returns:
The new array, null if null array inputs. The type of the new array is the type of the first array.
Since:
2.1
Usages and Demos :

View More Examples of addAll(Object[] array1,Object[] array2)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:     public static byte[] subarray(byte[] data, int beginIndex, int endIndex) {
   6:         return ArrayUtils.subarray(data, beginIndex, endIndex);
   7:     }
   8:         ...
   9:     public static byte[] add (byte[] data1, byte[] data2) {
  10:         return ArrayUtils.addAll(data1, data2);
  11:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.rrexky.security.crypto.jcef.core.Protection;
   4:         ...
   5:                 } else {
   6:                     result = ArrayUtils.addAll(result, out);
   7:                 }
   8:         ...
   9:                 } else {
  10:                     result = ArrayUtils.addAll(result, out);
  11:                 }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5: 
   6:         webConnection.setDefaultResponse(ArrayUtils.addAll(markerUTF8, script), 200, "OK", "text/javascript");
   7:         webConnection.setResponse(URL_FIRST, html);
   8:         webClient.setWebConnection( webConnection );

View Full Code Here

addAll

public static long[] addAll(long[] array1,
                            long[] array2)
Adds all the elements of the given arrays into a new array.

The new array contains all of the element of array1 followed by all of the elements array2. When an array is returned, it is always a new array.

 ArrayUtils.addAll(array1, null)   = cloned copy of array1
 ArrayUtils.addAll(null, array2)   = cloned copy of array2
 ArrayUtils.addAll([], [])         = []
 
Parameters:
array1 - the first array whose elements are added to the new array.
array2 - the second array whose elements are added to the new array.
Returns:
The new long[] array.
Since:
2.1
Usages and Demos :

View More Examples of addAll(long[] array1,long[] array2)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:     public static byte[] subarray(byte[] data, int beginIndex, int endIndex) {
   6:         return ArrayUtils.subarray(data, beginIndex, endIndex);
   7:     }
   8:         ...
   9:     public static byte[] add (byte[] data1, byte[] data2) {
  10:         return ArrayUtils.addAll(data1, data2);
  11:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.rrexky.security.crypto.jcef.core.Protection;
   4:         ...
   5:                 } else {
   6:                     result = ArrayUtils.addAll(result, out);
   7:                 }
   8:         ...
   9:                 } else {
  10:                     result = ArrayUtils.addAll(result, out);
  11:                 }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5: 
   6:         webConnection.setDefaultResponse(ArrayUtils.addAll(markerUTF8, script), 200, "OK", "text/javascript");
   7:         webConnection.setResponse(URL_FIRST, html);
   8:         webClient.setWebConnection( webConnection );

View Full Code Here

addAll

public static short[] addAll(short[] array1,
                             short[] array2)
Adds all the elements of the given arrays into a new array.

The new array contains all of the element of array1 followed by all of the elements array2. When an array is returned, it is always a new array.

 ArrayUtils.addAll(array1, null)   = cloned copy of array1
 ArrayUtils.addAll(null, array2)   = cloned copy of array2
 ArrayUtils.addAll([], [])         = []
 
Parameters:
array1 - the first array whose elements are added to the new array.
array2 - the second array whose elements are added to the new array.
Returns:
The new short[] array.
Since:
2.1
Usages and Demos :

View More Examples of addAll(short[] array1,short[] array2)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:     public static byte[] subarray(byte[] data, int beginIndex, int endIndex) {
   6:         return ArrayUtils.subarray(data, beginIndex, endIndex);
   7:     }
   8:         ...
   9:     public static byte[] add (byte[] data1, byte[] data2) {
  10:         return ArrayUtils.addAll(data1, data2);
  11:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.rrexky.security.crypto.jcef.core.Protection;
   4:         ...
   5:                 } else {
   6:                     result = ArrayUtils.addAll(result, out);
   7:                 }
   8:         ...
   9:                 } else {
  10:                     result = ArrayUtils.addAll(result, out);
  11:                 }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5: 
   6:         webConnection.setDefaultResponse(ArrayUtils.addAll(markerUTF8, script), 200, "OK", "text/javascript");
   7:         webConnection.setResponse(URL_FIRST, html);
   8:         webClient.setWebConnection( webConnection );

View Full Code Here

clone

public static boolean[] clone(boolean[] array)
Clones an array returning a typecast result and handling null.

This method returns null for a null input array.

Parameters:
array - the array to clone, may be null
Returns:
the cloned array, null if null input
Usages and Demos :

View More Examples of clone(boolean[] array)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.displaytag.Messages;
   4:         ...
   5:     {
   6:             new Object[]{ArrayUtils.toString(attributeNames)}));
   7: 
   8:         ...
   9:         this.attributes = (String[]) ArrayUtils.clone(attributeNames);
  10:     }
  11:         ...
  12:     {
  13:         return (String[]) ArrayUtils.clone(this.attributes);

View Full Code Here

clone

public static byte[] clone(byte[] array)
Clones an array returning a typecast result and handling null.

This method returns null for a null input array.

Parameters:
array - the array to clone, may be null
Returns:
the cloned array, null if null input
Usages and Demos :

View More Examples of clone(byte[] array)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.displaytag.Messages;
   4:         ...
   5:     {
   6:             new Object[]{ArrayUtils.toString(attributeNames)}));
   7: 
   8:         ...
   9:         this.attributes = (String[]) ArrayUtils.clone(attributeNames);
  10:     }
  11:         ...
  12:     {
  13:         return (String[]) ArrayUtils.clone(this.attributes);

View Full Code Here

clone

public static char[] clone(char[] array)
Clones an array returning a typecast result and handling null.

This method returns null for a null input array.

Parameters:
array - the array to clone, may be null
Returns:
the cloned array, null if null input
Usages and Demos :

View More Examples of clone(char[] array)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.displaytag.Messages;
   4:         ...
   5:     {
   6:             new Object[]{ArrayUtils.toString(attributeNames)}));
   7: 
   8:         ...
   9:         this.attributes = (String[]) ArrayUtils.clone(attributeNames);
  10:     }
  11:         ...
  12:     {
  13:         return (String[]) ArrayUtils.clone(this.attributes);

View Full Code Here

clone

public static double[] clone(double[] array)
Clones an array returning a typecast result and handling null.

This method returns null for a null input array.

Parameters:
array - the array to clone, may be null
Returns:
the cloned array, null if null input
Usages and Demos :

View More Examples of clone(double[] array)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.displaytag.Messages;
   4:         ...
   5:     {
   6:             new Object[]{ArrayUtils.toString(attributeNames)}));
   7: 
   8:         ...
   9:         this.attributes = (String[]) ArrayUtils.clone(attributeNames);
  10:     }
  11:         ...
  12:     {
  13:         return (String[]) ArrayUtils.clone(this.attributes);

View Full Code Here

clone

public static float[] clone(float[] array)
Clones an array returning a typecast result and handling null.

This method returns null for a null input array.

Parameters:
array - the array to clone, may be null
Returns:
the cloned array, null if null input
Usages and Demos :

View More Examples of clone(float[] array)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.displaytag.Messages;
   4:         ...
   5:     {
   6:             new Object[]{ArrayUtils.toString(attributeNames)}));
   7: 
   8:         ...
   9:         this.attributes = (String[]) ArrayUtils.clone(attributeNames);
  10:     }
  11:         ...
  12:     {
  13:         return (String[]) ArrayUtils.clone(this.attributes);

View Full Code Here

clone

public static int[] clone(int[] array)
Clones an array returning a typecast result and handling null.

This method returns null for a null input array.

Parameters:
array - the array to clone, may be null
Returns:
the cloned array, null if null input
Usages and Demos :

View More Examples of clone(int[] array)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.displaytag.Messages;
   4:         ...
   5:     {
   6:             new Object[]{ArrayUtils.toString(attributeNames)}));
   7: 
   8:         ...
   9:         this.attributes = (String[]) ArrayUtils.clone(attributeNames);
  10:     }
  11:         ...
  12:     {
  13:         return (String[]) ArrayUtils.clone(this.attributes);

View Full Code Here

clone

public static Object[] clone(Object[] array)
Shallow clones an array returning a typecast result and handling null.

The objects in the array are not cloned, thus there is no special handling for multi-dimensional arrays.

This method returns null for a null input array.

Parameters:
array - the array to shallow clone, may be null
Returns:
the cloned array, null if null input
Usages and Demos :

View More Examples of clone(Object[] array)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.displaytag.Messages;
   4:         ...
   5:     {
   6:             new Object[]{ArrayUtils.toString(attributeNames)}));
   7: 
   8:         ...
   9:         this.attributes = (String[]) ArrayUtils.clone(attributeNames);
  10:     }
  11:         ...
  12:     {
  13:         return (String[]) ArrayUtils.clone(this.attributes);

View Full Code Here

clone

public static long[] clone(long[] array)
Clones an array returning a typecast result and handling null.

This method returns null for a null input array.

Parameters:
array - the array to clone, may be null
Returns:
the cloned array, null if null input
Usages and Demos :

View More Examples of clone(long[] array)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.displaytag.Messages;
   4:         ...
   5:     {
   6:             new Object[]{ArrayUtils.toString(attributeNames)}));
   7: 
   8:         ...
   9:         this.attributes = (String[]) ArrayUtils.clone(attributeNames);
  10:     }
  11:         ...
  12:     {
  13:         return (String[]) ArrayUtils.clone(this.attributes);

View Full Code Here

clone

public static short[] clone(short[] array)
Clones an array returning a typecast result and handling null.

This method returns null for a null input array.

Parameters:
array - the array to clone, may be null
Returns:
the cloned array, null if null input
Usages and Demos :

View More Examples of clone(short[] array)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.displaytag.Messages;
   4:         ...
   5:     {
   6:             new Object[]{ArrayUtils.toString(attributeNames)}));
   7: 
   8:         ...
   9:         this.attributes = (String[]) ArrayUtils.clone(attributeNames);
  10:     }
  11:         ...
  12:     {
  13:         return (String[]) ArrayUtils.clone(this.attributes);

View Full Code Here

contains

public static boolean contains(boolean[] array,
                               boolean valueToFind)
Checks if the value is in the given array.

The method returns false if a null array is passed in.

Parameters:
array - the array to search through
valueToFind - the value to find
Returns:
true if the array contains the object
Usages and Demos :

View More Examples of contains(boolean[] array,boolean valueToFind)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.StringUtils;
   4:         ...
   5:                     "Expected parameter " + singleParam + " could not be found in generated URL",
   6:                     ArrayUtils.contains(generatedParameters, singleParam));
   7:             }
   8:         }
   9:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:             } else {
   6:                 result = ArrayUtils.contains(keySizes, keySize);
   7:             }
   8:         }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.rrexky.security.crypto.jcef.core.ParameterGenerator;
   4:         ...
   5:             } else {
   6:                 result = ArrayUtils.contains(parameterSizes, parameterSize);
   7:             }
   8:         }
   9:         return result;

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.StringUtils;
   4:         ...
   5:         if(purapDocument instanceof PaymentRequestDocument) {
   6:             value = !(ArrayUtils.contains(PurapConstants.PaymentRequestStatuses.FULL_ENTRY_STATUSES,purapDocument.getStatusCode()));
   7:         }
   8:         return value;
   9:     }

View Full Code Here

contains

public static boolean contains(byte[] array,
                               byte valueToFind)
Checks if the value is in the given array.

The method returns false if a null array is passed in.

Parameters:
array - the array to search through
valueToFind - the value to find
Returns:
true if the array contains the object
Usages and Demos :

View More Examples of contains(byte[] array,byte valueToFind)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.StringUtils;
   4:         ...
   5:                     "Expected parameter " + singleParam + " could not be found in generated URL",
   6:                     ArrayUtils.contains(generatedParameters, singleParam));
   7:             }
   8:         }
   9:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:             } else {
   6:                 result = ArrayUtils.contains(keySizes, keySize);
   7:             }
   8:         }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.rrexky.security.crypto.jcef.core.ParameterGenerator;
   4:         ...
   5:             } else {
   6:                 result = ArrayUtils.contains(parameterSizes, parameterSize);
   7:             }
   8:         }
   9:         return result;

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.StringUtils;
   4:         ...
   5:         if(purapDocument instanceof PaymentRequestDocument) {
   6:             value = !(ArrayUtils.contains(PurapConstants.PaymentRequestStatuses.FULL_ENTRY_STATUSES,purapDocument.getStatusCode()));
   7:         }
   8:         return value;
   9:     }

View Full Code Here

contains

public static boolean contains(char[] array,
                               char valueToFind)
Checks if the value is in the given array.

The method returns false if a null array is passed in.

Parameters:
array - the array to search through
valueToFind - the value to find
Returns:
true if the array contains the object
Since:
2.1
Usages and Demos :

View More Examples of contains(char[] array,char valueToFind)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.StringUtils;
   4:         ...
   5:                     "Expected parameter " + singleParam + " could not be found in generated URL",
   6:                     ArrayUtils.contains(generatedParameters, singleParam));
   7:             }
   8:         }
   9:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:             } else {
   6:                 result = ArrayUtils.contains(keySizes, keySize);
   7:             }
   8:         }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.rrexky.security.crypto.jcef.core.ParameterGenerator;
   4:         ...
   5:             } else {
   6:                 result = ArrayUtils.contains(parameterSizes, parameterSize);
   7:             }
   8:         }
   9:         return result;

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.StringUtils;
   4:         ...
   5:         if(purapDocument instanceof PaymentRequestDocument) {
   6:             value = !(ArrayUtils.contains(PurapConstants.PaymentRequestStatuses.FULL_ENTRY_STATUSES,purapDocument.getStatusCode()));
   7:         }
   8:         return value;
   9:     }

View Full Code Here

contains

public static boolean contains(double[] array,
                               double valueToFind)
Checks if the value is in the given array.

The method returns false if a null array is passed in.

Parameters:
array - the array to search through
valueToFind - the value to find
Returns:
true if the array contains the object
Usages and Demos :

View More Examples of contains(double[] array,double valueToFind)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.StringUtils;
   4:         ...
   5:                     "Expected parameter " + singleParam + " could not be found in generated URL",
   6:                     ArrayUtils.contains(generatedParameters, singleParam));
   7:             }
   8:         }
   9:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:             } else {
   6:                 result = ArrayUtils.contains(keySizes, keySize);
   7:             }
   8:         }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.rrexky.security.crypto.jcef.core.ParameterGenerator;
   4:         ...
   5:             } else {
   6:                 result = ArrayUtils.contains(parameterSizes, parameterSize);
   7:             }
   8:         }
   9:         return result;

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.StringUtils;
   4:         ...
   5:         if(purapDocument instanceof PaymentRequestDocument) {
   6:             value = !(ArrayUtils.contains(PurapConstants.PaymentRequestStatuses.FULL_ENTRY_STATUSES,purapDocument.getStatusCode()));
   7:         }
   8:         return value;
   9:     }

View Full Code Here

contains

public static boolean contains(double[] array,
                               double valueToFind,
                               double tolerance)
Checks if a value falling within the given tolerance is in the given array. If the array contains a value within the inclusive range defined by (value - tolerance) to (value + tolerance).

The method returns false if a null array is passed in.

Parameters:
array - the array to search
valueToFind - the value to find
tolerance - the array contains the tolerance of the search
Returns:
true if value falling within tolerance is in array

contains

public static boolean contains(float[] array,
                               float valueToFind)
Checks if the value is in the given array.

The method returns false if a null array is passed in.

Parameters:
array - the array to search through
valueToFind - the value to find
Returns:
true if the array contains the object
Usages and Demos :

View More Examples of contains(float[] array,float valueToFind)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.StringUtils;
   4:         ...
   5:                     "Expected parameter " + singleParam + " could not be found in generated URL",
   6:                     ArrayUtils.contains(generatedParameters, singleParam));
   7:             }
   8:         }
   9:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:             } else {
   6:                 result = ArrayUtils.contains(keySizes, keySize);
   7:             }
   8:         }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.rrexky.security.crypto.jcef.core.ParameterGenerator;
   4:         ...
   5:             } else {
   6:                 result = ArrayUtils.contains(parameterSizes, parameterSize);
   7:             }
   8:         }
   9:         return result;

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.StringUtils;
   4:         ...
   5:         if(purapDocument instanceof PaymentRequestDocument) {
   6:             value = !(ArrayUtils.contains(PurapConstants.PaymentRequestStatuses.FULL_ENTRY_STATUSES,purapDocument.getStatusCode()));
   7:         }
   8:         return value;
   9:     }

View Full Code Here

contains

public static boolean contains(int[] array,
                               int valueToFind)
Checks if the value is in the given array.

The method returns false if a null array is passed in.

Parameters:
array - the array to search through
valueToFind - the value to find
Returns:
true if the array contains the object
Usages and Demos :

View More Examples of contains(int[] array,int valueToFind)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.StringUtils;
   4:         ...
   5:                     "Expected parameter " + singleParam + " could not be found in generated URL",
   6:                     ArrayUtils.contains(generatedParameters, singleParam));
   7:             }
   8:         }
   9:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:             } else {
   6:                 result = ArrayUtils.contains(keySizes, keySize);
   7:             }
   8:         }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.rrexky.security.crypto.jcef.core.ParameterGenerator;
   4:         ...
   5:             } else {
   6:                 result = ArrayUtils.contains(parameterSizes, parameterSize);
   7:             }
   8:         }
   9:         return result;

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.StringUtils;
   4:         ...
   5:         if(purapDocument instanceof PaymentRequestDocument) {
   6:             value = !(ArrayUtils.contains(PurapConstants.PaymentRequestStatuses.FULL_ENTRY_STATUSES,purapDocument.getStatusCode()));
   7:         }
   8:         return value;
   9:     }

View Full Code Here

contains

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.

Parameters:
array - the array to search through
objectToFind - the object to find
Returns:
true if the array contains the object
Usages and Demos :

View More Examples of contains(Object[] array,Object objectToFind)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.StringUtils;
   4:         ...
   5:                     "Expected parameter " + singleParam + " could not be found in generated URL",
   6:                     ArrayUtils.contains(generatedParameters, singleParam));
   7:             }
   8:         }
   9:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:             } else {
   6:                 result = ArrayUtils.contains(keySizes, keySize);
   7:             }
   8:         }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.rrexky.security.crypto.jcef.core.ParameterGenerator;
   4:         ...
   5:             } else {
   6:                 result = ArrayUtils.contains(parameterSizes, parameterSize);
   7:             }
   8:         }
   9:         return result;

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.StringUtils;
   4:         ...
   5:         if(purapDocument instanceof PaymentRequestDocument) {
   6:             value = !(ArrayUtils.contains(PurapConstants.PaymentRequestStatuses.FULL_ENTRY_STATUSES,purapDocument.getStatusCode()));
   7:         }
   8:         return value;
   9:     }

View Full Code Here

contains

public static boolean contains(long[] array,
                               long valueToFind)
Checks if the value is in the given array.

The method returns false if a null array is passed in.

Parameters:
array - the array to search through
valueToFind - the value to find
Returns:
true if the array contains the object
Usages and Demos :

View More Examples of contains(long[] array,long valueToFind)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.StringUtils;
   4:         ...
   5:                     "Expected parameter " + singleParam + " could not be found in generated URL",
   6:                     ArrayUtils.contains(generatedParameters, singleParam));
   7:             }
   8:         }
   9:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:             } else {
   6:                 result = ArrayUtils.contains(keySizes, keySize);
   7:             }
   8:         }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.rrexky.security.crypto.jcef.core.ParameterGenerator;
   4:         ...
   5:             } else {
   6:                 result = ArrayUtils.contains(parameterSizes, parameterSize);
   7:             }
   8:         }
   9:         return result;

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.StringUtils;
   4:         ...
   5:         if(purapDocument instanceof PaymentRequestDocument) {
   6:             value = !(ArrayUtils.contains(PurapConstants.PaymentRequestStatuses.FULL_ENTRY_STATUSES,purapDocument.getStatusCode()));
   7:         }
   8:         return value;
   9:     }

View Full Code Here

contains

public static boolean contains(short[] array,
                               short valueToFind)
Checks if the value is in the given array.

The method returns false if a null array is passed in.

Parameters:
array - the array to search through
valueToFind - the value to find
Returns:
true if the array contains the object
Usages and Demos :

View More Examples of contains(short[] array,short valueToFind)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.StringUtils;
   4:         ...
   5:                     "Expected parameter " + singleParam + " could not be found in generated URL",
   6:                     ArrayUtils.contains(generatedParameters, singleParam));
   7:             }
   8:         }
   9:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:             } else {
   6:                 result = ArrayUtils.contains(keySizes, keySize);
   7:             }
   8:         }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.rrexky.security.crypto.jcef.core.ParameterGenerator;
   4:         ...
   5:             } else {
   6:                 result = ArrayUtils.contains(parameterSizes, parameterSize);
   7:             }
   8:         }
   9:         return result;

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.StringUtils;
   4:         ...
   5:         if(purapDocument instanceof PaymentRequestDocument) {
   6:             value = !(ArrayUtils.contains(PurapConstants.PaymentRequestStatuses.FULL_ENTRY_STATUSES,purapDocument.getStatusCode()));
   7:         }
   8:         return value;
   9:     }

View Full Code Here

getLength

public static int getLength(Object array)
Returns the length of the specified array. This method can deal with Object arrays and with primitive arrays.

If the input array is null, 0 is returned.

 ArrayUtils.getLength(null)            = 0
 ArrayUtils.getLength([])              = 0
 ArrayUtils.getLength([null])          = 1
 ArrayUtils.getLength([true, false])   = 2
 ArrayUtils.getLength([1, 2, 3])       = 3
 ArrayUtils.getLength(["a", "b", "c"]) = 3
 
Parameters:
array - the array to retrieve the length from, may be null
Returns:
The length of the array, or 0 if the array is null
Throws:
IllegalArgumentException - if the object arguement is not an array.
Since:
2.1

hashCode

public static int hashCode(Object array)
Get a hashCode for an array handling multi-dimensional arrays correctly.

Multi-dimensional primitive arrays are also handled correctly by this method.

Parameters:
array - the array to get a hashCode for, may be null
Returns:
a hashCode for the array, zero if null array input

indexOf

public static int indexOf(boolean[] array,
                          boolean valueToFind)
Finds the index of the given value in the array.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input
Usages and Demos :

View More Examples of indexOf(boolean[] array,boolean valueToFind)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.ClassUtils;
   4:         ...
   5:         synchronized(CAUSE_METHOD_NAMES) {
   6:             return ArrayUtils.indexOf(CAUSE_METHOD_NAMES, methodName) >= 0;
   7:         }
   8:         ...
   9:             try {
  10:                 return (Throwable) method.invoke(throwable, ArrayUtils.EMPTY_OBJECT_ARRAY);
  11:             } catch (IllegalAccessException ignored) {
  12:         ...
  13:         if (throwable == null) {
  14:             return ArrayUtils.EMPTY_STRING_ARRAY;

View Full Code Here

indexOf

public static int indexOf(boolean[] array,
                          boolean valueToFind,
                          int startIndex)
Finds the index of the given value 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).

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
startIndex - the index to start searching at
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

indexOf

public static int indexOf(byte[] array,
                          byte valueToFind)
Finds the index of the given value in the array.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input
Usages and Demos :

View More Examples of indexOf(byte[] array,byte valueToFind)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.ClassUtils;
   4:         ...
   5:         synchronized(CAUSE_METHOD_NAMES) {
   6:             return ArrayUtils.indexOf(CAUSE_METHOD_NAMES, methodName) >= 0;
   7:         }
   8:         ...
   9:             try {
  10:                 return (Throwable) method.invoke(throwable, ArrayUtils.EMPTY_OBJECT_ARRAY);
  11:             } catch (IllegalAccessException ignored) {
  12:         ...
  13:         if (throwable == null) {
  14:             return ArrayUtils.EMPTY_STRING_ARRAY;

View Full Code Here

indexOf

public static int indexOf(byte[] array,
                          byte valueToFind,
                          int startIndex)
Finds the index of the given value 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).

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
startIndex - the index to start searching at
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

indexOf

public static int indexOf(char[] array,
                          char valueToFind)
Finds the index of the given value in the array.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input
Since:
2.1
Usages and Demos :

View More Examples of indexOf(char[] array,char valueToFind)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.ClassUtils;
   4:         ...
   5:         synchronized(CAUSE_METHOD_NAMES) {
   6:             return ArrayUtils.indexOf(CAUSE_METHOD_NAMES, methodName) >= 0;
   7:         }
   8:         ...
   9:             try {
  10:                 return (Throwable) method.invoke(throwable, ArrayUtils.EMPTY_OBJECT_ARRAY);
  11:             } catch (IllegalAccessException ignored) {
  12:         ...
  13:         if (throwable == null) {
  14:             return ArrayUtils.EMPTY_STRING_ARRAY;

View Full Code Here

indexOf

public static int indexOf(char[] array,
                          char valueToFind,
                          int startIndex)
Finds the index of the given value 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).

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
startIndex - the index to start searching at
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input
Since:
2.1

indexOf

public static int indexOf(double[] array,
                          double valueToFind)
Finds the index of the given value in the array.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input
Usages and Demos :

View More Examples of indexOf(double[] array,double valueToFind)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.ClassUtils;
   4:         ...
   5:         synchronized(CAUSE_METHOD_NAMES) {
   6:             return ArrayUtils.indexOf(CAUSE_METHOD_NAMES, methodName) >= 0;
   7:         }
   8:         ...
   9:             try {
  10:                 return (Throwable) method.invoke(throwable, ArrayUtils.EMPTY_OBJECT_ARRAY);
  11:             } catch (IllegalAccessException ignored) {
  12:         ...
  13:         if (throwable == null) {
  14:             return ArrayUtils.EMPTY_STRING_ARRAY;

View Full Code Here

indexOf

public static int indexOf(double[] array,
                          double valueToFind,
                          double tolerance)
Finds the index of the given value within a given tolerance in the array. This method will return the index of the first value which falls between the region defined by valueToFind - tolerance and valueToFind + tolerance.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
tolerance - tolerance of the search
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

indexOf

public static int indexOf(double[] array,
                          double valueToFind,
                          int startIndex)
Finds the index of the given value 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).

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
startIndex - the index to start searching at
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

indexOf

public static int indexOf(double[] array,
                          double valueToFind,
                          int startIndex,
                          double tolerance)
Finds the index of the given value in the array starting at the given index. This method will return the index of the first value which falls between the region defined by valueToFind - tolerance and valueToFind + tolerance.

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).

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
startIndex - the index to start searching at
tolerance - tolerance of the search
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

indexOf

public static int indexOf(float[] array,
                          float valueToFind)
Finds the index of the given value in the array.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input
Usages and Demos :

View More Examples of indexOf(float[] array,float valueToFind)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.ClassUtils;
   4:         ...
   5:         synchronized(CAUSE_METHOD_NAMES) {
   6:             return ArrayUtils.indexOf(CAUSE_METHOD_NAMES, methodName) >= 0;
   7:         }
   8:         ...
   9:             try {
  10:                 return (Throwable) method.invoke(throwable, ArrayUtils.EMPTY_OBJECT_ARRAY);
  11:             } catch (IllegalAccessException ignored) {
  12:         ...
  13:         if (throwable == null) {
  14:             return ArrayUtils.EMPTY_STRING_ARRAY;

View Full Code Here

indexOf

public static int indexOf(float[] array,
                          float valueToFind,
                          int startIndex)
Finds the index of the given value 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).

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
startIndex - the index to start searching at
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

indexOf

public static int indexOf(int[] array,
                          int valueToFind)
Finds the index of the given value in the array.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input
Usages and Demos :

View More Examples of indexOf(int[] array,int valueToFind)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.ClassUtils;
   4:         ...
   5:         synchronized(CAUSE_METHOD_NAMES) {
   6:             return ArrayUtils.indexOf(CAUSE_METHOD_NAMES, methodName) >= 0;
   7:         }
   8:         ...
   9:             try {
  10:                 return (Throwable) method.invoke(throwable, ArrayUtils.EMPTY_OBJECT_ARRAY);
  11:             } catch (IllegalAccessException ignored) {
  12:         ...
  13:         if (throwable == null) {
  14:             return ArrayUtils.EMPTY_STRING_ARRAY;

View Full Code Here

indexOf

public static int indexOf(int[] array,
                          int valueToFind,
                          int startIndex)
Finds the index of the given value 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).

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
startIndex - the index to start searching at
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

indexOf

public 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.

Parameters:
array - the array to search through for the object, may be null
objectToFind - the object to find, may be null
Returns:
the index of the object within the array, INDEX_NOT_FOUND (-1) if not found or null array input
Usages and Demos :

View More Examples of indexOf(Object[] array,Object objectToFind)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.ClassUtils;
   4:         ...
   5:         synchronized(CAUSE_METHOD_NAMES) {
   6:             return ArrayUtils.indexOf(CAUSE_METHOD_NAMES, methodName) >= 0;
   7:         }
   8:         ...
   9:             try {
  10:                 return (Throwable) method.invoke(throwable, ArrayUtils.EMPTY_OBJECT_ARRAY);
  11:             } catch (IllegalAccessException ignored) {
  12:         ...
  13:         if (throwable == null) {
  14:             return ArrayUtils.EMPTY_STRING_ARRAY;

View Full Code Here

indexOf

public 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).

Parameters:
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
Returns:
the index of the object within the array starting at the index, INDEX_NOT_FOUND (-1) if not found or null array input

indexOf

public static int indexOf(long[] array,
                          long valueToFind)
Finds the index of the given value in the array.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input
Usages and Demos :

View More Examples of indexOf(long[] array,long valueToFind)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.ClassUtils;
   4:         ...
   5:         synchronized(CAUSE_METHOD_NAMES) {
   6:             return ArrayUtils.indexOf(CAUSE_METHOD_NAMES, methodName) >= 0;
   7:         }
   8:         ...
   9:             try {
  10:                 return (Throwable) method.invoke(throwable, ArrayUtils.EMPTY_OBJECT_ARRAY);
  11:             } catch (IllegalAccessException ignored) {
  12:         ...
  13:         if (throwable == null) {
  14:             return ArrayUtils.EMPTY_STRING_ARRAY;

View Full Code Here

indexOf

public static int indexOf(long[] array,
                          long valueToFind,
                          int startIndex)
Finds the index of the given value 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).

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
startIndex - the index to start searching at
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

indexOf

public static int indexOf(short[] array,
                          short valueToFind)
Finds the index of the given value in the array.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input
Usages and Demos :

View More Examples of indexOf(short[] array,short valueToFind)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.ClassUtils;
   4:         ...
   5:         synchronized(CAUSE_METHOD_NAMES) {
   6:             return ArrayUtils.indexOf(CAUSE_METHOD_NAMES, methodName) >= 0;
   7:         }
   8:         ...
   9:             try {
  10:                 return (Throwable) method.invoke(throwable, ArrayUtils.EMPTY_OBJECT_ARRAY);
  11:             } catch (IllegalAccessException ignored) {
  12:         ...
  13:         if (throwable == null) {
  14:             return ArrayUtils.EMPTY_STRING_ARRAY;

View Full Code Here

indexOf

public static int indexOf(short[] array,
                          short valueToFind,
                          int startIndex)
Finds the index of the given value 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).

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
startIndex - the index to start searching at
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

isEmpty

public static boolean isEmpty(boolean[] array)
Checks if an array of primitive booleans is empty or null.
Parameters:
array - the array to test
Returns:
true if the array is empty or null
Since:
2.1

isEmpty

public static boolean isEmpty(byte[] array)
Checks if an array of primitive bytes is empty or null.
Parameters:
array - the array to test
Returns:
true if the array is empty or null
Since:
2.1

isEmpty

public static boolean isEmpty(char[] array)
Checks if an array of primitive chars is empty or null.
Parameters:
array - the array to test
Returns:
true if the array is empty or null
Since:
2.1

isEmpty

public static boolean isEmpty(double[] array)
Checks if an array of primitive doubles is empty or null.
Parameters:
array - the array to test
Returns:
true if the array is empty or null
Since:
2.1

isEmpty

public static boolean isEmpty(float[] array)
Checks if an array of primitive floats is empty or null.
Parameters:
array - the array to test
Returns:
true if the array is empty or null
Since:
2.1

isEmpty

public static boolean isEmpty(int[] array)
Checks if an array of primitive ints is empty or null.
Parameters:
array - the array to test
Returns:
true if the array is empty or null
Since:
2.1

isEmpty

public static boolean isEmpty(Object[] array)
Checks if an array of Objects is empty or null.
Parameters:
array - the array to test
Returns:
true if the array is empty or null
Since:
2.1

isEmpty

public static boolean isEmpty(long[] array)
Checks if an array of primitive longs is empty or null.
Parameters:
array - the array to test
Returns:
true if the array is empty or null
Since:
2.1

isEmpty

public static boolean isEmpty(short[] array)
Checks if an array of primitive shorts is empty or null.
Parameters:
array - the array to test
Returns:
true if the array is empty or null
Since:
2.1

isEquals

public static boolean isEquals(Object array1,
                               Object array2)
Compares two arrays, using equals(), handling multi-dimensional arrays correctly.

Multi-dimensional primitive arrays are also handled correctly by this method.

Parameters:
array1 - the left hand array to compare, may be null
array2 - the right hand array to compare, may be null
Returns:
true if the arrays are equal
Usages and Demos :

View More Examples of isEquals(Object array1,Object array2)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.ObjectUtils;
   4:         ...
   5:     public static boolean isEquals(byte[] object1, byte[] object2) {
   6:         return ArrayUtils.isEquals(object1, object2);
   7:     }
   8: 
   9:     public static boolean isEquals(char[] object1, char[] object2) {

View Full Code Here

isSameLength

public static boolean isSameLength(boolean[] array1,
                                   boolean[] array2)
Checks whether two arrays are the same length, treating null arrays as length 0.
Parameters:
array1 - the first array, may be null
array2 - the second array, may be null
Returns:
true if length of arrays matches, treating null as an empty array

isSameLength

public static boolean isSameLength(byte[] array1,
                                   byte[] array2)
Checks whether two arrays are the same length, treating null arrays as length 0.
Parameters:
array1 - the first array, may be null
array2 - the second array, may be null
Returns:
true if length of arrays matches, treating null as an empty array

isSameLength

public static boolean isSameLength(char[] array1,
                                   char[] array2)
Checks whether two arrays are the same length, treating null arrays as length 0.
Parameters:
array1 - the first array, may be null
array2 - the second array, may be null
Returns:
true if length of arrays matches, treating null as an empty array

isSameLength

public static boolean isSameLength(double[] array1,
                                   double[] array2)
Checks whether two arrays are the same length, treating null arrays as length 0.
Parameters:
array1 - the first array, may be null
array2 - the second array, may be null
Returns:
true if length of arrays matches, treating null as an empty array

isSameLength

public static boolean isSameLength(float[] array1,
                                   float[] array2)
Checks whether two arrays are the same length, treating null arrays as length 0.
Parameters:
array1 - the first array, may be null
array2 - the second array, may be null
Returns:
true if length of arrays matches, treating null as an empty array

isSameLength

public static boolean isSameLength(int[] array1,
                                   int[] array2)
Checks whether two arrays are the same length, treating null arrays as length 0.
Parameters:
array1 - the first array, may be null
array2 - the second array, may be null
Returns:
true if length of arrays matches, treating null as an empty array

isSameLength

public static boolean isSameLength(Object[] array1,
                                   Object[] array2)
Checks whether two arrays are the same length, treating null arrays as length 0.

Any multi-dimensional aspects of the arrays are ignored.

Parameters:
array1 - the first array, may be null
array2 - the second array, may be null
Returns:
true if length of arrays matches, treating null as an empty array

isSameLength

public static boolean isSameLength(long[] array1,
                                   long[] array2)
Checks whether two arrays are the same length, treating null arrays as length 0.
Parameters:
array1 - the first array, may be null
array2 - the second array, may be null
Returns:
true if length of arrays matches, treating null as an empty array

isSameLength

public static boolean isSameLength(short[] array1,
                                   short[] array2)
Checks whether two arrays are the same length, treating null arrays as length 0.
Parameters:
array1 - the first array, may be null
array2 - the second array, may be null
Returns:
true if length of arrays matches, treating null as an empty array

isSameType

public static boolean isSameType(Object array1,
                                 Object array2)
Checks whether two arrays are the same type taking into account multi-dimensional arrays.
Parameters:
array1 - the first array, must not be null
array2 - the second array, must not be null
Returns:
true if type of arrays matches
Throws:
IllegalArgumentException - if either array is null

lastIndexOf

public static int lastIndexOf(boolean[] array,
                              boolean valueToFind)
Finds the last index of the given value within the array.

This method returns INDEX_NOT_FOUND (-1) if null array input.

Parameters:
array - the array to travers backwords looking for the object, may be null
valueToFind - the object to find
Returns:
the last index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

lastIndexOf

public static int lastIndexOf(boolean[] array,
                              boolean valueToFind,
                              int startIndex)
Finds the last index of the given value in the array starting at the given index.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

A negative startIndex will return INDEX_NOT_FOUND (-1). A startIndex larger than the array length will search from the end of the array.

Parameters:
array - the array to traverse for looking for the object, may be null
valueToFind - the value to find
startIndex - the start index to travers backwards from
Returns:
the last index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

lastIndexOf

public static int lastIndexOf(byte[] array,
                              byte valueToFind)
Finds the last index of the given value within the array.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to travers backwords looking for the object, may be null
valueToFind - the object to find
Returns:
the last index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

lastIndexOf

public static int lastIndexOf(byte[] array,
                              byte valueToFind,
                              int startIndex)
Finds the last index of the given value in the array starting at the given index.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

A negative startIndex will return INDEX_NOT_FOUND (-1). A startIndex larger than the array length will search from the end of the array.

Parameters:
array - the array to traverse for looking for the object, may be null
valueToFind - the value to find
startIndex - the start index to travers backwards from
Returns:
the last index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

lastIndexOf

public static int lastIndexOf(char[] array,
                              char valueToFind)
Finds the last index of the given value within the array.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to travers backwords looking for the object, may be null
valueToFind - the object to find
Returns:
the last index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input
Since:
2.1

lastIndexOf

public static int lastIndexOf(char[] array,
                              char valueToFind,
                              int startIndex)
Finds the last index of the given value in the array starting at the given index.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

A negative startIndex will return INDEX_NOT_FOUND (-1). A startIndex larger than the array length will search from the end of the array.

Parameters:
array - the array to traverse for looking for the object, may be null
valueToFind - the value to find
startIndex - the start index to travers backwards from
Returns:
the last index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input
Since:
2.1

lastIndexOf

public static int lastIndexOf(double[] array,
                              double valueToFind)
Finds the last index of the given value within the array.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to travers backwords looking for the object, may be null
valueToFind - the object to find
Returns:
the last index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

lastIndexOf

public static int lastIndexOf(double[] array,
                              double valueToFind,
                              double tolerance)
Finds the last index of the given value within a given tolerance in the array. This method will return the index of the last value which falls between the region defined by valueToFind - tolerance and valueToFind + tolerance.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to search through for the object, may be null
valueToFind - the value to find
tolerance - tolerance of the search
Returns:
the index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

lastIndexOf

public static int lastIndexOf(double[] array,
                              double valueToFind,
                              int startIndex)
Finds the last index of the given value in the array starting at the given index.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

A negative startIndex will return INDEX_NOT_FOUND (-1). A startIndex larger than the array length will search from the end of the array.

Parameters:
array - the array to traverse for looking for the object, may be null
valueToFind - the value to find
startIndex - the start index to travers backwards from
Returns:
the last index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

lastIndexOf

public static int lastIndexOf(double[] array,
                              double valueToFind,
                              int startIndex,
                              double tolerance)
Finds the last index of the given value in the array starting at the given index. This method will return the index of the last value which falls between the region defined by valueToFind - tolerance and valueToFind + tolerance.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

A negative startIndex will return INDEX_NOT_FOUND (-1). A startIndex larger than the array length will search from the end of the array.

Parameters:
array - the array to traverse for looking for the object, may be null
valueToFind - the value to find
startIndex - the start index to travers backwards from
tolerance - search for value within plus/minus this amount
Returns:
the last index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

lastIndexOf

public static int lastIndexOf(float[] array,
                              float valueToFind)
Finds the last index of the given value within the array.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to travers backwords looking for the object, may be null
valueToFind - the object to find
Returns:
the last index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

lastIndexOf

public static int lastIndexOf(float[] array,
                              float valueToFind,
                              int startIndex)
Finds the last index of the given value in the array starting at the given index.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

A negative startIndex will return INDEX_NOT_FOUND (-1). A startIndex larger than the array length will search from the end of the array.

Parameters:
array - the array to traverse for looking for the object, may be null
valueToFind - the value to find
startIndex - the start index to travers backwards from
Returns:
the last index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

lastIndexOf

public static int lastIndexOf(int[] array,
                              int valueToFind)
Finds the last index of the given value within the array.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to travers backwords looking for the object, may be null
valueToFind - the object to find
Returns:
the last index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

lastIndexOf

public static int lastIndexOf(int[] array,
                              int valueToFind,
                              int startIndex)
Finds the last index of the given value in the array starting at the given index.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

A negative startIndex will return INDEX_NOT_FOUND (-1). A startIndex larger than the array length will search from the end of the array.

Parameters:
array - the array to traverse for looking for the object, may be null
valueToFind - the value to find
startIndex - the start index to travers backwards from
Returns:
the last index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

lastIndexOf

public static int lastIndexOf(Object[] array,
                              Object objectToFind)
Finds the last index of the given object within the array.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to travers backwords looking for the object, may be null
objectToFind - the object to find, may be null
Returns:
the last index of the object within the array, INDEX_NOT_FOUND (-1) if not found or null array input

lastIndexOf

public static int lastIndexOf(Object[] array,
                              Object objectToFind,
                              int startIndex)
Finds the last 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 will return INDEX_NOT_FOUND (-1). A startIndex larger than the array length will search from the end of the array.

Parameters:
array - the array to traverse for looking for the object, may be null
objectToFind - the object to find, may be null
startIndex - the start index to travers backwards from
Returns:
the last index of the object within the array, INDEX_NOT_FOUND (-1) if not found or null array input

lastIndexOf

public static int lastIndexOf(long[] array,
                              long valueToFind)
Finds the last index of the given value within the array.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to travers backwords looking for the object, may be null
valueToFind - the object to find
Returns:
the last index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

lastIndexOf

public static int lastIndexOf(long[] array,
                              long valueToFind,
                              int startIndex)
Finds the last index of the given value in the array starting at the given index.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

A negative startIndex will return INDEX_NOT_FOUND (-1). A startIndex larger than the array length will search from the end of the array.

Parameters:
array - the array to traverse for looking for the object, may be null
valueToFind - the value to find
startIndex - the start index to travers backwards from
Returns:
the last index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

lastIndexOf

public static int lastIndexOf(short[] array,
                              short valueToFind)
Finds the last index of the given value within the array.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to travers backwords looking for the object, may be null
valueToFind - the object to find
Returns:
the last index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

lastIndexOf

public static int lastIndexOf(short[] array,
                              short valueToFind,
                              int startIndex)
Finds the last index of the given value in the array starting at the given index.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

A negative startIndex will return INDEX_NOT_FOUND (-1). A startIndex larger than the array length will search from the end of the array.

Parameters:
array - the array to traverse for looking for the object, may be null
valueToFind - the value to find
startIndex - the start index to travers backwards from
Returns:
the last index of the value within the array, INDEX_NOT_FOUND (-1) if not found or null array input

remove

public static boolean[] remove(boolean[] array,
                               int index)
Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (substracts one from their indices).

This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array.

If the input array is null, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.

 ArrayUtils.remove([true], 0)              = []
 ArrayUtils.remove([true, false], 0)       = [false]
 ArrayUtils.remove([true, false], 1)       = [true]
 ArrayUtils.remove([true, true, false], 1) = [true, false]
 
Parameters:
array - the array to remove the element from, may not be null
index - the position of the element to be removed
Returns:
A new array containing the existing elements except the element at the specified position.
Throws:
IndexOutOfBoundsException - if the index is out of range (index <320 || index >= array.length), or if the array is null.
Since:
2.1
Usages and Demos :

View More Examples of remove(boolean[] array,int index)
   1: import org.apache.commons.lang.builder.ToStringBuilder;
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.ojb.broker.MtoNImplementor;
   4:         ...
   5:         {
   6:             int index = ArrayUtils.indexOf(pkColumns, otherPkColumns[i]);
   7:             if(index != -1)
   8:         ...
   9:             {
  10:                 pkColumns = (String[]) ArrayUtils.remove(pkColumns, index);
  11:         ...
  12:                 pkValues = (ValueContainer[]) ArrayUtils.remove(pkValues, index);

View Full Code Here

remove

public static byte[] remove(byte[] array,
                            int index)
Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (substracts one from their indices).

This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array.

If the input array is null, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.

 ArrayUtils.remove([1], 0)          = []
 ArrayUtils.remove([1, 0], 0)       = [0]
 ArrayUtils.remove([1, 0], 1)       = [1]
 ArrayUtils.remove([1, 0, 1], 1)    = [1, 1]
 
Parameters:
array - the array to remove the element from, may not be null
index - the position of the element to be removed
Returns:
A new array containing the existing elements except the element at the specified position.
Throws:
IndexOutOfBoundsException - if the index is out of range (index <320 || index >= array.length), or if the array is null.
Since:
2.1
Usages and Demos :

View More Examples of remove(byte[] array,int index)
   1: import org.apache.commons.lang.builder.ToStringBuilder;
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.ojb.broker.MtoNImplementor;
   4:         ...
   5:         {
   6:             int index = ArrayUtils.indexOf(pkColumns, otherPkColumns[i]);
   7:             if(index != -1)
   8:         ...
   9:             {
  10:                 pkColumns = (String[]) ArrayUtils.remove(pkColumns, index);
  11:         ...
  12:                 pkValues = (ValueContainer[]) ArrayUtils.remove(pkValues, index);

View Full Code Here

remove

public static char[] remove(char[] array,
                            int index)
Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (substracts one from their indices).

This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array.

If the input array is null, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.

 ArrayUtils.remove(['a'], 0)           = []
 ArrayUtils.remove(['a', 'b'], 0)      = ['b']
 ArrayUtils.remove(['a', 'b'], 1)      = ['a']
 ArrayUtils.remove(['a', 'b', 'c'], 1) = ['a', 'c']
 
Parameters:
array - the array to remove the element from, may not be null
index - the position of the element to be removed
Returns:
A new array containing the existing elements except the element at the specified position.
Throws:
IndexOutOfBoundsException - if the index is out of range (index <320 || index >= array.length), or if the array is null.
Since:
2.1
Usages and Demos :

View More Examples of remove(char[] array,int index)
   1: import org.apache.commons.lang.builder.ToStringBuilder;
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.ojb.broker.MtoNImplementor;
   4:         ...
   5:         {
   6:             int index = ArrayUtils.indexOf(pkColumns, otherPkColumns[i]);
   7:             if(index != -1)
   8:         ...
   9:             {
  10:                 pkColumns = (String[]) ArrayUtils.remove(pkColumns, index);
  11:         ...
  12:                 pkValues = (ValueContainer[]) ArrayUtils.remove(pkValues, index);

View Full Code Here

remove

public static double[] remove(double[] array,
                              int index)
Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (substracts one from their indices).

This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array.

If the input array is null, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.

 ArrayUtils.remove([1.1], 0)           = []
 ArrayUtils.remove([2.5, 6.0], 0)      = [6.0]
 ArrayUtils.remove([2.5, 6.0], 1)      = [2.5]
 ArrayUtils.remove([2.5, 6.0, 3.8], 1) = [2.5, 3.8]
 
Parameters:
array - the array to remove the element from, may not be null
index - the position of the element to be removed
Returns:
A new array containing the existing elements except the element at the specified position.
Throws:
IndexOutOfBoundsException - if the index is out of range (index <320 || index >= array.length), or if the array is null.
Since:
2.1
Usages and Demos :

View More Examples of remove(double[] array,int index)
   1: import org.apache.commons.lang.builder.ToStringBuilder;
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.ojb.broker.MtoNImplementor;
   4:         ...
   5:         {
   6:             int index = ArrayUtils.indexOf(pkColumns, otherPkColumns[i]);
   7:             if(index != -1)
   8:         ...
   9:             {
  10:                 pkColumns = (String[]) ArrayUtils.remove(pkColumns, index);
  11:         ...
  12:                 pkValues = (ValueContainer[]) ArrayUtils.remove(pkValues, index);

View Full Code Here

remove

public static float[] remove(float[] array,
                             int index)
Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (substracts one from their indices).

This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array.

If the input array is null, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.

 ArrayUtils.remove([1.1], 0)           = []
 ArrayUtils.remove([2.5, 6.0], 0)      = [6.0]
 ArrayUtils.remove([2.5, 6.0], 1)      = [2.5]
 ArrayUtils.remove([2.5, 6.0, 3.8], 1) = [2.5, 3.8]
 
Parameters:
array - the array to remove the element from, may not be null
index - the position of the element to be removed
Returns:
A new array containing the existing elements except the element at the specified position.
Throws:
IndexOutOfBoundsException - if the index is out of range (index <320 || index >= array.length), or if the array is null.
Since:
2.1
Usages and Demos :

View More Examples of remove(float[] array,int index)
   1: import org.apache.commons.lang.builder.ToStringBuilder;
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.ojb.broker.MtoNImplementor;
   4:         ...
   5:         {
   6:             int index = ArrayUtils.indexOf(pkColumns, otherPkColumns[i]);
   7:             if(index != -1)
   8:         ...
   9:             {
  10:                 pkColumns = (String[]) ArrayUtils.remove(pkColumns, index);
  11:         ...
  12:                 pkValues = (ValueContainer[]) ArrayUtils.remove(pkValues, index);

View Full Code Here

remove

public static int[] remove(int[] array,
                           int index)
Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (substracts one from their indices).

This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array.

If the input array is null, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.

 ArrayUtils.remove([1], 0)         = []
 ArrayUtils.remove([2, 6], 0)      = [6]
 ArrayUtils.remove([2, 6], 1)      = [2]
 ArrayUtils.remove([2, 6, 3], 1)   = [2, 3]
 
Parameters:
array - the array to remove the element from, may not be null
index - the position of the element to be removed
Returns:
A new array containing the existing elements except the element at the specified position.
Throws:
IndexOutOfBoundsException - if the index is out of range (index <320 || index >= array.length), or if the array is null.
Since:
2.1
Usages and Demos :

View More Examples of remove(int[] array,int index)
   1: import org.apache.commons.lang.builder.ToStringBuilder;
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.ojb.broker.MtoNImplementor;
   4:         ...
   5:         {
   6:             int index = ArrayUtils.indexOf(pkColumns, otherPkColumns[i]);
   7:             if(index != -1)
   8:         ...
   9:             {
  10:                 pkColumns = (String[]) ArrayUtils.remove(pkColumns, index);
  11:         ...
  12:                 pkValues = (ValueContainer[]) ArrayUtils.remove(pkValues, index);

View Full Code Here

remove

public static Object[] remove(Object[] array,
                              int index)
Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (substracts one from their indices).

This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array.

If the input array is null, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.

 ArrayUtils.remove(["a"], 0)           = []
 ArrayUtils.remove(["a", "b"], 0)      = ["b"]
 ArrayUtils.remove(["a", "b"], 1)      = ["a"]
 ArrayUtils.remove(["a", "b", "c"], 1) = ["a", "c"]
 
Parameters:
array - the array to remove the element from, may not be null
index - the position of the element to be removed
Returns:
A new array containing the existing elements except the element at the specified position.
Throws:
IndexOutOfBoundsException - if the index is out of range (index <320 || index >= array.length), or if the array is null.
Since:
2.1
Usages and Demos :

View More Examples of remove(Object[] array,int index)
   1: import org.apache.commons.lang.builder.ToStringBuilder;
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.ojb.broker.MtoNImplementor;
   4:         ...
   5:         {
   6:             int index = ArrayUtils.indexOf(pkColumns, otherPkColumns[i]);
   7:             if(index != -1)
   8:         ...
   9:             {
  10:                 pkColumns = (String[]) ArrayUtils.remove(pkColumns, index);
  11:         ...
  12:                 pkValues = (ValueContainer[]) ArrayUtils.remove(pkValues, index);

View Full Code Here

remove

public static long[] remove(long[] array,
                            int index)
Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (substracts one from their indices).

This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array.

If the input array is null, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.

 ArrayUtils.remove([1], 0)         = []
 ArrayUtils.remove([2, 6], 0)      = [6]
 ArrayUtils.remove([2, 6], 1)      = [2]
 ArrayUtils.remove([2, 6, 3], 1)   = [2, 3]
 
Parameters:
array - the array to remove the element from, may not be null
index - the position of the element to be removed
Returns:
A new array containing the existing elements except the element at the specified position.
Throws:
IndexOutOfBoundsException - if the index is out of range (index <320 || index >= array.length), or if the array is null.
Since:
2.1
Usages and Demos :

View More Examples of remove(long[] array,int index)
   1: import org.apache.commons.lang.builder.ToStringBuilder;
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.ojb.broker.MtoNImplementor;
   4:         ...
   5:         {
   6:             int index = ArrayUtils.indexOf(pkColumns, otherPkColumns[i]);
   7:             if(index != -1)
   8:         ...
   9:             {
  10:                 pkColumns = (String[]) ArrayUtils.remove(pkColumns, index);
  11:         ...
  12:                 pkValues = (ValueContainer[]) ArrayUtils.remove(pkValues, index);

View Full Code Here

remove

public static short[] remove(short[] array,
                             int index)
Removes the element at the specified position from the specified array. All subsequent elements are shifted to the left (substracts one from their indices).

This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array.

If the input array is null, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.

 ArrayUtils.remove([1], 0)         = []
 ArrayUtils.remove([2, 6], 0)      = [6]
 ArrayUtils.remove([2, 6], 1)      = [2]
 ArrayUtils.remove([2, 6, 3], 1)   = [2, 3]
 
Parameters:
array - the array to remove the element from, may not be null
index - the position of the element to be removed
Returns:
A new array containing the existing elements except the element at the specified position.
Throws:
IndexOutOfBoundsException - if the index is out of range (index <320 || index >= array.length), or if the array is null.
Since:
2.1
Usages and Demos :

View More Examples of remove(short[] array,int index)
   1: import org.apache.commons.lang.builder.ToStringBuilder;
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.ojb.broker.MtoNImplementor;
   4:         ...
   5:         {
   6:             int index = ArrayUtils.indexOf(pkColumns, otherPkColumns[i]);
   7:             if(index != -1)
   8:         ...
   9:             {
  10:                 pkColumns = (String[]) ArrayUtils.remove(pkColumns, index);
  11:         ...
  12:                 pkValues = (ValueContainer[]) ArrayUtils.remove(pkValues, index);

View Full Code Here

removeElement

public static boolean[] removeElement(boolean[] array,
                                      boolean element)
Removes the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (substracts one from their indices). If the array doesn't contains such an element, no elements are removed from the array.

This method returns a new array with the same elements of the input array except the first occurrence of the specified element. The component type of the returned array is always the same as that of the input array.

 ArrayUtils.removeElement(null, true)                = null
 ArrayUtils.removeElement([], true)                  = []
 ArrayUtils.removeElement([true], false)             = [true]
 ArrayUtils.removeElement([true, false], false)      = [true]
 ArrayUtils.removeElement([true, false, true], true) = [false, true]
 
Parameters:
array - the array to remove the element from, may be null
element - the element to be removed
Returns:
A new array containing the existing elements except the first occurrence of the specified element.
Since:
2.1

removeElement

public static byte[] removeElement(byte[] array,
                                   byte element)
Removes the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (substracts one from their indices). If the array doesn't contains such an element, no elements are removed from the array.

This method returns a new array with the same elements of the input array except the first occurrence of the specified element. The component type of the returned array is always the same as that of the input array.

 ArrayUtils.removeElement(null, 1)        = null
 ArrayUtils.removeElement([], 1)          = []
 ArrayUtils.removeElement([1], 0)         = [1]
 ArrayUtils.removeElement([1, 0], 0)      = [1]
 ArrayUtils.removeElement([1, 0, 1], 1)   = [0, 1]
 
Parameters:
array - the array to remove the element from, may be null
element - the element to be removed
Returns:
A new array containing the existing elements except the first occurrence of the specified element.
Since:
2.1

removeElement

public static char[] removeElement(char[] array,
                                   char element)
Removes the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (substracts one from their indices). If the array doesn't contains such an element, no elements are removed from the array.

This method returns a new array with the same elements of the input array except the first occurrence of the specified element. The component type of the returned array is always the same as that of the input array.

 ArrayUtils.removeElement(null, 'a')            = null
 ArrayUtils.removeElement([], 'a')              = []
 ArrayUtils.removeElement(['a'], 'b')           = ['a']
 ArrayUtils.removeElement(['a', 'b'], 'a')      = ['b']
 ArrayUtils.removeElement(['a', 'b', 'a'], 'a') = ['b', 'a']
 
Parameters:
array - the array to remove the element from, may be null
element - the element to be removed
Returns:
A new array containing the existing elements except the first occurrence of the specified element.
Since:
2.1

removeElement

public static double[] removeElement(double[] array,
                                     double element)
Removes the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (substracts one from their indices). If the array doesn't contains such an element, no elements are removed from the array.

This method returns a new array with the same elements of the input array except the first occurrence of the specified element. The component type of the returned array is always the same as that of the input array.

 ArrayUtils.removeElement(null, 1.1)            = null
 ArrayUtils.removeElement([], 1.1)              = []
 ArrayUtils.removeElement([1.1], 1.2)           = [1.1]
 ArrayUtils.removeElement([1.1, 2.3], 1.1)      = [2.3]
 ArrayUtils.removeElement([1.1, 2.3, 1.1], 1.1) = [2.3, 1.1]
 
Parameters:
array - the array to remove the element from, may be null
element - the element to be removed
Returns:
A new array containing the existing elements except the first occurrence of the specified element.
Since:
2.1

removeElement

public static float[] removeElement(float[] array,
                                    float element)
Removes the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (substracts one from their indices). If the array doesn't contains such an element, no elements are removed from the array.

This method returns a new array with the same elements of the input array except the first occurrence of the specified element. The component type of the returned array is always the same as that of the input array.

 ArrayUtils.removeElement(null, 1.1)            = null
 ArrayUtils.removeElement([], 1.1)              = []
 ArrayUtils.removeElement([1.1], 1.2)           = [1.1]
 ArrayUtils.removeElement([1.1, 2.3], 1.1)      = [2.3]
 ArrayUtils.removeElement([1.1, 2.3, 1.1], 1.1) = [2.3, 1.1]
 
Parameters:
array - the array to remove the element from, may be null
element - the element to be removed
Returns:
A new array containing the existing elements except the first occurrence of the specified element.
Since:
2.1

removeElement

public static int[] removeElement(int[] array,
                                  int element)
Removes the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (substracts one from their indices). If the array doesn't contains such an element, no elements are removed from the array.

This method returns a new array with the same elements of the input array except the first occurrence of the specified element. The component type of the returned array is always the same as that of the input array.

 ArrayUtils.removeElement(null, 1)      = null
 ArrayUtils.removeElement([], 1)        = []
 ArrayUtils.removeElement([1], 2)       = [1]
 ArrayUtils.removeElement([1, 3], 1)    = [3]
 ArrayUtils.removeElement([1, 3, 1], 1) = [3, 1]
 
Parameters:
array - the array to remove the element from, may be null
element - the element to be removed
Returns:
A new array containing the existing elements except the first occurrence of the specified element.
Since:
2.1

removeElement

public static Object[] removeElement(Object[] array,
                                     Object element)
Removes the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (substracts one from their indices). If the array doesn't contains such an element, no elements are removed from the array.

This method returns a new array with the same elements of the input array except the first occurrence of the specified element. The component type of the returned array is always the same as that of the input array.

 ArrayUtils.removeElement(null, "a")            = null
 ArrayUtils.removeElement([], "a")              = []
 ArrayUtils.removeElement(["a"], "b")           = ["a"]
 ArrayUtils.removeElement(["a", "b"], "a")      = ["b"]
 ArrayUtils.removeElement(["a", "b", "a"], "a") = ["b", "a"]
 
Parameters:
array - the array to remove the element from, may be null
element - the element to be removed
Returns:
A new array containing the existing elements except the first occurrence of the specified element.
Since:
2.1

removeElement

public static long[] removeElement(long[] array,
                                   long element)
Removes the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (substracts one from their indices). If the array doesn't contains such an element, no elements are removed from the array.

This method returns a new array with the same elements of the input array except the first occurrence of the specified element. The component type of the returned array is always the same as that of the input array.

 ArrayUtils.removeElement(null, 1)      = null
 ArrayUtils.removeElement([], 1)        = []
 ArrayUtils.removeElement([1], 2)       = [1]
 ArrayUtils.removeElement([1, 3], 1)    = [3]
 ArrayUtils.removeElement([1, 3, 1], 1) = [3, 1]
 
Parameters:
array - the array to remove the element from, may be null
element - the element to be removed
Returns:
A new array containing the existing elements except the first occurrence of the specified element.
Since:
2.1

removeElement

public static short[] removeElement(short[] array,
                                    short element)
Removes the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (substracts one from their indices). If the array doesn't contains such an element, no elements are removed from the array.

This method returns a new array with the same elements of the input array except the first occurrence of the specified element. The component type of the returned array is always the same as that of the input array.

 ArrayUtils.removeElement(null, 1)      = null
 ArrayUtils.removeElement([], 1)        = []
 ArrayUtils.removeElement([1], 2)       = [1]
 ArrayUtils.removeElement([1, 3], 1)    = [3]
 ArrayUtils.removeElement([1, 3, 1], 1) = [3, 1]
 
Parameters:
array - the array to remove the element from, may be null
element - the element to be removed
Returns:
A new array containing the existing elements except the first occurrence of the specified element.
Since:
2.1

reverse

public static void reverse(boolean[] array)
Reverses the order of the given array.

This method does nothing for a null input array.

Parameters:
array - the array to reverse, may be null

reverse

public static void reverse(byte[] array)
Reverses the order of the given array.

This method does nothing for a null input array.

Parameters:
array - the array to reverse, may be null

reverse

public static void reverse(char[] array)
Reverses the order of the given array.

This method does nothing for a null input array.

Parameters:
array - the array to reverse, may be null

reverse

public static void reverse(double[] array)
Reverses the order of the given array.

This method does nothing for a null input array.

Parameters:
array - the array to reverse, may be null

reverse

public static void reverse(float[] array)
Reverses the order of the given array.

This method does nothing for a null input array.

Parameters:
array - the array to reverse, may be null

reverse

public static void reverse(int[] array)
Reverses the order of the given array.

This method does nothing for a null input array.

Parameters:
array - the array to reverse, may be null

reverse

public static void reverse(Object[] array)
Reverses the order of the given array.

There is no special handling for multi-dimensional arrays.

This method does nothing for a null input array.

Parameters:
array - the array to reverse, may be null

reverse

public static void reverse(long[] array)
Reverses the order of the given array.

This method does nothing for a null input array.

Parameters:
array - the array to reverse, may be null

reverse

public static void reverse(short[] array)
Reverses the order of the given array.

This method does nothing for a null input array.

Parameters:
array - the array to reverse, may be null

subarray

public static boolean[] subarray(boolean[] array,
                                 int startIndexInclusive,
                                 int endIndexExclusive)
Produces a new boolean array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive. Null array input produces null output.

Parameters:
array - the array
startIndexInclusive - the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.
endIndexExclusive - elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.
Returns:
a new array containing the elements between the start and end indices.
Since:
2.1
Usages and Demos :

View More Examples of subarray(boolean[] array,int startIndexInclusive,int endIndexExclusive)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:     public static byte[] subarray(byte[] data, int beginIndex, int endIndex) {
   6:         return ArrayUtils.subarray(data, beginIndex, endIndex);
   7:     }
   8:         ...
   9:     public static byte[] add (byte[] data1, byte[] data2) {
  10:         return ArrayUtils.addAll(data1, data2);
  11:     }

View Full Code Here

subarray

public static byte[] subarray(byte[] array,
                              int startIndexInclusive,
                              int endIndexExclusive)
Produces a new byte array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive. Null array input produces null output.

Parameters:
array - the array
startIndexInclusive - the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.
endIndexExclusive - elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.
Returns:
a new array containing the elements between the start and end indices.
Since:
2.1
Usages and Demos :

View More Examples of subarray(byte[] array,int startIndexInclusive,int endIndexExclusive)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:     public static byte[] subarray(byte[] data, int beginIndex, int endIndex) {
   6:         return ArrayUtils.subarray(data, beginIndex, endIndex);
   7:     }
   8:         ...
   9:     public static byte[] add (byte[] data1, byte[] data2) {
  10:         return ArrayUtils.addAll(data1, data2);
  11:     }

View Full Code Here

subarray

public static char[] subarray(char[] array,
                              int startIndexInclusive,
                              int endIndexExclusive)
Produces a new char array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive. Null array input produces null output.

Parameters:
array - the array
startIndexInclusive - the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.
endIndexExclusive - elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.
Returns:
a new array containing the elements between the start and end indices.
Since:
2.1
Usages and Demos :

View More Examples of subarray(char[] array,int startIndexInclusive,int endIndexExclusive)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:     public static byte[] subarray(byte[] data, int beginIndex, int endIndex) {
   6:         return ArrayUtils.subarray(data, beginIndex, endIndex);
   7:     }
   8:         ...
   9:     public static byte[] add (byte[] data1, byte[] data2) {
  10:         return ArrayUtils.addAll(data1, data2);
  11:     }

View Full Code Here

subarray

public static double[] subarray(double[] array,
                                int startIndexInclusive,
                                int endIndexExclusive)
Produces a new double array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive. Null array input produces null output.

Parameters:
array - the array
startIndexInclusive - the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.
endIndexExclusive - elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.
Returns:
a new array containing the elements between the start and end indices.
Since:
2.1
Usages and Demos :

View More Examples of subarray(double[] array,int startIndexInclusive,int endIndexExclusive)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:     public static byte[] subarray(byte[] data, int beginIndex, int endIndex) {
   6:         return ArrayUtils.subarray(data, beginIndex, endIndex);
   7:     }
   8:         ...
   9:     public static byte[] add (byte[] data1, byte[] data2) {
  10:         return ArrayUtils.addAll(data1, data2);
  11:     }

View Full Code Here

subarray

public static float[] subarray(float[] array,
                               int startIndexInclusive,
                               int endIndexExclusive)
Produces a new float array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive. Null array input produces null output.

Parameters:
array - the array
startIndexInclusive - the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.
endIndexExclusive - elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.
Returns:
a new array containing the elements between the start and end indices.
Since:
2.1
Usages and Demos :

View More Examples of subarray(float[] array,int startIndexInclusive,int endIndexExclusive)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:     public static byte[] subarray(byte[] data, int beginIndex, int endIndex) {
   6:         return ArrayUtils.subarray(data, beginIndex, endIndex);
   7:     }
   8:         ...
   9:     public static byte[] add (byte[] data1, byte[] data2) {
  10:         return ArrayUtils.addAll(data1, data2);
  11:     }

View Full Code Here

subarray

public static int[] subarray(int[] array,
                             int startIndexInclusive,
                             int endIndexExclusive)
Produces a new int array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive. Null array input produces null output.

Parameters:
array - the array
startIndexInclusive - the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.
endIndexExclusive - elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.
Returns:
a new array containing the elements between the start and end indices.
Since:
2.1
Usages and Demos :

View More Examples of subarray(int[] array,int startIndexInclusive,int endIndexExclusive)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:     public static byte[] subarray(byte[] data, int beginIndex, int endIndex) {
   6:         return ArrayUtils.subarray(data, beginIndex, endIndex);
   7:     }
   8:         ...
   9:     public static byte[] add (byte[] data1, byte[] data2) {
  10:         return ArrayUtils.addAll(data1, data2);
  11:     }

View Full Code Here

subarray

public static Object[] subarray(Object[] array,
                                int startIndexInclusive,
                                int endIndexExclusive)
Produces a new array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive. Null array input produces null output.

The component type of the subarray is always the same as that of the input array. Thus, if the input is an array of type Date, the following usage is envisaged:

 Date[] someDates = (Date[])ArrayUtils.subarray(allDates, 2, 5);
 
Parameters:
array - the array
startIndexInclusive - the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.
endIndexExclusive - elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.
Returns:
a new array containing the elements between the start and end indices.
Since:
2.1
Usages and Demos :

View More Examples of subarray(Object[] array,int startIndexInclusive,int endIndexExclusive)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:     public static byte[] subarray(byte[] data, int beginIndex, int endIndex) {
   6:         return ArrayUtils.subarray(data, beginIndex, endIndex);
   7:     }
   8:         ...
   9:     public static byte[] add (byte[] data1, byte[] data2) {
  10:         return ArrayUtils.addAll(data1, data2);
  11:     }

View Full Code Here

subarray

public static long[] subarray(long[] array,
                              int startIndexInclusive,
                              int endIndexExclusive)
Produces a new long array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive. Null array input produces null output.

Parameters:
array - the array
startIndexInclusive - the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.
endIndexExclusive - elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.
Returns:
a new array containing the elements between the start and end indices.
Since:
2.1
Usages and Demos :

View More Examples of subarray(long[] array,int startIndexInclusive,int endIndexExclusive)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:     public static byte[] subarray(byte[] data, int beginIndex, int endIndex) {
   6:         return ArrayUtils.subarray(data, beginIndex, endIndex);
   7:     }
   8:         ...
   9:     public static byte[] add (byte[] data1, byte[] data2) {
  10:         return ArrayUtils.addAll(data1, data2);
  11:     }

View Full Code Here

subarray

public static short[] subarray(short[] array,
                               int startIndexInclusive,
                               int endIndexExclusive)
Produces a new short array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive. Null array input produces null output.

Parameters:
array - the array
startIndexInclusive - the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.
endIndexExclusive - elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.
Returns:
a new array containing the elements between the start and end indices.
Since:
2.1
Usages and Demos :

View More Examples of subarray(short[] array,int startIndexInclusive,int endIndexExclusive)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: 
   4:         ...
   5:     public static byte[] subarray(byte[] data, int beginIndex, int endIndex) {
   6:         return ArrayUtils.subarray(data, beginIndex, endIndex);
   7:     }
   8:         ...
   9:     public static byte[] add (byte[] data1, byte[] data2) {
  10:         return ArrayUtils.addAll(data1, data2);
  11:     }

View Full Code Here

toMap

public static Map<K,V> toMap(Object[] array)
Converts the given array into a Map. Each element of the array must be either a Map.Entry or an Array, containing at least two elements, where the first element is used as key and the second as value.

This method can be used to initialize:

 // Create a Map mapping colors.
 Map colorMap = MapUtils.toMap(new String[][] {{
     {"RED", "#FF0000"},
     {"GREEN", "#00FF00"},
     {"BLUE", "#0000FF"}});
 

This method returns null for a null input array.

Parameters:
array - an array whose elements are either a Map.Entry or an Array containing at least two elements, may be null
Returns:
a Map that was created from the array
Throws:
IllegalArgumentException - if one element of this Array is itself an Array containing less then two elements
IllegalArgumentException - if the array contains elements other than Map.Entry and an Array

toObject

public static Boolean[] toObject(boolean[] array)
Converts an array of primitive booleans to objects.

This method returns null for a null input array.

Parameters:
array - a boolean array
Returns:
a Boolean array, null if null array input
Usages and Demos :

View More Examples of toObject(boolean[] array)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.logging.Log;
   4:         ...
   5:                 if (object instanceof int[]) {
   6:                     return ArrayUtils.toObject((int[])object);
   7:                 } else if (object instanceof boolean[]) {
   8:         ...
   9:                     return ArrayUtils.toObject((boolean[])object);
  10:                 } else if (object instanceof long[]) {
  11:         ...
  12:                     return ArrayUtils.toObject((long[])object);

View Full Code Here

toObject

public static Byte[] toObject(byte[] array)
Converts an array of primitive bytes to objects.

This method returns null for a null input array.

Parameters:
array - a byte array
Returns:
a Byte array, null if null array input
Usages and Demos :

View More Examples of toObject(byte[] array)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.logging.Log;
   4:         ...
   5:                 if (object instanceof int[]) {
   6:                     return ArrayUtils.toObject((int[])object);
   7:                 } else if (object instanceof boolean[]) {
   8:         ...
   9:                     return ArrayUtils.toObject((boolean[])object);
  10:                 } else if (object instanceof long[]) {
  11:         ...
  12:                     return ArrayUtils.toObject((long[])object);

View Full Code Here

toObject

public static Character[] toObject(char[] array)
Converts an array of primitive chars to objects.

This method returns null for a null input array.

Parameters:
array - a char array
Returns:
a Character array, null if null array input
Usages and Demos :

View More Examples of toObject(char[] array)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.logging.Log;
   4:         ...
   5:                 if (object instanceof int[]) {
   6:                     return ArrayUtils.toObject((int[])object);
   7:                 } else if (object instanceof boolean[]) {
   8:         ...
   9:                     return ArrayUtils.toObject((boolean[])object);
  10:                 } else if (object instanceof long[]) {
  11:         ...
  12:                     return ArrayUtils.toObject((long[])object);

View Full Code Here

toObject

public static Double[] toObject(double[] array)
Converts an array of primitive doubles to objects.

This method returns null for a null input array.

Parameters:
array - a double array
Returns:
a Double array, null if null array input
Usages and Demos :

View More Examples of toObject(double[] array)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.logging.Log;
   4:         ...
   5:                 if (object instanceof int[]) {
   6:                     return ArrayUtils.toObject((int[])object);
   7:                 } else if (object instanceof boolean[]) {
   8:         ...
   9:                     return ArrayUtils.toObject((boolean[])object);
  10:                 } else if (object instanceof long[]) {
  11:         ...
  12:                     return ArrayUtils.toObject((long[])object);

View Full Code Here

toObject

public static Float[] toObject(float[] array)
Converts an array of primitive floats to objects.

This method returns null for a null input array.

Parameters:
array - a float array
Returns:
a Float array, null if null array input
Usages and Demos :

View More Examples of toObject(float[] array)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.logging.Log;
   4:         ...
   5:                 if (object instanceof int[]) {
   6:                     return ArrayUtils.toObject((int[])object);
   7:                 } else if (object instanceof boolean[]) {
   8:         ...
   9:                     return ArrayUtils.toObject((boolean[])object);
  10:                 } else if (object instanceof long[]) {
  11:         ...
  12:                     return ArrayUtils.toObject((long[])object);

View Full Code Here

toObject

public static Integer[] toObject(int[] array)
Converts an array of primitive ints to objects.

This method returns null for a null input array.

Parameters:
array - an int array
Returns:
an Integer array, null if null array input
Usages and Demos :

View More Examples of toObject(int[] array)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.logging.Log;
   4:         ...
   5:                 if (object instanceof int[]) {
   6:                     return ArrayUtils.toObject((int[])object);
   7:                 } else if (object instanceof boolean[]) {
   8:         ...
   9:                     return ArrayUtils.toObject((boolean[])object);
  10:                 } else if (object instanceof long[]) {
  11:         ...
  12:                     return ArrayUtils.toObject((long[])object);

View Full Code Here

toObject

public static Long[] toObject(long[] array)
Converts an array of primitive longs to objects.

This method returns null for a null input array.

Parameters:
array - a long array
Returns:
a Long array, null if null array input
Usages and Demos :

View More Examples of toObject(long[] array)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.logging.Log;
   4:         ...
   5:                 if (object instanceof int[]) {
   6:                     return ArrayUtils.toObject((int[])object);
   7:                 } else if (object instanceof boolean[]) {
   8:         ...
   9:                     return ArrayUtils.toObject((boolean[])object);
  10:                 } else if (object instanceof long[]) {
  11:         ...
  12:                     return ArrayUtils.toObject((long[])object);

View Full Code Here

toObject

public static Short[] toObject(short[] array)
Converts an array of primitive shorts to objects.

This method returns null for a null input array.

Parameters:
array - a short array
Returns:
a Short array, null if null array input
Usages and Demos :

View More Examples of toObject(short[] array)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.logging.Log;
   4:         ...
   5:                 if (object instanceof int[]) {
   6:                     return ArrayUtils.toObject((int[])object);
   7:                 } else if (object instanceof boolean[]) {
   8:         ...
   9:                     return ArrayUtils.toObject((boolean[])object);
  10:                 } else if (object instanceof long[]) {
  11:         ...
  12:                     return ArrayUtils.toObject((long[])object);

View Full Code Here

toPrimitive

public static boolean[] toPrimitive(Boolean[] array)
Converts an array of object Booleans to primitives.

This method returns null for a null input array.

Parameters:
array - a Boolean array, may be null
Returns:
a boolean array, null if null array input
Throws:
NullPointerException - if array content is null

toPrimitive

public static boolean[] toPrimitive(Boolean[] array,
                                    boolean valueForNull)
Converts an array of object Booleans to primitives handling null.

This method returns null for a null input array.

Parameters:
array - a Boolean array, may be null
valueForNull - the value to insert if null found
Returns:
a boolean array, null if null array input

toPrimitive

public static byte[] toPrimitive(Byte[] array)
Converts an array of object Bytes to primitives.

This method returns null for a null input array.

Parameters:
array - a Byte array, may be null
Returns:
a byte array, null if null array input
Throws:
NullPointerException - if array content is null

toPrimitive

public static byte[] toPrimitive(Byte[] array,
                                 byte valueForNull)
Converts an array of object Bytes to primitives handling null.

This method returns null for a null input array.

Parameters:
array - a Byte array, may be null
valueForNull - the value to insert if null found
Returns:
a byte array, null if null array input

toPrimitive

public static char[] toPrimitive(Character[] array)
Converts an array of object Characters to primitives.

This method returns null for a null input array.

Parameters:
array - a Character array, may be null
Returns:
a char array, null if null array input
Throws:
NullPointerException - if array content is null

toPrimitive

public static char[] toPrimitive(Character[] array,
                                 char valueForNull)
Converts an array of object Character to primitives handling null.

This method returns null for a null input array.

Parameters:
array - a Character array, may be null
valueForNull - the value to insert if null found
Returns:
a char array, null if null array input

toPrimitive

public static double[] toPrimitive(Double[] array)
Converts an array of object Doubles to primitives.

This method returns null for a null input array.

Parameters:
array - a Double array, may be null
Returns:
a double array, null if null array input
Throws:
NullPointerException - if array content is null

toPrimitive

public static double[] toPrimitive(Double[] array,
                                   double valueForNull)
Converts an array of object Doubles to primitives handling null.

This method returns null for a null input array.

Parameters:
array - a Double array, may be null
valueForNull - the value to insert if null found
Returns:
a double array, null if null array input

toPrimitive

public static float[] toPrimitive(Float[] array)
Converts an array of object Floats to primitives.

This method returns null for a null input array.

Parameters:
array - a Float array, may be null
Returns:
a float array, null if null array input
Throws:
NullPointerException - if array content is null

toPrimitive

public static float[] toPrimitive(Float[] array,
                                  float valueForNull)
Converts an array of object Floats to primitives handling null.

This method returns null for a null input array.

Parameters:
array - a Float array, may be null
valueForNull - the value to insert if null found
Returns:
a float array, null if null array input

toPrimitive

public static int[] toPrimitive(Integer[] array)
Converts an array of object Integers to primitives.

This method returns null for a null input array.

Parameters:
array - a Integer array, may be null
Returns:
an int array, null if null array input
Throws:
NullPointerException - if array content is null

toPrimitive

public static int[] toPrimitive(Integer[] array,
                                int valueForNull)
Converts an array of object Integer to primitives handling null.

This method returns null for a null input array.

Parameters:
array - a Integer array, may be null
valueForNull - the value to insert if null found
Returns:
an int array, null if null array input

toPrimitive

public static long[] toPrimitive(Long[] array)
Converts an array of object Longs to primitives.

This method returns null for a null input array.

Parameters:
array - a Long array, may be null
Returns:
a long array, null if null array input
Throws:
NullPointerException - if array content is null

toPrimitive

public static long[] toPrimitive(Long[] array,
                                 long valueForNull)
Converts an array of object Long to primitives handling null.

This method returns null for a null input array.

Parameters:
array - a Long array, may be null
valueForNull - the value to insert if null found
Returns:
a long array, null if null array input

toPrimitive

public static short[] toPrimitive(Short[] array)
Converts an array of object Shorts to primitives.

This method returns null for a null input array.

Parameters:
array - a Short array, may be null
Returns:
a byte array, null if null array input
Throws:
NullPointerException - if array content is null

toPrimitive

public static short[] toPrimitive(Short[] array,
                                  short valueForNull)
Converts an array of object Short to primitives handling null.

This method returns null for a null input array.

Parameters:
array - a Short array, may be null
valueForNull - the value to insert if null found
Returns:
a byte array, null if null array input

toString

public static String toString(Object array)
Outputs an array as a String, treating null as an empty array.

Multi-dimensional arrays are handled correctly, including multi-dimensional primitive arrays.

The format is that of Java source code, for example {a,b}.

Parameters:
array - the array to get a toString for, may be null
Returns:
a String representation of the array, '{}' if null array input
Usages and Demos :

View More Examples of toString(Object array)
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.builder.ToStringBuilder;
   4:         ...
   5:         return new ToStringBuilder(this)
   6:             .append("token patterns", ArrayUtils.toString(tokenPatterns))
   7:             .append("whitespace pattern", whitespacePattern)
   8:             .toString();
   9:     }

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.commons.lang.BooleanUtils;
   4:         ...
   5:                 Object[] valueArray = (Object[]) value;
   6:                 return ArrayUtils.toString(valueArray);
   7:             } else {
   8:         ...
   9:                     stringsMap.put(currentEntry.getKey(),
  10:                             ArrayUtils.toString(currentValueArray));
  11:                 } else {

View Full Code Here
   1: 
   2: import org.apache.commons.lang.ArrayUtils;
   3: import org.apache.log4j.Logger;
   4:         ...
   5:                 } else if (parameter.getClass().isArray()) {
   6:                     value = ArrayUtils.toString(parameter);
   7:                 } else {
   8:                     value = parameter.toString();
   9:                 }

View Full Code Here

toString

public static String toString(Object array,
                              String stringIfNull)
Outputs an array as a String handling nulls.

Multi-dimensional arrays are handled correctly, including multi-dimensional primitive arrays.

The format is that of Java source code, for example {a,b}.

Parameters:
array - the array to get a toString for, may be null
stringIfNull - the String to return if the array is null
Returns:
a String representation of the array