一、前言
基于apache-rat(0.9)包的org.apache.commons.lang.ArrayUtils工具类或者apache的commons-lang的org.apache.commons.lang3.ArrayUtils,对各个类型数组内容增add、删、复制、克隆clone、判空isEmpty、包含contains、长度getLength、是否相等isEquals、倒排序reverse及转换字符串toString等。
二、源码说明
1.org.apache.commons.lang.ArrayUtils工具类
package org.apache.commons.lang;@b@@b@import java.lang.reflect.Array;@b@import java.util.HashMap;@b@import java.util.Map;@b@import java.util.Map.Entry;@b@import org.apache.commons.lang.builder.EqualsBuilder;@b@import org.apache.commons.lang.builder.HashCodeBuilder;@b@import org.apache.commons.lang.builder.ToStringBuilder;@b@import org.apache.commons.lang.builder.ToStringStyle;@b@@b@public class ArrayUtils@b@{@b@ public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];@b@ public static final Class[] EMPTY_CLASS_ARRAY = new Class[0];@b@ public static final String[] EMPTY_STRING_ARRAY = new String[0];@b@ public static final long[] EMPTY_LONG_ARRAY = new long[0];@b@ public static final Long[] EMPTY_LONG_OBJECT_ARRAY = new Long[0];@b@ public static final int[] EMPTY_INT_ARRAY = new int[0];@b@ public static final Integer[] EMPTY_INTEGER_OBJECT_ARRAY = new Integer[0];@b@ public static final short[] EMPTY_SHORT_ARRAY = new short[0];@b@ public static final Short[] EMPTY_SHORT_OBJECT_ARRAY = new Short[0];@b@ public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];@b@ public static final Byte[] EMPTY_BYTE_OBJECT_ARRAY = new Byte[0];@b@ public static final double[] EMPTY_DOUBLE_ARRAY = new double[0];@b@ public static final Double[] EMPTY_DOUBLE_OBJECT_ARRAY = new Double[0];@b@ public static final float[] EMPTY_FLOAT_ARRAY = new float[0];@b@ public static final Float[] EMPTY_FLOAT_OBJECT_ARRAY = new Float[0];@b@ public static final boolean[] EMPTY_BOOLEAN_ARRAY = new boolean[0];@b@ public static final Boolean[] EMPTY_BOOLEAN_OBJECT_ARRAY = new Boolean[0];@b@ public static final char[] EMPTY_CHAR_ARRAY = new char[0];@b@ public static final Character[] EMPTY_CHARACTER_OBJECT_ARRAY = new Character[0];@b@@b@ private static Object add(Object array, int index, Object element, Class clss)@b@ {@b@ if (array == null) {@b@ if (index != 0)@b@ throw new IndexOutOfBoundsException("Index: " + index + ", Length: 0");@b@@b@ Object joinedArray = Array.newInstance(clss, 1);@b@ Array.set(joinedArray, 0, element);@b@ return joinedArray;@b@ }@b@ int length = Array.getLength(array);@b@ if ((index > length) || (index < 0))@b@ throw new IndexOutOfBoundsException("Index: " + index + ", Length: " + length);@b@@b@ Object result = Array.newInstance(clss, length + 1);@b@ System.arraycopy(array, 0, result, 0, index);@b@ Array.set(result, index, element);@b@ if (index < length)@b@ System.arraycopy(array, index, result, index + 1, length - index);@b@@b@ return result;@b@ }@b@@b@ public static byte[] add(byte[] array, byte element)@b@ {@b@ byte[] newArray = (byte[])copyArrayGrow1(array, Byte.TYPE);@b@ newArray[(newArray.length - 1)] = element;@b@ return newArray;@b@ }@b@@b@ public static byte[] add(byte[] array, int index, byte element)@b@ {@b@ return ((byte[])add(array, index, new Byte(element), Byte.TYPE));@b@ }@b@@b@ public static char[] add(char[] array, char element)@b@ {@b@ char[] newArray = (char[])copyArrayGrow1(array, Character.TYPE);@b@ newArray[(newArray.length - 1)] = element;@b@ return newArray;@b@ }@b@@b@ public static char[] add(char[] array, int index, char element)@b@ {@b@ return ((char[])add(array, index, new Character(element), Character.TYPE));@b@ }@b@@b@ public static double[] add(double[] array, double element)@b@ {@b@ double[] newArray = (double[])copyArrayGrow1(array, Double.TYPE);@b@ newArray[(newArray.length - 1)] = element;@b@ return newArray;@b@ }@b@@b@ public static double[] add(double[] array, int index, double element)@b@ {@b@ return ((double[])add(array, index, new Double(element), Double.TYPE));@b@ }@b@@b@ public static float[] add(float[] array, float element)@b@ {@b@ float[] newArray = (float[])copyArrayGrow1(array, Float.TYPE);@b@ newArray[(newArray.length - 1)] = element;@b@ return newArray;@b@ }@b@@b@ public static float[] add(float[] array, int index, float element)@b@ {@b@ return ((float[])add(array, index, new Float(element), Float.TYPE));@b@ }@b@@b@ public static int[] add(int[] array, int element)@b@ {@b@ int[] newArray = (int[])copyArrayGrow1(array, Integer.TYPE);@b@ newArray[(newArray.length - 1)] = element;@b@ return newArray;@b@ }@b@@b@ public static int[] add(int[] array, int index, int element)@b@ {@b@ return ((int[])add(array, index, new Integer(element), Integer.TYPE));@b@ }@b@@b@ public static long[] add(long[] array, int index, long element)@b@ {@b@ return ((long[])add(array, index, new Long(element), Long.TYPE));@b@ }@b@@b@ public static long[] add(long[] array, long element)@b@ {@b@ long[] newArray = (long[])copyArrayGrow1(array, Long.TYPE);@b@ newArray[(newArray.length - 1)] = element;@b@ return newArray;@b@ }@b@@b@ public static Object[] add(Object[] array, int index, Object element)@b@ {@b@ Class clss = null;@b@ if (array != null) {@b@ clss = array.getClass().getComponentType();@b@ }@b@ else if (element != null)@b@ clss = element.getClass();@b@ else@b@ return new Object[] { null };@b@@b@ return ((Object[])add(array, index, element, clss));@b@ }@b@@b@ public static Object[] add(Object[] array, Object element)@b@ {@b@ Class type = Object.class;@b@ Object[] newArray = (Object[])copyArrayGrow1(array, type);@b@ newArray[(newArray.length - 1)] = element;@b@ return newArray;@b@ }@b@@b@ public static short[] add(short[] array, int index, short element)@b@ {@b@ return ((short[])add(array, index, new Short(element), Short.TYPE));@b@ }@b@@b@ public static short[] add(short[] array, short element)@b@ {@b@ short[] newArray = (short[])copyArrayGrow1(array, Short.TYPE);@b@ newArray[(newArray.length - 1)] = element;@b@ return newArray;@b@ }@b@@b@ public static boolean[] add(boolean[] array, int index, boolean element)@b@ {@b@ return ((boolean[])add(array, index, new Boolean(element), Boolean.TYPE));@b@ }@b@@b@ public static boolean[] add(boolean[] array, boolean element)@b@ {@b@ boolean[] newArray = (boolean[])copyArrayGrow1(array, Boolean.TYPE);@b@ newArray[(newArray.length - 1)] = element;@b@ return newArray;@b@ }@b@@b@ public static byte[] addAll(byte[] array1, byte[] array2)@b@ {@b@ if (array1 == null)@b@ return clone(array2);@b@ if (array2 == null)@b@ return clone(array1);@b@@b@ byte[] joinedArray = new byte[array1.length + array2.length];@b@ System.arraycopy(array1, 0, joinedArray, 0, array1.length);@b@ System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);@b@ return joinedArray;@b@ }@b@@b@ public static char[] addAll(char[] array1, char[] array2)@b@ {@b@ if (array1 == null)@b@ return clone(array2);@b@ if (array2 == null)@b@ return clone(array1);@b@@b@ char[] joinedArray = new char[array1.length + array2.length];@b@ System.arraycopy(array1, 0, joinedArray, 0, array1.length);@b@ System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);@b@ return joinedArray;@b@ }@b@@b@ public static double[] addAll(double[] array1, double[] array2)@b@ {@b@ if (array1 == null)@b@ return clone(array2);@b@ if (array2 == null)@b@ return clone(array1);@b@@b@ double[] joinedArray = new double[array1.length + array2.length];@b@ System.arraycopy(array1, 0, joinedArray, 0, array1.length);@b@ System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);@b@ return joinedArray;@b@ }@b@@b@ public static float[] addAll(float[] array1, float[] array2)@b@ {@b@ if (array1 == null)@b@ return clone(array2);@b@ if (array2 == null)@b@ return clone(array1);@b@@b@ float[] joinedArray = new float[array1.length + array2.length];@b@ System.arraycopy(array1, 0, joinedArray, 0, array1.length);@b@ System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);@b@ return joinedArray;@b@ }@b@@b@ public static int[] addAll(int[] array1, int[] array2)@b@ {@b@ if (array1 == null)@b@ return clone(array2);@b@ if (array2 == null)@b@ return clone(array1);@b@@b@ int[] joinedArray = new int[array1.length + array2.length];@b@ System.arraycopy(array1, 0, joinedArray, 0, array1.length);@b@ System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);@b@ return joinedArray;@b@ }@b@@b@ public static long[] addAll(long[] array1, long[] array2)@b@ {@b@ if (array1 == null)@b@ return clone(array2);@b@ if (array2 == null)@b@ return clone(array1);@b@@b@ long[] joinedArray = new long[array1.length + array2.length];@b@ System.arraycopy(array1, 0, joinedArray, 0, array1.length);@b@ System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);@b@ return joinedArray;@b@ }@b@@b@ public static Object[] addAll(Object[] array1, Object[] array2)@b@ {@b@ if (array1 == null)@b@ return clone(array2);@b@ if (array2 == null)@b@ return clone(array1);@b@@b@ Object[] joinedArray = (Object[])Array.newInstance(array1.getClass().getComponentType(), @b@ array1.length + array2.length);@b@ System.arraycopy(array1, 0, joinedArray, 0, array1.length);@b@ System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);@b@ return joinedArray;@b@ }@b@@b@ public static short[] addAll(short[] array1, short[] array2)@b@ {@b@ if (array1 == null)@b@ return clone(array2);@b@ if (array2 == null)@b@ return clone(array1);@b@@b@ short[] joinedArray = new short[array1.length + array2.length];@b@ System.arraycopy(array1, 0, joinedArray, 0, array1.length);@b@ System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);@b@ return joinedArray;@b@ }@b@@b@ public static boolean[] addAll(boolean[] array1, boolean[] array2)@b@ {@b@ if (array1 == null)@b@ return clone(array2);@b@ if (array2 == null)@b@ return clone(array1);@b@@b@ boolean[] joinedArray = new boolean[array1.length + array2.length];@b@ System.arraycopy(array1, 0, joinedArray, 0, array1.length);@b@ System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);@b@ return joinedArray;@b@ }@b@@b@ public static byte[] clone(byte[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ return ((byte[])array.clone());@b@ }@b@@b@ public static char[] clone(char[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ return ((char[])array.clone());@b@ }@b@@b@ public static double[] clone(double[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ return ((double[])array.clone());@b@ }@b@@b@ public static float[] clone(float[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ return ((float[])array.clone());@b@ }@b@@b@ public static int[] clone(int[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ return ((int[])array.clone());@b@ }@b@@b@ public static long[] clone(long[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ return ((long[])array.clone());@b@ }@b@@b@ public static Object[] clone(Object[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ return ((Object[])array.clone());@b@ }@b@@b@ public static short[] clone(short[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ return ((short[])array.clone());@b@ }@b@@b@ public static boolean[] clone(boolean[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ return ((boolean[])array.clone());@b@ }@b@@b@ public static boolean contains(byte[] array, byte valueToFind)@b@ {@b@ return (indexOf(array, valueToFind) != -1);@b@ }@b@@b@ public static boolean contains(char[] array, char valueToFind)@b@ {@b@ return (indexOf(array, valueToFind) != -1);@b@ }@b@@b@ public static boolean contains(double[] array, double valueToFind)@b@ {@b@ return (indexOf(array, valueToFind) != -1);@b@ }@b@@b@ public static boolean contains(double[] array, double valueToFind, double tolerance)@b@ {@b@ return (indexOf(array, valueToFind, 0, tolerance) != -1);@b@ }@b@@b@ public static boolean contains(float[] array, float valueToFind)@b@ {@b@ return (indexOf(array, valueToFind) != -1);@b@ }@b@@b@ public static boolean contains(int[] array, int valueToFind)@b@ {@b@ return (indexOf(array, valueToFind) != -1);@b@ }@b@@b@ public static boolean contains(long[] array, long valueToFind)@b@ {@b@ return (indexOf(array, valueToFind) != -1);@b@ }@b@@b@ public static boolean contains(Object[] array, Object objectToFind)@b@ {@b@ return (indexOf(array, objectToFind) != -1);@b@ }@b@@b@ public static boolean contains(short[] array, short valueToFind)@b@ {@b@ return (indexOf(array, valueToFind) != -1);@b@ }@b@@b@ public static boolean contains(boolean[] array, boolean valueToFind)@b@ {@b@ return (indexOf(array, valueToFind) != -1);@b@ }@b@@b@ private static Object copyArrayGrow1(Object array, Class newArrayComponentType)@b@ {@b@ if (array != null) {@b@ int arrayLength = Array.getLength(array);@b@ Object newArray = Array.newInstance(array.getClass().getComponentType(), arrayLength + 1);@b@ System.arraycopy(array, 0, newArray, 0, arrayLength);@b@ return newArray;@b@ }@b@ return Array.newInstance(newArrayComponentType, 1);@b@ }@b@@b@ public static int getLength(Object array)@b@ {@b@ if (array == null)@b@ return 0;@b@@b@ return Array.getLength(array);@b@ }@b@@b@ public static int hashCode(Object array)@b@ {@b@ return new HashCodeBuilder().append(array).toHashCode();@b@ }@b@@b@ public static int indexOf(byte[] array, byte valueToFind)@b@ {@b@ return indexOf(array, valueToFind, 0);@b@ }@b@@b@ public static int indexOf(byte[] array, byte valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ for (int i = startIndex; i < array.length; ++i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int indexOf(char[] array, char valueToFind)@b@ {@b@ return indexOf(array, valueToFind, 0);@b@ }@b@@b@ public static int indexOf(char[] array, char valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ for (int i = startIndex; i < array.length; ++i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int indexOf(double[] array, double valueToFind)@b@ {@b@ return indexOf(array, valueToFind, 0);@b@ }@b@@b@ public static int indexOf(double[] array, double valueToFind, double tolerance)@b@ {@b@ return indexOf(array, valueToFind, 0, tolerance);@b@ }@b@@b@ public static int indexOf(double[] array, double valueToFind, int startIndex)@b@ {@b@ if (isEmpty(array))@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ for (int i = startIndex; i < array.length; ++i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int indexOf(double[] array, double valueToFind, int startIndex, double tolerance)@b@ {@b@ if (isEmpty(array))@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ double min = valueToFind - tolerance;@b@ double max = valueToFind + tolerance;@b@ for (int i = startIndex; i < array.length; ++i)@b@ if ((array[i] >= min) && (array[i] <= max))@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int indexOf(float[] array, float valueToFind)@b@ {@b@ return indexOf(array, valueToFind, 0);@b@ }@b@@b@ public static int indexOf(float[] array, float valueToFind, int startIndex)@b@ {@b@ if (isEmpty(array))@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ for (int i = startIndex; i < array.length; ++i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int indexOf(int[] array, int valueToFind)@b@ {@b@ return indexOf(array, valueToFind, 0);@b@ }@b@@b@ public static int indexOf(int[] array, int valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ for (int i = startIndex; i < array.length; ++i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int indexOf(long[] array, long valueToFind)@b@ {@b@ return indexOf(array, valueToFind, 0);@b@ }@b@@b@ public static int indexOf(long[] array, long valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ for (int i = startIndex; i < array.length; ++i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int indexOf(Object[] array, Object objectToFind)@b@ {@b@ return indexOf(array, objectToFind, 0);@b@ }@b@@b@ public static int indexOf(Object[] array, Object objectToFind, int startIndex)@b@ {@b@ int i;@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ if (objectToFind == null)@b@ for (i = startIndex; i < array.length; ++i)@b@ if (array[i] == null)@b@ return i;@b@@b@@b@ else@b@ for (i = startIndex; i < array.length; ++i)@b@ if (objectToFind.equals(array[i]))@b@ return i;@b@@b@@b@@b@ return -1;@b@ }@b@@b@ public static int indexOf(short[] array, short valueToFind)@b@ {@b@ return indexOf(array, valueToFind, 0);@b@ }@b@@b@ public static int indexOf(short[] array, short valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ for (int i = startIndex; i < array.length; ++i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int indexOf(boolean[] array, boolean valueToFind)@b@ {@b@ return indexOf(array, valueToFind, 0);@b@ }@b@@b@ public static int indexOf(boolean[] array, boolean valueToFind, int startIndex)@b@ {@b@ if (isEmpty(array))@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ for (int i = startIndex; i < array.length; ++i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static boolean isEmpty(byte[] array)@b@ {@b@ return ((array == null) || (array.length == 0));@b@ }@b@@b@ public static boolean isEmpty(char[] array)@b@ {@b@ return ((array == null) || (array.length == 0));@b@ }@b@@b@ public static boolean isEmpty(double[] array)@b@ {@b@ return ((array == null) || (array.length == 0));@b@ }@b@@b@ public static boolean isEmpty(float[] array)@b@ {@b@ return ((array == null) || (array.length == 0));@b@ }@b@@b@ public static boolean isEmpty(int[] array)@b@ {@b@ return ((array == null) || (array.length == 0));@b@ }@b@@b@ public static boolean isEmpty(long[] array)@b@ {@b@ return ((array == null) || (array.length == 0));@b@ }@b@@b@ public static boolean isEmpty(Object[] array)@b@ {@b@ return ((array == null) || (array.length == 0));@b@ }@b@@b@ public static boolean isEmpty(short[] array)@b@ {@b@ return ((array == null) || (array.length == 0));@b@ }@b@@b@ public static boolean isEmpty(boolean[] array)@b@ {@b@ return ((array == null) || (array.length == 0));@b@ }@b@@b@ public static boolean isEquals(Object array1, Object array2)@b@ {@b@ return new EqualsBuilder().append(array1, array2).isEquals();@b@ }@b@@b@ public static boolean isSameLength(byte[] array1, byte[] array2)@b@ {@b@ return ((((array1 != null) || (array2 == null) || (array2.length <= 0))) && @b@ (((array2 != null) || (array1 == null) || (array1.length <= 0))) && ((@b@ (array1 == null) || (array2 == null) || (array1.length == array2.length))));@b@ }@b@@b@ public static boolean isSameLength(char[] array1, char[] array2)@b@ {@b@ return ((((array1 != null) || (array2 == null) || (array2.length <= 0))) && @b@ (((array2 != null) || (array1 == null) || (array1.length <= 0))) && ((@b@ (array1 == null) || (array2 == null) || (array1.length == array2.length))));@b@ }@b@@b@ public static boolean isSameLength(double[] array1, double[] array2)@b@ {@b@ return ((((array1 != null) || (array2 == null) || (array2.length <= 0))) && @b@ (((array2 != null) || (array1 == null) || (array1.length <= 0))) && ((@b@ (array1 == null) || (array2 == null) || (array1.length == array2.length))));@b@ }@b@@b@ public static boolean isSameLength(float[] array1, float[] array2)@b@ {@b@ return ((((array1 != null) || (array2 == null) || (array2.length <= 0))) && @b@ (((array2 != null) || (array1 == null) || (array1.length <= 0))) && ((@b@ (array1 == null) || (array2 == null) || (array1.length == array2.length))));@b@ }@b@@b@ public static boolean isSameLength(int[] array1, int[] array2)@b@ {@b@ return ((((array1 != null) || (array2 == null) || (array2.length <= 0))) && @b@ (((array2 != null) || (array1 == null) || (array1.length <= 0))) && ((@b@ (array1 == null) || (array2 == null) || (array1.length == array2.length))));@b@ }@b@@b@ public static boolean isSameLength(long[] array1, long[] array2)@b@ {@b@ return ((((array1 != null) || (array2 == null) || (array2.length <= 0))) && @b@ (((array2 != null) || (array1 == null) || (array1.length <= 0))) && ((@b@ (array1 == null) || (array2 == null) || (array1.length == array2.length))));@b@ }@b@@b@ public static boolean isSameLength(Object[] array1, Object[] array2)@b@ {@b@ return ((((array1 != null) || (array2 == null) || (array2.length <= 0))) && @b@ (((array2 != null) || (array1 == null) || (array1.length <= 0))) && ((@b@ (array1 == null) || (array2 == null) || (array1.length == array2.length))));@b@ }@b@@b@ public static boolean isSameLength(short[] array1, short[] array2)@b@ {@b@ return ((((array1 != null) || (array2 == null) || (array2.length <= 0))) && @b@ (((array2 != null) || (array1 == null) || (array1.length <= 0))) && ((@b@ (array1 == null) || (array2 == null) || (array1.length == array2.length))));@b@ }@b@@b@ public static boolean isSameLength(boolean[] array1, boolean[] array2)@b@ {@b@ return ((((array1 != null) || (array2 == null) || (array2.length <= 0))) && @b@ (((array2 != null) || (array1 == null) || (array1.length <= 0))) && ((@b@ (array1 == null) || (array2 == null) || (array1.length == array2.length))));@b@ }@b@@b@ public static boolean isSameType(Object array1, Object array2)@b@ {@b@ if ((array1 == null) || (array2 == null))@b@ throw new IllegalArgumentException("The Array must not be null");@b@@b@ return array1.getClass().getName().equals(array2.getClass().getName());@b@ }@b@@b@ public static int lastIndexOf(byte[] array, byte valueToFind)@b@ {@b@ return lastIndexOf(array, valueToFind, 2147483647);@b@ }@b@@b@ public static int lastIndexOf(byte[] array, byte valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ for (int i = startIndex; i >= 0; --i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(char[] array, char valueToFind)@b@ {@b@ return lastIndexOf(array, valueToFind, 2147483647);@b@ }@b@@b@ public static int lastIndexOf(char[] array, char valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ for (int i = startIndex; i >= 0; --i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(double[] array, double valueToFind)@b@ {@b@ return lastIndexOf(array, valueToFind, 2147483647);@b@ }@b@@b@ public static int lastIndexOf(double[] array, double valueToFind, double tolerance)@b@ {@b@ return lastIndexOf(array, valueToFind, 2147483647, tolerance);@b@ }@b@@b@ public static int lastIndexOf(double[] array, double valueToFind, int startIndex)@b@ {@b@ if (isEmpty(array))@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ for (int i = startIndex; i >= 0; --i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(double[] array, double valueToFind, int startIndex, double tolerance)@b@ {@b@ if (isEmpty(array))@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ double min = valueToFind - tolerance;@b@ double max = valueToFind + tolerance;@b@ for (int i = startIndex; i >= 0; --i)@b@ if ((array[i] >= min) && (array[i] <= max))@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(float[] array, float valueToFind)@b@ {@b@ return lastIndexOf(array, valueToFind, 2147483647);@b@ }@b@@b@ public static int lastIndexOf(float[] array, float valueToFind, int startIndex)@b@ {@b@ if (isEmpty(array))@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ for (int i = startIndex; i >= 0; --i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(int[] array, int valueToFind)@b@ {@b@ return lastIndexOf(array, valueToFind, 2147483647);@b@ }@b@@b@ public static int lastIndexOf(int[] array, int valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ for (int i = startIndex; i >= 0; --i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(long[] array, long valueToFind)@b@ {@b@ return lastIndexOf(array, valueToFind, 2147483647);@b@ }@b@@b@ public static int lastIndexOf(long[] array, long valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ for (int i = startIndex; i >= 0; --i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(Object[] array, Object objectToFind)@b@ {@b@ return lastIndexOf(array, objectToFind, 2147483647);@b@ }@b@@b@ public static int lastIndexOf(Object[] array, Object objectToFind, int startIndex)@b@ {@b@ int i;@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ if (objectToFind == null)@b@ for (i = startIndex; i >= 0; --i)@b@ if (array[i] == null)@b@ return i;@b@@b@@b@ else@b@ for (i = startIndex; i >= 0; --i)@b@ if (objectToFind.equals(array[i]))@b@ return i;@b@@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(short[] array, short valueToFind)@b@ {@b@ return lastIndexOf(array, valueToFind, 2147483647);@b@ }@b@@b@ public static int lastIndexOf(short[] array, short valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ for (int i = startIndex; i >= 0; --i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(boolean[] array, boolean valueToFind)@b@ {@b@ return lastIndexOf(array, valueToFind, 2147483647);@b@ }@b@@b@ public static int lastIndexOf(boolean[] array, boolean valueToFind, int startIndex)@b@ {@b@ if (isEmpty(array))@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ for (int i = startIndex; i >= 0; --i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ private static Object remove(Object array, int index)@b@ {@b@ int length = getLength(array);@b@ if ((index < 0) || (index >= length)) {@b@ throw new IndexOutOfBoundsException("Index: " + index + ", Length: " + length);@b@ }@b@@b@ Object result = Array.newInstance(array.getClass().getComponentType(), length - 1);@b@ System.arraycopy(array, 0, result, 0, index);@b@ if (index < length - 1) {@b@ System.arraycopy(array, index + 1, result, index, length - index - 1);@b@ }@b@@b@ return result;@b@ }@b@@b@ public static byte[] remove(byte[] array, int index)@b@ {@b@ return ((byte[])remove(array, index));@b@ }@b@@b@ public static char[] remove(char[] array, int index)@b@ {@b@ return ((char[])remove(array, index));@b@ }@b@@b@ public static double[] remove(double[] array, int index)@b@ {@b@ return ((double[])remove(array, index));@b@ }@b@@b@ public static float[] remove(float[] array, int index)@b@ {@b@ return ((float[])remove(array, index));@b@ }@b@@b@ public static int[] remove(int[] array, int index)@b@ {@b@ return ((int[])remove(array, index));@b@ }@b@@b@ public static long[] remove(long[] array, int index)@b@ {@b@ return ((long[])remove(array, index));@b@ }@b@@b@ public static Object[] remove(Object[] array, int index)@b@ {@b@ return ((Object[])remove(array, index));@b@ }@b@@b@ public static short[] remove(short[] array, int index)@b@ {@b@ return ((short[])remove(array, index));@b@ }@b@@b@ public static boolean[] remove(boolean[] array, int index)@b@ {@b@ return ((boolean[])remove(array, index));@b@ }@b@@b@ public static byte[] removeElement(byte[] array, byte element)@b@ {@b@ int index = indexOf(array, element);@b@ if (index == -1)@b@ return clone(array);@b@@b@ return remove(array, index);@b@ }@b@@b@ public static char[] removeElement(char[] array, char element)@b@ {@b@ int index = indexOf(array, element);@b@ if (index == -1)@b@ return clone(array);@b@@b@ return remove(array, index);@b@ }@b@@b@ public static double[] removeElement(double[] array, double element)@b@ {@b@ int index = indexOf(array, element);@b@ if (index == -1)@b@ return clone(array);@b@@b@ return remove(array, index);@b@ }@b@@b@ public static float[] removeElement(float[] array, float element)@b@ {@b@ int index = indexOf(array, element);@b@ if (index == -1)@b@ return clone(array);@b@@b@ return remove(array, index);@b@ }@b@@b@ public static int[] removeElement(int[] array, int element)@b@ {@b@ int index = indexOf(array, element);@b@ if (index == -1)@b@ return clone(array);@b@@b@ return remove(array, index);@b@ }@b@@b@ public static long[] removeElement(long[] array, long element)@b@ {@b@ int index = indexOf(array, element);@b@ if (index == -1)@b@ return clone(array);@b@@b@ return remove(array, index);@b@ }@b@@b@ public static Object[] removeElement(Object[] array, Object element)@b@ {@b@ int index = indexOf(array, element);@b@ if (index == -1)@b@ return clone(array);@b@@b@ return remove(array, index);@b@ }@b@@b@ public static short[] removeElement(short[] array, short element)@b@ {@b@ int index = indexOf(array, element);@b@ if (index == -1)@b@ return clone(array);@b@@b@ return remove(array, index);@b@ }@b@@b@ public static boolean[] removeElement(boolean[] array, boolean element)@b@ {@b@ int index = indexOf(array, element);@b@ if (index == -1)@b@ return clone(array);@b@@b@ return remove(array, index);@b@ }@b@@b@ public static void reverse(byte[] array)@b@ {@b@ if (array == null)@b@ return;@b@@b@ int i = 0;@b@ int j = array.length - 1;@b@@b@ while (j > i) {@b@ byte tmp = array[j];@b@ array[j] = array[i];@b@ array[i] = tmp;@b@ --j;@b@ ++i;@b@ }@b@ }@b@@b@ public static void reverse(char[] array)@b@ {@b@ if (array == null)@b@ return;@b@@b@ int i = 0;@b@ int j = array.length - 1;@b@@b@ while (j > i) {@b@ char tmp = array[j];@b@ array[j] = array[i];@b@ array[i] = tmp;@b@ --j;@b@ ++i;@b@ }@b@ }@b@@b@ public static void reverse(double[] array)@b@ {@b@ if (array == null)@b@ return;@b@@b@ int i = 0;@b@ int j = array.length - 1;@b@@b@ while (j > i) {@b@ double tmp = array[j];@b@ array[j] = array[i];@b@ array[i] = tmp;@b@ --j;@b@ ++i;@b@ }@b@ }@b@@b@ public static void reverse(float[] array)@b@ {@b@ if (array == null)@b@ return;@b@@b@ int i = 0;@b@ int j = array.length - 1;@b@@b@ while (j > i) {@b@ float tmp = array[j];@b@ array[j] = array[i];@b@ array[i] = tmp;@b@ --j;@b@ ++i;@b@ }@b@ }@b@@b@ public static void reverse(int[] array)@b@ {@b@ if (array == null)@b@ return;@b@@b@ int i = 0;@b@ int j = array.length - 1;@b@@b@ while (j > i) {@b@ int tmp = array[j];@b@ array[j] = array[i];@b@ array[i] = tmp;@b@ --j;@b@ ++i;@b@ }@b@ }@b@@b@ public static void reverse(long[] array)@b@ {@b@ if (array == null)@b@ return;@b@@b@ int i = 0;@b@ int j = array.length - 1;@b@@b@ while (j > i) {@b@ long tmp = array[j];@b@ array[j] = array[i];@b@ array[i] = tmp;@b@ --j;@b@ ++i;@b@ }@b@ }@b@@b@ public static void reverse(Object[] array)@b@ {@b@ if (array == null)@b@ return;@b@@b@ int i = 0;@b@ int j = array.length - 1;@b@@b@ while (j > i) {@b@ Object tmp = array[j];@b@ array[j] = array[i];@b@ array[i] = tmp;@b@ --j;@b@ ++i;@b@ }@b@ }@b@@b@ public static void reverse(short[] array)@b@ {@b@ if (array == null)@b@ return;@b@@b@ int i = 0;@b@ int j = array.length - 1;@b@@b@ while (j > i) {@b@ short tmp = array[j];@b@ array[j] = array[i];@b@ array[i] = tmp;@b@ --j;@b@ ++i;@b@ }@b@ }@b@@b@ public static void reverse(boolean[] array)@b@ {@b@ if (array == null)@b@ return;@b@@b@ int i = 0;@b@ int j = array.length - 1;@b@@b@ while (j > i) {@b@ boolean tmp = array[j];@b@ array[j] = array[i];@b@ array[i] = tmp;@b@ --j;@b@ ++i;@b@ }@b@ }@b@@b@ public static byte[] subarray(byte[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ if (startIndexInclusive < 0)@b@ startIndexInclusive = 0;@b@@b@ if (endIndexExclusive > array.length)@b@ endIndexExclusive = array.length;@b@@b@ int newSize = endIndexExclusive - startIndexInclusive;@b@ if (newSize <= 0) {@b@ return EMPTY_BYTE_ARRAY;@b@ }@b@@b@ byte[] subarray = new byte[newSize];@b@ System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);@b@ return subarray;@b@ }@b@@b@ public static char[] subarray(char[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ if (startIndexInclusive < 0)@b@ startIndexInclusive = 0;@b@@b@ if (endIndexExclusive > array.length)@b@ endIndexExclusive = array.length;@b@@b@ int newSize = endIndexExclusive - startIndexInclusive;@b@ if (newSize <= 0) {@b@ return EMPTY_CHAR_ARRAY;@b@ }@b@@b@ char[] subarray = new char[newSize];@b@ System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);@b@ return subarray;@b@ }@b@@b@ public static double[] subarray(double[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ if (startIndexInclusive < 0)@b@ startIndexInclusive = 0;@b@@b@ if (endIndexExclusive > array.length)@b@ endIndexExclusive = array.length;@b@@b@ int newSize = endIndexExclusive - startIndexInclusive;@b@ if (newSize <= 0) {@b@ return EMPTY_DOUBLE_ARRAY;@b@ }@b@@b@ double[] subarray = new double[newSize];@b@ System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);@b@ return subarray;@b@ }@b@@b@ public static float[] subarray(float[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ if (startIndexInclusive < 0)@b@ startIndexInclusive = 0;@b@@b@ if (endIndexExclusive > array.length)@b@ endIndexExclusive = array.length;@b@@b@ int newSize = endIndexExclusive - startIndexInclusive;@b@ if (newSize <= 0) {@b@ return EMPTY_FLOAT_ARRAY;@b@ }@b@@b@ float[] subarray = new float[newSize];@b@ System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);@b@ return subarray;@b@ }@b@@b@ public static int[] subarray(int[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ if (startIndexInclusive < 0)@b@ startIndexInclusive = 0;@b@@b@ if (endIndexExclusive > array.length)@b@ endIndexExclusive = array.length;@b@@b@ int newSize = endIndexExclusive - startIndexInclusive;@b@ if (newSize <= 0) {@b@ return EMPTY_INT_ARRAY;@b@ }@b@@b@ int[] subarray = new int[newSize];@b@ System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);@b@ return subarray;@b@ }@b@@b@ public static long[] subarray(long[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ if (startIndexInclusive < 0)@b@ startIndexInclusive = 0;@b@@b@ if (endIndexExclusive > array.length)@b@ endIndexExclusive = array.length;@b@@b@ int newSize = endIndexExclusive - startIndexInclusive;@b@ if (newSize <= 0) {@b@ return EMPTY_LONG_ARRAY;@b@ }@b@@b@ long[] subarray = new long[newSize];@b@ System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);@b@ return subarray;@b@ }@b@@b@ public static Object[] subarray(Object[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ if (startIndexInclusive < 0)@b@ startIndexInclusive = 0;@b@@b@ if (endIndexExclusive > array.length)@b@ endIndexExclusive = array.length;@b@@b@ int newSize = endIndexExclusive - startIndexInclusive;@b@ Class type = array.getClass().getComponentType();@b@ if (newSize <= 0)@b@ return ((Object[])Array.newInstance(type, 0));@b@@b@ Object[] subarray = (Object[])Array.newInstance(type, newSize);@b@ System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);@b@ return subarray;@b@ }@b@@b@ public static short[] subarray(short[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ if (startIndexInclusive < 0)@b@ startIndexInclusive = 0;@b@@b@ if (endIndexExclusive > array.length)@b@ endIndexExclusive = array.length;@b@@b@ int newSize = endIndexExclusive - startIndexInclusive;@b@ if (newSize <= 0) {@b@ return EMPTY_SHORT_ARRAY;@b@ }@b@@b@ short[] subarray = new short[newSize];@b@ System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);@b@ return subarray;@b@ }@b@@b@ public static boolean[] subarray(boolean[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ if (startIndexInclusive < 0)@b@ startIndexInclusive = 0;@b@@b@ if (endIndexExclusive > array.length)@b@ endIndexExclusive = array.length;@b@@b@ int newSize = endIndexExclusive - startIndexInclusive;@b@ if (newSize <= 0) {@b@ return EMPTY_BOOLEAN_ARRAY;@b@ }@b@@b@ boolean[] subarray = new boolean[newSize];@b@ System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);@b@ return subarray;@b@ }@b@@b@ public static Map toMap(Object[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ Map map = new HashMap((int)(array.length * 1.5D));@b@ for (int i = 0; i < array.length; ++i) {@b@ Object object = array[i];@b@ if (object instanceof Map.Entry) {@b@ Map.Entry entry = (Map.Entry)object;@b@ map.put(entry.getKey(), entry.getValue());@b@ } else if (object instanceof Object[]) {@b@ Object[] entry = (Object[])object;@b@ if (entry.length < 2)@b@ throw new IllegalArgumentException("Array element " + i + ", '" + @b@ object + @b@ "', has a length less than 2");@b@@b@ map.put(entry[0], entry[1]);@b@ } else {@b@ throw new IllegalArgumentException("Array element " + i + ", '" + @b@ object + @b@ "', is neither of type Map.Entry nor an Array");@b@ }@b@ }@b@ return map;@b@ }@b@@b@ public static Byte[] toObject(byte[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_BYTE_OBJECT_ARRAY;@b@@b@ Byte[] result = new Byte[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = new Byte(array[i]);@b@@b@ return result;@b@ }@b@@b@ public static Double[] toObject(double[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_DOUBLE_OBJECT_ARRAY;@b@@b@ Double[] result = new Double[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = new Double(array[i]);@b@@b@ return result;@b@ }@b@@b@ public static Float[] toObject(float[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_FLOAT_OBJECT_ARRAY;@b@@b@ Float[] result = new Float[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = new Float(array[i]);@b@@b@ return result;@b@ }@b@@b@ public static Integer[] toObject(int[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_INTEGER_OBJECT_ARRAY;@b@@b@ Integer[] result = new Integer[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = new Integer(array[i]);@b@@b@ return result;@b@ }@b@@b@ public static Long[] toObject(long[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_LONG_OBJECT_ARRAY;@b@@b@ Long[] result = new Long[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = new Long(array[i]);@b@@b@ return result;@b@ }@b@@b@ public static Short[] toObject(short[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_SHORT_OBJECT_ARRAY;@b@@b@ Short[] result = new Short[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = new Short(array[i]);@b@@b@ return result;@b@ }@b@@b@ public static Boolean[] toObject(boolean[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_BOOLEAN_OBJECT_ARRAY;@b@@b@ Boolean[] result = new Boolean[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = ((array[i] != 0) ? Boolean.TRUE : Boolean.FALSE);@b@@b@ return result;@b@ }@b@@b@ public static boolean[] toPrimitive(Boolean[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_BOOLEAN_ARRAY;@b@@b@ boolean[] result = new boolean[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = array[i].booleanValue();@b@@b@ return result;@b@ }@b@@b@ public static boolean[] toPrimitive(Boolean[] array, boolean valueForNull)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_BOOLEAN_ARRAY;@b@@b@ boolean[] result = new boolean[array.length];@b@ for (int i = 0; i < array.length; ++i) {@b@ Boolean b = array[i];@b@ result[i] = ((b == null) ? valueForNull : b.booleanValue());@b@ }@b@ return result;@b@ }@b@@b@ public static byte[] toPrimitive(Byte[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_BYTE_ARRAY;@b@@b@ byte[] result = new byte[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = array[i].byteValue();@b@@b@ return result;@b@ }@b@@b@ public static byte[] toPrimitive(Byte[] array, byte valueForNull)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_BYTE_ARRAY;@b@@b@ byte[] result = new byte[array.length];@b@ for (int i = 0; i < array.length; ++i) {@b@ Byte b = array[i];@b@ result[i] = ((b == null) ? valueForNull : b.byteValue());@b@ }@b@ return result;@b@ }@b@@b@ public static double[] toPrimitive(Double[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_DOUBLE_ARRAY;@b@@b@ double[] result = new double[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = array[i].doubleValue();@b@@b@ return result;@b@ }@b@@b@ public static double[] toPrimitive(Double[] array, double valueForNull)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_DOUBLE_ARRAY;@b@@b@ double[] result = new double[array.length];@b@ for (int i = 0; i < array.length; ++i) {@b@ Double b = array[i];@b@ result[i] = ((b == null) ? valueForNull : b.doubleValue());@b@ }@b@ return result;@b@ }@b@@b@ public static float[] toPrimitive(Float[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_FLOAT_ARRAY;@b@@b@ float[] result = new float[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = array[i].floatValue();@b@@b@ return result;@b@ }@b@@b@ public static float[] toPrimitive(Float[] array, float valueForNull)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_FLOAT_ARRAY;@b@@b@ float[] result = new float[array.length];@b@ for (int i = 0; i < array.length; ++i) {@b@ Float b = array[i];@b@ result[i] = ((b == null) ? valueForNull : b.floatValue());@b@ }@b@ return result;@b@ }@b@@b@ public static int[] toPrimitive(Integer[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_INT_ARRAY;@b@@b@ int[] result = new int[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = array[i].intValue();@b@@b@ return result;@b@ }@b@@b@ public static int[] toPrimitive(Integer[] array, int valueForNull)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_INT_ARRAY;@b@@b@ int[] result = new int[array.length];@b@ for (int i = 0; i < array.length; ++i) {@b@ Integer b = array[i];@b@ result[i] = ((b == null) ? valueForNull : b.intValue());@b@ }@b@ return result;@b@ }@b@@b@ public static long[] toPrimitive(Long[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_LONG_ARRAY;@b@@b@ long[] result = new long[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = array[i].longValue();@b@@b@ return result;@b@ }@b@@b@ public static long[] toPrimitive(Long[] array, long valueForNull)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_LONG_ARRAY;@b@@b@ long[] result = new long[array.length];@b@ for (int i = 0; i < array.length; ++i) {@b@ Long b = array[i];@b@ result[i] = ((b == null) ? valueForNull : b.longValue());@b@ }@b@ return result;@b@ }@b@@b@ public static short[] toPrimitive(Short[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_SHORT_ARRAY;@b@@b@ short[] result = new short[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = array[i].shortValue();@b@@b@ return result;@b@ }@b@@b@ public static short[] toPrimitive(Short[] array, short valueForNull)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_SHORT_ARRAY;@b@@b@ short[] result = new short[array.length];@b@ for (int i = 0; i < array.length; ++i) {@b@ Short b = array[i];@b@ result[i] = ((b == null) ? valueForNull : b.shortValue());@b@ }@b@ return result;@b@ }@b@@b@ public static String toString(Object array)@b@ {@b@ return toString(array, "{}");@b@ }@b@@b@ public static String toString(Object array, String stringIfNull)@b@ {@b@ if (array == null)@b@ return stringIfNull;@b@@b@ return new ToStringBuilder(array, ToStringStyle.SIMPLE_STYLE).append(array).toString();@b@ }@b@}
2.org.apache.commons.lang3.ArrayUtils
package org.apache.commons.lang3;@b@@b@import B;@b@import C;@b@import D;@b@import F;@b@import I;@b@import J;@b@import S;@b@import Z;@b@import java.lang.reflect.Array;@b@import java.util.Arrays;@b@import java.util.BitSet;@b@import java.util.HashMap;@b@import java.util.Map;@b@import java.util.Map.Entry;@b@import org.apache.commons.lang3.builder.EqualsBuilder;@b@import org.apache.commons.lang3.builder.HashCodeBuilder;@b@import org.apache.commons.lang3.builder.ToStringBuilder;@b@import org.apache.commons.lang3.builder.ToStringStyle;@b@import org.apache.commons.lang3.mutable.MutableInt;@b@@b@public class ArrayUtils@b@{@b@ public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];@b@ public static final Class<?>[] EMPTY_CLASS_ARRAY = new Class[0];@b@ public static final String[] EMPTY_STRING_ARRAY = new String[0];@b@ public static final long[] EMPTY_LONG_ARRAY = new long[0];@b@ public static final Long[] EMPTY_LONG_OBJECT_ARRAY = new Long[0];@b@ public static final int[] EMPTY_INT_ARRAY = new int[0];@b@ public static final Integer[] EMPTY_INTEGER_OBJECT_ARRAY = new Integer[0];@b@ public static final short[] EMPTY_SHORT_ARRAY = new short[0];@b@ public static final Short[] EMPTY_SHORT_OBJECT_ARRAY = new Short[0];@b@ public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];@b@ public static final Byte[] EMPTY_BYTE_OBJECT_ARRAY = new Byte[0];@b@ public static final double[] EMPTY_DOUBLE_ARRAY = new double[0];@b@ public static final Double[] EMPTY_DOUBLE_OBJECT_ARRAY = new Double[0];@b@ public static final float[] EMPTY_FLOAT_ARRAY = new float[0];@b@ public static final Float[] EMPTY_FLOAT_OBJECT_ARRAY = new Float[0];@b@ public static final boolean[] EMPTY_BOOLEAN_ARRAY = new boolean[0];@b@ public static final Boolean[] EMPTY_BOOLEAN_OBJECT_ARRAY = new Boolean[0];@b@ public static final char[] EMPTY_CHAR_ARRAY = new char[0];@b@ public static final Character[] EMPTY_CHARACTER_OBJECT_ARRAY = new Character[0];@b@ public static final int INDEX_NOT_FOUND = -1;@b@@b@ public static String toString(Object array)@b@ {@b@ return toString(array, "{}");@b@ }@b@@b@ public static String toString(Object array, String stringIfNull)@b@ {@b@ if (array == null)@b@ return stringIfNull;@b@@b@ return new ToStringBuilder(array, ToStringStyle.SIMPLE_STYLE).append(array).toString();@b@ }@b@@b@ public static int hashCode(Object array)@b@ {@b@ return new HashCodeBuilder().append(array).toHashCode();@b@ }@b@@b@ /**@b@ * @deprecated@b@ */@b@ public static boolean isEquals(Object array1, Object array2)@b@ {@b@ return new EqualsBuilder().append(array1, array2).isEquals();@b@ }@b@@b@ public static Map<Object, Object> toMap(Object[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ Map map = new HashMap((int)(array.length * 1.5D));@b@ for (int i = 0; i < array.length; ++i) {@b@ Object object = array[i];@b@ if (object instanceof Map.Entry) {@b@ Map.Entry entry = (Map.Entry)object;@b@ map.put(entry.getKey(), entry.getValue());@b@ } else if (object instanceof Object[]) {@b@ Object[] entry = (Object[])(Object[])object;@b@ if (entry.length < 2) {@b@ throw new IllegalArgumentException("Array element " + i + ", '" + object + "', has a length less than 2");@b@ }@b@@b@ map.put(entry[0], entry[1]);@b@ } else {@b@ throw new IllegalArgumentException("Array element " + i + ", '" + object + "', is neither of type Map.Entry nor an Array");@b@ }@b@@b@ }@b@@b@ return map;@b@ }@b@@b@ public static <T> T[] toArray(T[] items)@b@ {@b@ return items;@b@ }@b@@b@ public static <T> T[] clone(T[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ return ((Object[])array.clone());@b@ }@b@@b@ public static long[] clone(long[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ return ((long[])array.clone());@b@ }@b@@b@ public static int[] clone(int[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ return ((int[])array.clone());@b@ }@b@@b@ public static short[] clone(short[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ return ((short[])array.clone());@b@ }@b@@b@ public static char[] clone(char[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ return ((char[])array.clone());@b@ }@b@@b@ public static byte[] clone(byte[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ return ((byte[])array.clone());@b@ }@b@@b@ public static double[] clone(double[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ return ((double[])array.clone());@b@ }@b@@b@ public static float[] clone(float[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ return ((float[])array.clone());@b@ }@b@@b@ public static boolean[] clone(boolean[] array)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ return ((boolean[])array.clone());@b@ }@b@@b@ public static Object[] nullToEmpty(Object[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_OBJECT_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static Class<?>[] nullToEmpty(Class<?>[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_CLASS_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static String[] nullToEmpty(String[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_STRING_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static long[] nullToEmpty(long[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_LONG_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static int[] nullToEmpty(int[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_INT_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static short[] nullToEmpty(short[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_SHORT_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static char[] nullToEmpty(char[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_CHAR_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static byte[] nullToEmpty(byte[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_BYTE_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static double[] nullToEmpty(double[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_DOUBLE_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static float[] nullToEmpty(float[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_FLOAT_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static boolean[] nullToEmpty(boolean[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_BOOLEAN_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static Long[] nullToEmpty(Long[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_LONG_OBJECT_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static Integer[] nullToEmpty(Integer[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_INTEGER_OBJECT_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static Short[] nullToEmpty(Short[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_SHORT_OBJECT_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static Character[] nullToEmpty(Character[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_CHARACTER_OBJECT_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static Byte[] nullToEmpty(Byte[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_BYTE_OBJECT_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static Double[] nullToEmpty(Double[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_DOUBLE_OBJECT_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static Float[] nullToEmpty(Float[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_FLOAT_OBJECT_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static Boolean[] nullToEmpty(Boolean[] array)@b@ {@b@ if ((array == null) || (array.length == 0))@b@ return EMPTY_BOOLEAN_OBJECT_ARRAY;@b@@b@ return array;@b@ }@b@@b@ public static <T> T[] subarray(T[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ if (startIndexInclusive < 0)@b@ startIndexInclusive = 0;@b@@b@ if (endIndexExclusive > array.length)@b@ endIndexExclusive = array.length;@b@@b@ int newSize = endIndexExclusive - startIndexInclusive;@b@ Class type = array.getClass().getComponentType();@b@ if (newSize <= 0)@b@ {@b@ Object[] emptyArray = (Object[])(Object[])Array.newInstance(type, 0);@b@ return emptyArray;@b@ }@b@@b@ Object[] subarray = (Object[])(Object[])Array.newInstance(type, newSize);@b@ System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);@b@ return subarray;@b@ }@b@@b@ public static long[] subarray(long[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ if (startIndexInclusive < 0)@b@ startIndexInclusive = 0;@b@@b@ if (endIndexExclusive > array.length)@b@ endIndexExclusive = array.length;@b@@b@ int newSize = endIndexExclusive - startIndexInclusive;@b@ if (newSize <= 0) {@b@ return EMPTY_LONG_ARRAY;@b@ }@b@@b@ long[] subarray = new long[newSize];@b@ System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);@b@ return subarray;@b@ }@b@@b@ public static int[] subarray(int[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ if (startIndexInclusive < 0)@b@ startIndexInclusive = 0;@b@@b@ if (endIndexExclusive > array.length)@b@ endIndexExclusive = array.length;@b@@b@ int newSize = endIndexExclusive - startIndexInclusive;@b@ if (newSize <= 0) {@b@ return EMPTY_INT_ARRAY;@b@ }@b@@b@ int[] subarray = new int[newSize];@b@ System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);@b@ return subarray;@b@ }@b@@b@ public static short[] subarray(short[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ if (startIndexInclusive < 0)@b@ startIndexInclusive = 0;@b@@b@ if (endIndexExclusive > array.length)@b@ endIndexExclusive = array.length;@b@@b@ int newSize = endIndexExclusive - startIndexInclusive;@b@ if (newSize <= 0) {@b@ return EMPTY_SHORT_ARRAY;@b@ }@b@@b@ short[] subarray = new short[newSize];@b@ System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);@b@ return subarray;@b@ }@b@@b@ public static char[] subarray(char[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ if (startIndexInclusive < 0)@b@ startIndexInclusive = 0;@b@@b@ if (endIndexExclusive > array.length)@b@ endIndexExclusive = array.length;@b@@b@ int newSize = endIndexExclusive - startIndexInclusive;@b@ if (newSize <= 0) {@b@ return EMPTY_CHAR_ARRAY;@b@ }@b@@b@ char[] subarray = new char[newSize];@b@ System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);@b@ return subarray;@b@ }@b@@b@ public static byte[] subarray(byte[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ if (startIndexInclusive < 0)@b@ startIndexInclusive = 0;@b@@b@ if (endIndexExclusive > array.length)@b@ endIndexExclusive = array.length;@b@@b@ int newSize = endIndexExclusive - startIndexInclusive;@b@ if (newSize <= 0) {@b@ return EMPTY_BYTE_ARRAY;@b@ }@b@@b@ byte[] subarray = new byte[newSize];@b@ System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);@b@ return subarray;@b@ }@b@@b@ public static double[] subarray(double[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ if (startIndexInclusive < 0)@b@ startIndexInclusive = 0;@b@@b@ if (endIndexExclusive > array.length)@b@ endIndexExclusive = array.length;@b@@b@ int newSize = endIndexExclusive - startIndexInclusive;@b@ if (newSize <= 0) {@b@ return EMPTY_DOUBLE_ARRAY;@b@ }@b@@b@ double[] subarray = new double[newSize];@b@ System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);@b@ return subarray;@b@ }@b@@b@ public static float[] subarray(float[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ if (startIndexInclusive < 0)@b@ startIndexInclusive = 0;@b@@b@ if (endIndexExclusive > array.length)@b@ endIndexExclusive = array.length;@b@@b@ int newSize = endIndexExclusive - startIndexInclusive;@b@ if (newSize <= 0) {@b@ return EMPTY_FLOAT_ARRAY;@b@ }@b@@b@ float[] subarray = new float[newSize];@b@ System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);@b@ return subarray;@b@ }@b@@b@ public static boolean[] subarray(boolean[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return null;@b@@b@ if (startIndexInclusive < 0)@b@ startIndexInclusive = 0;@b@@b@ if (endIndexExclusive > array.length)@b@ endIndexExclusive = array.length;@b@@b@ int newSize = endIndexExclusive - startIndexInclusive;@b@ if (newSize <= 0) {@b@ return EMPTY_BOOLEAN_ARRAY;@b@ }@b@@b@ boolean[] subarray = new boolean[newSize];@b@ System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);@b@ return subarray;@b@ }@b@@b@ public static boolean isSameLength(Object[] array1, Object[] array2)@b@ {@b@ return ((((array1 != null) || (array2 == null) || (array2.length <= 0))) && (((array2 != null) || (array1 == null) || (array1.length <= 0))) && (((array1 == null) || (array2 == null) || (array1.length == array2.length))));@b@ }@b@@b@ public static boolean isSameLength(long[] array1, long[] array2)@b@ {@b@ return ((((array1 != null) || (array2 == null) || (array2.length <= 0))) && (((array2 != null) || (array1 == null) || (array1.length <= 0))) && (((array1 == null) || (array2 == null) || (array1.length == array2.length))));@b@ }@b@@b@ public static boolean isSameLength(int[] array1, int[] array2)@b@ {@b@ return ((((array1 != null) || (array2 == null) || (array2.length <= 0))) && (((array2 != null) || (array1 == null) || (array1.length <= 0))) && (((array1 == null) || (array2 == null) || (array1.length == array2.length))));@b@ }@b@@b@ public static boolean isSameLength(short[] array1, short[] array2)@b@ {@b@ return ((((array1 != null) || (array2 == null) || (array2.length <= 0))) && (((array2 != null) || (array1 == null) || (array1.length <= 0))) && (((array1 == null) || (array2 == null) || (array1.length == array2.length))));@b@ }@b@@b@ public static boolean isSameLength(char[] array1, char[] array2)@b@ {@b@ return ((((array1 != null) || (array2 == null) || (array2.length <= 0))) && (((array2 != null) || (array1 == null) || (array1.length <= 0))) && (((array1 == null) || (array2 == null) || (array1.length == array2.length))));@b@ }@b@@b@ public static boolean isSameLength(byte[] array1, byte[] array2)@b@ {@b@ return ((((array1 != null) || (array2 == null) || (array2.length <= 0))) && (((array2 != null) || (array1 == null) || (array1.length <= 0))) && (((array1 == null) || (array2 == null) || (array1.length == array2.length))));@b@ }@b@@b@ public static boolean isSameLength(double[] array1, double[] array2)@b@ {@b@ return ((((array1 != null) || (array2 == null) || (array2.length <= 0))) && (((array2 != null) || (array1 == null) || (array1.length <= 0))) && (((array1 == null) || (array2 == null) || (array1.length == array2.length))));@b@ }@b@@b@ public static boolean isSameLength(float[] array1, float[] array2)@b@ {@b@ return ((((array1 != null) || (array2 == null) || (array2.length <= 0))) && (((array2 != null) || (array1 == null) || (array1.length <= 0))) && (((array1 == null) || (array2 == null) || (array1.length == array2.length))));@b@ }@b@@b@ public static boolean isSameLength(boolean[] array1, boolean[] array2)@b@ {@b@ return ((((array1 != null) || (array2 == null) || (array2.length <= 0))) && (((array2 != null) || (array1 == null) || (array1.length <= 0))) && (((array1 == null) || (array2 == null) || (array1.length == array2.length))));@b@ }@b@@b@ public static int getLength(Object array)@b@ {@b@ if (array == null)@b@ return 0;@b@@b@ return Array.getLength(array);@b@ }@b@@b@ public static boolean isSameType(Object array1, Object array2)@b@ {@b@ if ((array1 == null) || (array2 == null))@b@ throw new IllegalArgumentException("The Array must not be null");@b@@b@ return array1.getClass().getName().equals(array2.getClass().getName());@b@ }@b@@b@ public static void reverse(Object[] array)@b@ {@b@ if (array == null)@b@ return;@b@@b@ reverse(array, 0, array.length);@b@ }@b@@b@ public static void reverse(long[] array)@b@ {@b@ if (array == null)@b@ return;@b@@b@ reverse(array, 0, array.length);@b@ }@b@@b@ public static void reverse(int[] array)@b@ {@b@ if (array == null)@b@ return;@b@@b@ reverse(array, 0, array.length);@b@ }@b@@b@ public static void reverse(short[] array)@b@ {@b@ if (array == null)@b@ return;@b@@b@ reverse(array, 0, array.length);@b@ }@b@@b@ public static void reverse(char[] array)@b@ {@b@ if (array == null)@b@ return;@b@@b@ reverse(array, 0, array.length);@b@ }@b@@b@ public static void reverse(byte[] array)@b@ {@b@ if (array == null)@b@ return;@b@@b@ reverse(array, 0, array.length);@b@ }@b@@b@ public static void reverse(double[] array)@b@ {@b@ if (array == null)@b@ return;@b@@b@ reverse(array, 0, array.length);@b@ }@b@@b@ public static void reverse(float[] array)@b@ {@b@ if (array == null)@b@ return;@b@@b@ reverse(array, 0, array.length);@b@ }@b@@b@ public static void reverse(boolean[] array)@b@ {@b@ if (array == null)@b@ return;@b@@b@ reverse(array, 0, array.length);@b@ }@b@@b@ public static void reverse(boolean[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return;@b@@b@ int i = (startIndexInclusive < 0) ? 0 : startIndexInclusive;@b@ int j = Math.min(array.length, endIndexExclusive) - 1;@b@@b@ while (j > i) {@b@ boolean tmp = array[j];@b@ array[j] = array[i];@b@ array[i] = tmp;@b@ --j;@b@ ++i;@b@ }@b@ }@b@@b@ public static void reverse(byte[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return;@b@@b@ int i = (startIndexInclusive < 0) ? 0 : startIndexInclusive;@b@ int j = Math.min(array.length, endIndexExclusive) - 1;@b@@b@ while (j > i) {@b@ byte tmp = array[j];@b@ array[j] = array[i];@b@ array[i] = tmp;@b@ --j;@b@ ++i;@b@ }@b@ }@b@@b@ public static void reverse(char[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return;@b@@b@ int i = (startIndexInclusive < 0) ? 0 : startIndexInclusive;@b@ int j = Math.min(array.length, endIndexExclusive) - 1;@b@@b@ while (j > i) {@b@ char tmp = array[j];@b@ array[j] = array[i];@b@ array[i] = tmp;@b@ --j;@b@ ++i;@b@ }@b@ }@b@@b@ public static void reverse(double[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return;@b@@b@ int i = (startIndexInclusive < 0) ? 0 : startIndexInclusive;@b@ int j = Math.min(array.length, endIndexExclusive) - 1;@b@@b@ while (j > i) {@b@ double tmp = array[j];@b@ array[j] = array[i];@b@ array[i] = tmp;@b@ --j;@b@ ++i;@b@ }@b@ }@b@@b@ public static void reverse(float[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return;@b@@b@ int i = (startIndexInclusive < 0) ? 0 : startIndexInclusive;@b@ int j = Math.min(array.length, endIndexExclusive) - 1;@b@@b@ while (j > i) {@b@ float tmp = array[j];@b@ array[j] = array[i];@b@ array[i] = tmp;@b@ --j;@b@ ++i;@b@ }@b@ }@b@@b@ public static void reverse(int[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return;@b@@b@ int i = (startIndexInclusive < 0) ? 0 : startIndexInclusive;@b@ int j = Math.min(array.length, endIndexExclusive) - 1;@b@@b@ while (j > i) {@b@ int tmp = array[j];@b@ array[j] = array[i];@b@ array[i] = tmp;@b@ --j;@b@ ++i;@b@ }@b@ }@b@@b@ public static void reverse(long[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return;@b@@b@ int i = (startIndexInclusive < 0) ? 0 : startIndexInclusive;@b@ int j = Math.min(array.length, endIndexExclusive) - 1;@b@@b@ while (j > i) {@b@ long tmp = array[j];@b@ array[j] = array[i];@b@ array[i] = tmp;@b@ --j;@b@ ++i;@b@ }@b@ }@b@@b@ public static void reverse(Object[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return;@b@@b@ int i = (startIndexInclusive < 0) ? 0 : startIndexInclusive;@b@ int j = Math.min(array.length, endIndexExclusive) - 1;@b@@b@ while (j > i) {@b@ Object tmp = array[j];@b@ array[j] = array[i];@b@ array[i] = tmp;@b@ --j;@b@ ++i;@b@ }@b@ }@b@@b@ public static void reverse(short[] array, int startIndexInclusive, int endIndexExclusive)@b@ {@b@ if (array == null)@b@ return;@b@@b@ int i = (startIndexInclusive < 0) ? 0 : startIndexInclusive;@b@ int j = Math.min(array.length, endIndexExclusive) - 1;@b@@b@ while (j > i) {@b@ short tmp = array[j];@b@ array[j] = array[i];@b@ array[i] = tmp;@b@ --j;@b@ ++i;@b@ }@b@ }@b@@b@ public static int indexOf(Object[] array, Object objectToFind)@b@ {@b@ return indexOf(array, objectToFind, 0);@b@ }@b@@b@ public static int indexOf(Object[] array, Object objectToFind, int startIndex)@b@ {@b@ int i;@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ if (objectToFind == null)@b@ for (i = startIndex; i < array.length; ++i)@b@ if (array[i] == null)@b@ return i;@b@@b@@b@ else if (array.getClass().getComponentType().isInstance(objectToFind))@b@ for (i = startIndex; i < array.length; ++i)@b@ if (objectToFind.equals(array[i]))@b@ return i;@b@@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(Object[] array, Object objectToFind)@b@ {@b@ return lastIndexOf(array, objectToFind, 2147483647);@b@ }@b@@b@ public static int lastIndexOf(Object[] array, Object objectToFind, int startIndex)@b@ {@b@ int i;@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ if (objectToFind == null)@b@ for (i = startIndex; i >= 0; --i)@b@ if (array[i] == null)@b@ return i;@b@@b@@b@ else if (array.getClass().getComponentType().isInstance(objectToFind))@b@ for (i = startIndex; i >= 0; --i)@b@ if (objectToFind.equals(array[i]))@b@ return i;@b@@b@@b@@b@ return -1;@b@ }@b@@b@ public static boolean contains(Object[] array, Object objectToFind)@b@ {@b@ return (indexOf(array, objectToFind) != -1);@b@ }@b@@b@ public static int indexOf(long[] array, long valueToFind)@b@ {@b@ return indexOf(array, valueToFind, 0);@b@ }@b@@b@ public static int indexOf(long[] array, long valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ for (int i = startIndex; i < array.length; ++i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(long[] array, long valueToFind)@b@ {@b@ return lastIndexOf(array, valueToFind, 2147483647);@b@ }@b@@b@ public static int lastIndexOf(long[] array, long valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ for (int i = startIndex; i >= 0; --i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static boolean contains(long[] array, long valueToFind)@b@ {@b@ return (indexOf(array, valueToFind) != -1);@b@ }@b@@b@ public static int indexOf(int[] array, int valueToFind)@b@ {@b@ return indexOf(array, valueToFind, 0);@b@ }@b@@b@ public static int indexOf(int[] array, int valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ for (int i = startIndex; i < array.length; ++i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(int[] array, int valueToFind)@b@ {@b@ return lastIndexOf(array, valueToFind, 2147483647);@b@ }@b@@b@ public static int lastIndexOf(int[] array, int valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ for (int i = startIndex; i >= 0; --i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static boolean contains(int[] array, int valueToFind)@b@ {@b@ return (indexOf(array, valueToFind) != -1);@b@ }@b@@b@ public static int indexOf(short[] array, short valueToFind)@b@ {@b@ return indexOf(array, valueToFind, 0);@b@ }@b@@b@ public static int indexOf(short[] array, short valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ for (int i = startIndex; i < array.length; ++i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(short[] array, short valueToFind)@b@ {@b@ return lastIndexOf(array, valueToFind, 2147483647);@b@ }@b@@b@ public static int lastIndexOf(short[] array, short valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ for (int i = startIndex; i >= 0; --i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static boolean contains(short[] array, short valueToFind)@b@ {@b@ return (indexOf(array, valueToFind) != -1);@b@ }@b@@b@ public static int indexOf(char[] array, char valueToFind)@b@ {@b@ return indexOf(array, valueToFind, 0);@b@ }@b@@b@ public static int indexOf(char[] array, char valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ for (int i = startIndex; i < array.length; ++i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(char[] array, char valueToFind)@b@ {@b@ return lastIndexOf(array, valueToFind, 2147483647);@b@ }@b@@b@ public static int lastIndexOf(char[] array, char valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ for (int i = startIndex; i >= 0; --i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static boolean contains(char[] array, char valueToFind)@b@ {@b@ return (indexOf(array, valueToFind) != -1);@b@ }@b@@b@ public static int indexOf(byte[] array, byte valueToFind)@b@ {@b@ return indexOf(array, valueToFind, 0);@b@ }@b@@b@ public static int indexOf(byte[] array, byte valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ for (int i = startIndex; i < array.length; ++i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(byte[] array, byte valueToFind)@b@ {@b@ return lastIndexOf(array, valueToFind, 2147483647);@b@ }@b@@b@ public static int lastIndexOf(byte[] array, byte valueToFind, int startIndex)@b@ {@b@ if (array == null)@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ for (int i = startIndex; i >= 0; --i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static boolean contains(byte[] array, byte valueToFind)@b@ {@b@ return (indexOf(array, valueToFind) != -1);@b@ }@b@@b@ public static int indexOf(double[] array, double valueToFind)@b@ {@b@ return indexOf(array, valueToFind, 0);@b@ }@b@@b@ public static int indexOf(double[] array, double valueToFind, double tolerance)@b@ {@b@ return indexOf(array, valueToFind, 0, tolerance);@b@ }@b@@b@ public static int indexOf(double[] array, double valueToFind, int startIndex)@b@ {@b@ if (isEmpty(array))@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ for (int i = startIndex; i < array.length; ++i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int indexOf(double[] array, double valueToFind, int startIndex, double tolerance)@b@ {@b@ if (isEmpty(array))@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ double min = valueToFind - tolerance;@b@ double max = valueToFind + tolerance;@b@ for (int i = startIndex; i < array.length; ++i)@b@ if ((array[i] >= min) && (array[i] <= max))@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(double[] array, double valueToFind)@b@ {@b@ return lastIndexOf(array, valueToFind, 2147483647);@b@ }@b@@b@ public static int lastIndexOf(double[] array, double valueToFind, double tolerance)@b@ {@b@ return lastIndexOf(array, valueToFind, 2147483647, tolerance);@b@ }@b@@b@ public static int lastIndexOf(double[] array, double valueToFind, int startIndex)@b@ {@b@ if (isEmpty(array))@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ for (int i = startIndex; i >= 0; --i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(double[] array, double valueToFind, int startIndex, double tolerance)@b@ {@b@ if (isEmpty(array))@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ double min = valueToFind - tolerance;@b@ double max = valueToFind + tolerance;@b@ for (int i = startIndex; i >= 0; --i)@b@ if ((array[i] >= min) && (array[i] <= max))@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static boolean contains(double[] array, double valueToFind)@b@ {@b@ return (indexOf(array, valueToFind) != -1);@b@ }@b@@b@ public static boolean contains(double[] array, double valueToFind, double tolerance)@b@ {@b@ return (indexOf(array, valueToFind, 0, tolerance) != -1);@b@ }@b@@b@ public static int indexOf(float[] array, float valueToFind)@b@ {@b@ return indexOf(array, valueToFind, 0);@b@ }@b@@b@ public static int indexOf(float[] array, float valueToFind, int startIndex)@b@ {@b@ if (isEmpty(array))@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ for (int i = startIndex; i < array.length; ++i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(float[] array, float valueToFind)@b@ {@b@ return lastIndexOf(array, valueToFind, 2147483647);@b@ }@b@@b@ public static int lastIndexOf(float[] array, float valueToFind, int startIndex)@b@ {@b@ if (isEmpty(array))@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ for (int i = startIndex; i >= 0; --i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static boolean contains(float[] array, float valueToFind)@b@ {@b@ return (indexOf(array, valueToFind) != -1);@b@ }@b@@b@ public static int indexOf(boolean[] array, boolean valueToFind)@b@ {@b@ return indexOf(array, valueToFind, 0);@b@ }@b@@b@ public static int indexOf(boolean[] array, boolean valueToFind, int startIndex)@b@ {@b@ if (isEmpty(array))@b@ return -1;@b@@b@ if (startIndex < 0)@b@ startIndex = 0;@b@@b@ for (int i = startIndex; i < array.length; ++i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static int lastIndexOf(boolean[] array, boolean valueToFind)@b@ {@b@ return lastIndexOf(array, valueToFind, 2147483647);@b@ }@b@@b@ public static int lastIndexOf(boolean[] array, boolean valueToFind, int startIndex)@b@ {@b@ if (isEmpty(array))@b@ return -1;@b@@b@ if (startIndex < 0)@b@ return -1;@b@ if (startIndex >= array.length)@b@ startIndex = array.length - 1;@b@@b@ for (int i = startIndex; i >= 0; --i)@b@ if (valueToFind == array[i])@b@ return i;@b@@b@@b@ return -1;@b@ }@b@@b@ public static boolean contains(boolean[] array, boolean valueToFind)@b@ {@b@ return (indexOf(array, valueToFind) != -1);@b@ }@b@@b@ public static char[] toPrimitive(Character[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_CHAR_ARRAY;@b@@b@ char[] result = new char[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = array[i].charValue();@b@@b@ return result;@b@ }@b@@b@ public static char[] toPrimitive(Character[] array, char valueForNull)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_CHAR_ARRAY;@b@@b@ char[] result = new char[array.length];@b@ for (int i = 0; i < array.length; ++i) {@b@ Character b = array[i];@b@ result[i] = ((b == null) ? valueForNull : b.charValue());@b@ }@b@ return result;@b@ }@b@@b@ public static Character[] toObject(char[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_CHARACTER_OBJECT_ARRAY;@b@@b@ Character[] result = new Character[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = Character.valueOf(array[i]);@b@@b@ return result;@b@ }@b@@b@ public static long[] toPrimitive(Long[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_LONG_ARRAY;@b@@b@ long[] result = new long[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = array[i].longValue();@b@@b@ return result;@b@ }@b@@b@ public static long[] toPrimitive(Long[] array, long valueForNull)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_LONG_ARRAY;@b@@b@ long[] result = new long[array.length];@b@ for (int i = 0; i < array.length; ++i) {@b@ Long b = array[i];@b@ result[i] = ((b == null) ? valueForNull : b.longValue());@b@ }@b@ return result;@b@ }@b@@b@ public static Long[] toObject(long[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_LONG_OBJECT_ARRAY;@b@@b@ Long[] result = new Long[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = Long.valueOf(array[i]);@b@@b@ return result;@b@ }@b@@b@ public static int[] toPrimitive(Integer[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_INT_ARRAY;@b@@b@ int[] result = new int[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = array[i].intValue();@b@@b@ return result;@b@ }@b@@b@ public static int[] toPrimitive(Integer[] array, int valueForNull)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_INT_ARRAY;@b@@b@ int[] result = new int[array.length];@b@ for (int i = 0; i < array.length; ++i) {@b@ Integer b = array[i];@b@ result[i] = ((b == null) ? valueForNull : b.intValue());@b@ }@b@ return result;@b@ }@b@@b@ public static Integer[] toObject(int[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_INTEGER_OBJECT_ARRAY;@b@@b@ Integer[] result = new Integer[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = Integer.valueOf(array[i]);@b@@b@ return result;@b@ }@b@@b@ public static short[] toPrimitive(Short[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_SHORT_ARRAY;@b@@b@ short[] result = new short[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = array[i].shortValue();@b@@b@ return result;@b@ }@b@@b@ public static short[] toPrimitive(Short[] array, short valueForNull)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_SHORT_ARRAY;@b@@b@ short[] result = new short[array.length];@b@ for (int i = 0; i < array.length; ++i) {@b@ Short b = array[i];@b@ result[i] = ((b == null) ? valueForNull : b.shortValue());@b@ }@b@ return result;@b@ }@b@@b@ public static Short[] toObject(short[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_SHORT_OBJECT_ARRAY;@b@@b@ Short[] result = new Short[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = Short.valueOf(array[i]);@b@@b@ return result;@b@ }@b@@b@ public static byte[] toPrimitive(Byte[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_BYTE_ARRAY;@b@@b@ byte[] result = new byte[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = array[i].byteValue();@b@@b@ return result;@b@ }@b@@b@ public static byte[] toPrimitive(Byte[] array, byte valueForNull)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_BYTE_ARRAY;@b@@b@ byte[] result = new byte[array.length];@b@ for (int i = 0; i < array.length; ++i) {@b@ Byte b = array[i];@b@ result[i] = ((b == null) ? valueForNull : b.byteValue());@b@ }@b@ return result;@b@ }@b@@b@ public static Byte[] toObject(byte[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_BYTE_OBJECT_ARRAY;@b@@b@ Byte[] result = new Byte[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = Byte.valueOf(array[i]);@b@@b@ return result;@b@ }@b@@b@ public static double[] toPrimitive(Double[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_DOUBLE_ARRAY;@b@@b@ double[] result = new double[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = array[i].doubleValue();@b@@b@ return result;@b@ }@b@@b@ public static double[] toPrimitive(Double[] array, double valueForNull)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_DOUBLE_ARRAY;@b@@b@ double[] result = new double[array.length];@b@ for (int i = 0; i < array.length; ++i) {@b@ Double b = array[i];@b@ result[i] = ((b == null) ? valueForNull : b.doubleValue());@b@ }@b@ return result;@b@ }@b@@b@ public static Double[] toObject(double[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_DOUBLE_OBJECT_ARRAY;@b@@b@ Double[] result = new Double[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = Double.valueOf(array[i]);@b@@b@ return result;@b@ }@b@@b@ public static float[] toPrimitive(Float[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_FLOAT_ARRAY;@b@@b@ float[] result = new float[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = array[i].floatValue();@b@@b@ return result;@b@ }@b@@b@ public static float[] toPrimitive(Float[] array, float valueForNull)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_FLOAT_ARRAY;@b@@b@ float[] result = new float[array.length];@b@ for (int i = 0; i < array.length; ++i) {@b@ Float b = array[i];@b@ result[i] = ((b == null) ? valueForNull : b.floatValue());@b@ }@b@ return result;@b@ }@b@@b@ public static Float[] toObject(float[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_FLOAT_OBJECT_ARRAY;@b@@b@ Float[] result = new Float[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = Float.valueOf(array[i]);@b@@b@ return result;@b@ }@b@@b@ public static boolean[] toPrimitive(Boolean[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_BOOLEAN_ARRAY;@b@@b@ boolean[] result = new boolean[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = array[i].booleanValue();@b@@b@ return result;@b@ }@b@@b@ public static boolean[] toPrimitive(Boolean[] array, boolean valueForNull)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_BOOLEAN_ARRAY;@b@@b@ boolean[] result = new boolean[array.length];@b@ for (int i = 0; i < array.length; ++i) {@b@ Boolean b = array[i];@b@ result[i] = ((b == null) ? valueForNull : b.booleanValue());@b@ }@b@ return result;@b@ }@b@@b@ public static Boolean[] toObject(boolean[] array)@b@ {@b@ if (array == null)@b@ return null;@b@ if (array.length == 0)@b@ return EMPTY_BOOLEAN_OBJECT_ARRAY;@b@@b@ Boolean[] result = new Boolean[array.length];@b@ for (int i = 0; i < array.length; ++i)@b@ result[i] = ((array[i] != 0) ? Boolean.TRUE : Boolean.FALSE);@b@@b@ return result;@b@ }@b@@b@ public static boolean isEmpty(Object[] array)@b@ {@b@ return ((array == null) || (array.length == 0));@b@ }@b@@b@ public static boolean isEmpty(long[] array)@b@ {@b@ return ((array == null) || (array.length == 0));@b@ }@b@@b@ public static boolean isEmpty(int[] array)@b@ {@b@ return ((array == null) || (array.length == 0));@b@ }@b@@b@ public static boolean isEmpty(short[] array)@b@ {@b@ return ((array == null) || (array.length == 0));@b@ }@b@@b@ public static boolean isEmpty(char[] array)@b@ {@b@ return ((array == null) || (array.length == 0));@b@ }@b@@b@ public static boolean isEmpty(byte[] array)@b@ {@b@ return ((array == null) || (array.length == 0));@b@ }@b@@b@ public static boolean isEmpty(double[] array)@b@ {@b@ return ((array == null) || (array.length == 0));@b@ }@b@@b@ public static boolean isEmpty(float[] array)@b@ {@b@ return ((array == null) || (array.length == 0));@b@ }@b@@b@ public static boolean isEmpty(boolean[] array)@b@ {@b@ return ((array == null) || (array.length == 0));@b@ }@b@@b@ public static <T> boolean isNotEmpty(T[] array)@b@ {@b@ return ((array != null) && (array.length != 0));@b@ }@b@@b@ public static boolean isNotEmpty(long[] array)@b@ {@b@ return ((array != null) && (array.length != 0));@b@ }@b@@b@ public static boolean isNotEmpty(int[] array)@b@ {@b@ return ((array != null) && (array.length != 0));@b@ }@b@@b@ public static boolean isNotEmpty(short[] array)@b@ {@b@ return ((array != null) && (array.length != 0));@b@ }@b@@b@ public static boolean isNotEmpty(char[] array)@b@ {@b@ return ((array != null) && (array.length != 0));@b@ }@b@@b@ public static boolean isNotEmpty(byte[] array)@b@ {@b@ return ((array != null) && (array.length != 0));@b@ }@b@@b@ public static boolean isNotEmpty(double[] array)@b@ {@b@ return ((array != null) && (array.length != 0));@b@ }@b@@b@ public static boolean isNotEmpty(float[] array)@b@ {@b@ return ((array != null) && (array.length != 0));@b@ }@b@@b@ public static boolean isNotEmpty(boolean[] array)@b@ {@b@ return ((array != null) && (array.length != 0));@b@ }@b@@b@ public static <T> T[] addAll(T[] array1, T[] array2)@b@ {@b@ if (array1 == null)@b@ return clone(array2);@b@ if (array2 == null)@b@ return clone(array1);@b@@b@ Class type1 = array1.getClass().getComponentType();@b@@b@ Object[] joinedArray = (Object[])(Object[])Array.newInstance(type1, array1.length + array2.length);@b@ System.arraycopy(array1, 0, joinedArray, 0, array1.length);@b@ try {@b@ System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);@b@ }@b@ catch (ArrayStoreException ase)@b@ {@b@ Class type2 = array2.getClass().getComponentType();@b@ if (!(type1.isAssignableFrom(type2))) {@b@ throw new IllegalArgumentException("Cannot store " + type2.getName() + " in an array of " + type1.getName(), ase);@b@ }@b@@b@ throw ase;@b@ }@b@ return joinedArray;@b@ }@b@@b@ public static boolean[] addAll(boolean[] array1, boolean[] array2)@b@ {@b@ if (array1 == null)@b@ return clone(array2);@b@ if (array2 == null)@b@ return clone(array1);@b@@b@ boolean[] joinedArray = new boolean[array1.length + array2.length];@b@ System.arraycopy(array1, 0, joinedArray, 0, array1.length);@b@ System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);@b@ return joinedArray;@b@ }@b@@b@ public static char[] addAll(char[] array1, char[] array2)@b@ {@b@ if (array1 == null)@b@ return clone(array2);@b@ if (array2 == null)@b@ return clone(array1);@b@@b@ char[] joinedArray = new char[array1.length + array2.length];@b@ System.arraycopy(array1, 0, joinedArray, 0, array1.length);@b@ System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);@b@ return joinedArray;@b@ }@b@@b@ public static byte[] addAll(byte[] array1, byte[] array2)@b@ {@b@ if (array1 == null)@b@ return clone(array2);@b@ if (array2 == null)@b@ return clone(array1);@b@@b@ byte[] joinedArray = new byte[array1.length + array2.length];@b@ System.arraycopy(array1, 0, joinedArray, 0, array1.length);@b@ System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);@b@ return joinedArray;@b@ }@b@@b@ public static short[] addAll(short[] array1, short[] array2)@b@ {@b@ if (array1 == null)@b@ return clone(array2);@b@ if (array2 == null)@b@ return clone(array1);@b@@b@ short[] joinedArray = new short[array1.length + array2.length];@b@ System.arraycopy(array1, 0, joinedArray, 0, array1.length);@b@ System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);@b@ return joinedArray;@b@ }@b@@b@ public static int[] addAll(int[] array1, int[] array2)@b@ {@b@ if (array1 == null)@b@ return clone(array2);@b@ if (array2 == null)@b@ return clone(array1);@b@@b@ int[] joinedArray = new int[array1.length + array2.length];@b@ System.arraycopy(array1, 0, joinedArray, 0, array1.length);@b@ System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);@b@ return joinedArray;@b@ }@b@@b@ public static long[] addAll(long[] array1, long[] array2)@b@ {@b@ if (array1 == null)@b@ return clone(array2);@b@ if (array2 == null)@b@ return clone(array1);@b@@b@ long[] joinedArray = new long[array1.length + array2.length];@b@ System.arraycopy(array1, 0, joinedArray, 0, array1.length);@b@ System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);@b@ return joinedArray;@b@ }@b@@b@ public static float[] addAll(float[] array1, float[] array2)@b@ {@b@ if (array1 == null)@b@ return clone(array2);@b@ if (array2 == null)@b@ return clone(array1);@b@@b@ float[] joinedArray = new float[array1.length + array2.length];@b@ System.arraycopy(array1, 0, joinedArray, 0, array1.length);@b@ System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);@b@ return joinedArray;@b@ }@b@@b@ public static double[] addAll(double[] array1, double[] array2)@b@ {@b@ if (array1 == null)@b@ return clone(array2);@b@ if (array2 == null)@b@ return clone(array1);@b@@b@ double[] joinedArray = new double[array1.length + array2.length];@b@ System.arraycopy(array1, 0, joinedArray, 0, array1.length);@b@ System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);@b@ return joinedArray;@b@ }@b@@b@ public static <T> T[] add(T[] array, T element)@b@ {@b@ Class type;@b@ if (array != null)@b@ type = array.getClass();@b@ else if (element != null)@b@ type = element.getClass();@b@ else {@b@ throw new IllegalArgumentException("Arguments cannot both be null");@b@ }@b@@b@ Object[] newArray = (Object[])(Object[])copyArrayGrow1(array, type);@b@ newArray[(newArray.length - 1)] = element;@b@ return newArray;@b@ }@b@@b@ public static boolean[] add(boolean[] array, boolean element)@b@ {@b@ boolean[] newArray = (boolean[])(boolean[])copyArrayGrow1(array, Boolean.TYPE);@b@ newArray[(newArray.length - 1)] = element;@b@ return newArray;@b@ }@b@@b@ public static byte[] add(byte[] array, byte element)@b@ {@b@ byte[] newArray = (byte[])(byte[])copyArrayGrow1(array, Byte.TYPE);@b@ newArray[(newArray.length - 1)] = element;@b@ return newArray;@b@ }@b@@b@ public static char[] add(char[] array, char element)@b@ {@b@ char[] newArray = (char[])(char[])copyArrayGrow1(array, Character.TYPE);@b@ newArray[(newArray.length - 1)] = element;@b@ return newArray;@b@ }@b@@b@ public static double[] add(double[] array, double element)@b@ {@b@ double[] newArray = (double[])(double[])copyArrayGrow1(array, Double.TYPE);@b@ newArray[(newArray.length - 1)] = element;@b@ return newArray;@b@ }@b@@b@ public static float[] add(float[] array, float element)@b@ {@b@ float[] newArray = (float[])(float[])copyArrayGrow1(array, Float.TYPE);@b@ newArray[(newArray.length - 1)] = element;@b@ return newArray;@b@ }@b@@b@ public static int[] add(int[] array, int element)@b@ {@b@ int[] newArray = (int[])(int[])copyArrayGrow1(array, Integer.TYPE);@b@ newArray[(newArray.length - 1)] = element;@b@ return newArray;@b@ }@b@@b@ public static long[] add(long[] array, long element)@b@ {@b@ long[] newArray = (long[])(long[])copyArrayGrow1(array, Long.TYPE);@b@ newArray[(newArray.length - 1)] = element;@b@ return newArray;@b@ }@b@@b@ public static short[] add(short[] array, short element)@b@ {@b@ short[] newArray = (short[])(short[])copyArrayGrow1(array, Short.TYPE);@b@ newArray[(newArray.length - 1)] = element;@b@ return newArray;@b@ }@b@@b@ private static Object copyArrayGrow1(Object array, Class<?> newArrayComponentType)@b@ {@b@ if (array != null) {@b@ int arrayLength = Array.getLength(array);@b@ Object newArray = Array.newInstance(array.getClass().getComponentType(), arrayLength + 1);@b@ System.arraycopy(array, 0, newArray, 0, arrayLength);@b@ return newArray;@b@ }@b@ return Array.newInstance(newArrayComponentType, 1);@b@ }@b@@b@ public static <T> T[] add(T[] array, int index, T element)@b@ {@b@ Class clss = null;@b@ if (array != null)@b@ clss = array.getClass().getComponentType();@b@ else if (element != null)@b@ clss = element.getClass();@b@ else {@b@ throw new IllegalArgumentException("Array and element cannot both be null");@b@ }@b@@b@ Object[] newArray = (Object[])(Object[])add(array, index, element, clss);@b@ return newArray;@b@ }@b@@b@ public static boolean[] add(boolean[] array, int index, boolean element)@b@ {@b@ return ((boolean[])(boolean[])add(array, index, Boolean.valueOf(element), Boolean.TYPE));@b@ }@b@@b@ public static char[] add(char[] array, int index, char element)@b@ {@b@ return ((char[])(char[])add(array, index, Character.valueOf(element), Character.TYPE));@b@ }@b@@b@ public static byte[] add(byte[] array, int index, byte element)@b@ {@b@ return ((byte[])(byte[])add(array, index, Byte.valueOf(element), Byte.TYPE));@b@ }@b@@b@ public static short[] add(short[] array, int index, short element)@b@ {@b@ return ((short[])(short[])add(array, index, Short.valueOf(element), Short.TYPE));@b@ }@b@@b@ public static int[] add(int[] array, int index, int element)@b@ {@b@ return ((int[])(int[])add(array, index, Integer.valueOf(element), Integer.TYPE));@b@ }@b@@b@ public static long[] add(long[] array, int index, long element)@b@ {@b@ return ((long[])(long[])add(array, index, Long.valueOf(element), Long.TYPE));@b@ }@b@@b@ public static float[] add(float[] array, int index, float element)@b@ {@b@ return ((float[])(float[])add(array, index, Float.valueOf(element), Float.TYPE));@b@ }@b@@b@ public static double[] add(double[] array, int index, double element)@b@ {@b@ return ((double[])(double[])add(array, index, Double.valueOf(element), Double.TYPE));@b@ }@b@@b@ private static Object add(Object array, int index, Object element, Class<?> clss)@b@ {@b@ if (array == null) {@b@ if (index != 0)@b@ throw new IndexOutOfBoundsException("Index: " + index + ", Length: 0");@b@@b@ Object joinedArray = Array.newInstance(clss, 1);@b@ Array.set(joinedArray, 0, element);@b@ return joinedArray;@b@ }@b@ int length = Array.getLength(array);@b@ if ((index > length) || (index < 0))@b@ throw new IndexOutOfBoundsException("Index: " + index + ", Length: " + length);@b@@b@ Object result = Array.newInstance(clss, length + 1);@b@ System.arraycopy(array, 0, result, 0, index);@b@ Array.set(result, index, element);@b@ if (index < length)@b@ System.arraycopy(array, index, result, index + 1, length - index);@b@@b@ return result;@b@ }@b@@b@ public static <T> T[] remove(T[] array, int index)@b@ {@b@ return ((Object[])(Object[])remove(array, index));@b@ }@b@@b@ public static <T> T[] removeElement(T[] array, Object element)@b@ {@b@ int index = indexOf(array, element);@b@ if (index == -1)@b@ return clone(array);@b@@b@ return remove(array, index);@b@ }@b@@b@ public static boolean[] remove(boolean[] array, int index)@b@ {@b@ return ((boolean[])(boolean[])remove(array, index));@b@ }@b@@b@ public static boolean[] removeElement(boolean[] array, boolean element)@b@ {@b@ int index = indexOf(array, element);@b@ if (index == -1)@b@ return clone(array);@b@@b@ return remove(array, index);@b@ }@b@@b@ public static byte[] remove(byte[] array, int index)@b@ {@b@ return ((byte[])(byte[])remove(array, index));@b@ }@b@@b@ public static byte[] removeElement(byte[] array, byte element)@b@ {@b@ int index = indexOf(array, element);@b@ if (index == -1)@b@ return clone(array);@b@@b@ return remove(array, index);@b@ }@b@@b@ public static char[] remove(char[] array, int index)@b@ {@b@ return ((char[])(char[])remove(array, index));@b@ }@b@@b@ public static char[] removeElement(char[] array, char element)@b@ {@b@ int index = indexOf(array, element);@b@ if (index == -1)@b@ return clone(array);@b@@b@ return remove(array, index);@b@ }@b@@b@ public static double[] remove(double[] array, int index)@b@ {@b@ return ((double[])(double[])remove(array, index));@b@ }@b@@b@ public static double[] removeElement(double[] array, double element)@b@ {@b@ int index = indexOf(array, element);@b@ if (index == -1)@b@ return clone(array);@b@@b@ return remove(array, index);@b@ }@b@@b@ public static float[] remove(float[] array, int index)@b@ {@b@ return ((float[])(float[])remove(array, index));@b@ }@b@@b@ public static float[] removeElement(float[] array, float element)@b@ {@b@ int index = indexOf(array, element);@b@ if (index == -1)@b@ return clone(array);@b@@b@ return remove(array, index);@b@ }@b@@b@ public static int[] remove(int[] array, int index)@b@ {@b@ return ((int[])(int[])remove(array, index));@b@ }@b@@b@ public static int[] removeElement(int[] array, int element)@b@ {@b@ int index = indexOf(array, element);@b@ if (index == -1)@b@ return clone(array);@b@@b@ return remove(array, index);@b@ }@b@@b@ public static long[] remove(long[] array, int index)@b@ {@b@ return ((long[])(long[])remove(array, index));@b@ }@b@@b@ public static long[] removeElement(long[] array, long element)@b@ {@b@ int index = indexOf(array, element);@b@ if (index == -1)@b@ return clone(array);@b@@b@ return remove(array, index);@b@ }@b@@b@ public static short[] remove(short[] array, int index)@b@ {@b@ return ((short[])(short[])remove(array, index));@b@ }@b@@b@ public static short[] removeElement(short[] array, short element)@b@ {@b@ int index = indexOf(array, element);@b@ if (index == -1)@b@ return clone(array);@b@@b@ return remove(array, index);@b@ }@b@@b@ private static Object remove(Object array, int index)@b@ {@b@ int length = getLength(array);@b@ if ((index < 0) || (index >= length)) {@b@ throw new IndexOutOfBoundsException("Index: " + index + ", Length: " + length);@b@ }@b@@b@ Object result = Array.newInstance(array.getClass().getComponentType(), length - 1);@b@ System.arraycopy(array, 0, result, 0, index);@b@ if (index < length - 1) {@b@ System.arraycopy(array, index + 1, result, index, length - index - 1);@b@ }@b@@b@ return result;@b@ }@b@@b@ public static <T> T[] removeAll(T[] array, int[] indices)@b@ {@b@ return ((Object[])(Object[])removeAll(array, clone(indices)));@b@ }@b@@b@ public static <T> T[] removeElements(T[] array, T[] values)@b@ {@b@ Object v;@b@ int found;@b@ int i;@b@ if ((isEmpty(array)) || (isEmpty(values)))@b@ return clone(array);@b@@b@ HashMap occurrences = new HashMap(values.length);@b@ Object[] arr$ = values; int len$ = arr$.length; for (int i$ = 0; i$ < len$; ++i$) { v = arr$[i$];@b@ MutableInt count = (MutableInt)occurrences.get(v);@b@ if (count == null)@b@ occurrences.put(v, new MutableInt(1));@b@ else@b@ count.increment();@b@ }@b@@b@ BitSet toRemove = new BitSet();@b@ for (Map.Entry e : occurrences.entrySet()) {@b@ v = e.getKey();@b@ found = 0;@b@ i = 0; for (int ct = ((MutableInt)e.getValue()).intValue(); i < ct; ++i) {@b@ found = indexOf(array, v, found);@b@ if (found < 0)@b@ break;@b@@b@ toRemove.set(found++);@b@ }@b@@b@ }@b@@b@ Object[] result = (Object[])(Object[])removeAll(array, toRemove);@b@ return result;@b@ }@b@@b@ public static byte[] removeAll(byte[] array, int[] indices)@b@ {@b@ return ((byte[])(byte[])removeAll(array, clone(indices)));@b@ }@b@@b@ public static byte[] removeElements(byte[] array, byte[] values)@b@ {@b@ Byte v;@b@ int found;@b@ int i;@b@ if ((isEmpty(array)) || (isEmpty(values)))@b@ return clone(array);@b@@b@ HashMap occurrences = new HashMap(values.length);@b@ byte[] arr$ = values; int len$ = arr$.length; for (int i$ = 0; i$ < len$; ++i$) { byte v = arr$[i$];@b@ Byte boxed = Byte.valueOf(v);@b@ MutableInt count = (MutableInt)occurrences.get(boxed);@b@ if (count == null)@b@ occurrences.put(boxed, new MutableInt(1));@b@ else@b@ count.increment();@b@ }@b@@b@ BitSet toRemove = new BitSet();@b@ for (Map.Entry e : occurrences.entrySet()) {@b@ v = (Byte)e.getKey();@b@ found = 0;@b@ i = 0; for (int ct = ((MutableInt)e.getValue()).intValue(); i < ct; ++i) {@b@ found = indexOf(array, v.byteValue(), found);@b@ if (found < 0)@b@ break;@b@@b@ toRemove.set(found++);@b@ }@b@ }@b@ return ((byte[])(byte[])removeAll(array, toRemove));@b@ }@b@@b@ public static short[] removeAll(short[] array, int[] indices)@b@ {@b@ return ((short[])(short[])removeAll(array, clone(indices)));@b@ }@b@@b@ public static short[] removeElements(short[] array, short[] values)@b@ {@b@ Short v;@b@ int found;@b@ int i;@b@ if ((isEmpty(array)) || (isEmpty(values)))@b@ return clone(array);@b@@b@ HashMap occurrences = new HashMap(values.length);@b@ short[] arr$ = values; int len$ = arr$.length; for (int i$ = 0; i$ < len$; ++i$) { short v = arr$[i$];@b@ Short boxed = Short.valueOf(v);@b@ MutableInt count = (MutableInt)occurrences.get(boxed);@b@ if (count == null)@b@ occurrences.put(boxed, new MutableInt(1));@b@ else@b@ count.increment();@b@ }@b@@b@ BitSet toRemove = new BitSet();@b@ for (Map.Entry e : occurrences.entrySet()) {@b@ v = (Short)e.getKey();@b@ found = 0;@b@ i = 0; for (int ct = ((MutableInt)e.getValue()).intValue(); i < ct; ++i) {@b@ found = indexOf(array, v.shortValue(), found);@b@ if (found < 0)@b@ break;@b@@b@ toRemove.set(found++);@b@ }@b@ }@b@ return ((short[])(short[])removeAll(array, toRemove));@b@ }@b@@b@ public static int[] removeAll(int[] array, int[] indices)@b@ {@b@ return ((int[])(int[])removeAll(array, clone(indices)));@b@ }@b@@b@ public static int[] removeElements(int[] array, int[] values)@b@ {@b@ Integer v;@b@ int found;@b@ int i;@b@ if ((isEmpty(array)) || (isEmpty(values)))@b@ return clone(array);@b@@b@ HashMap occurrences = new HashMap(values.length);@b@ int[] arr$ = values; int len$ = arr$.length; for (int i$ = 0; i$ < len$; ++i$) { int v = arr$[i$];@b@ Integer boxed = Integer.valueOf(v);@b@ MutableInt count = (MutableInt)occurrences.get(boxed);@b@ if (count == null)@b@ occurrences.put(boxed, new MutableInt(1));@b@ else@b@ count.increment();@b@ }@b@@b@ BitSet toRemove = new BitSet();@b@ for (Map.Entry e : occurrences.entrySet()) {@b@ v = (Integer)e.getKey();@b@ found = 0;@b@ i = 0; for (int ct = ((MutableInt)e.getValue()).intValue(); i < ct; ++i) {@b@ found = indexOf(array, v.intValue(), found);@b@ if (found < 0)@b@ break;@b@@b@ toRemove.set(found++);@b@ }@b@ }@b@ return ((int[])(int[])removeAll(array, toRemove));@b@ }@b@@b@ public static char[] removeAll(char[] array, int[] indices)@b@ {@b@ return ((char[])(char[])removeAll(array, clone(indices)));@b@ }@b@@b@ public static char[] removeElements(char[] array, char[] values)@b@ {@b@ Character v;@b@ int found;@b@ int i;@b@ if ((isEmpty(array)) || (isEmpty(values)))@b@ return clone(array);@b@@b@ HashMap occurrences = new HashMap(values.length);@b@ char[] arr$ = values; int len$ = arr$.length; for (int i$ = 0; i$ < len$; ++i$) { char v = arr$[i$];@b@ Character boxed = Character.valueOf(v);@b@ MutableInt count = (MutableInt)occurrences.get(boxed);@b@ if (count == null)@b@ occurrences.put(boxed, new MutableInt(1));@b@ else@b@ count.increment();@b@ }@b@@b@ BitSet toRemove = new BitSet();@b@ for (Map.Entry e : occurrences.entrySet()) {@b@ v = (Character)e.getKey();@b@ found = 0;@b@ i = 0; for (int ct = ((MutableInt)e.getValue()).intValue(); i < ct; ++i) {@b@ found = indexOf(array, v.charValue(), found);@b@ if (found < 0)@b@ break;@b@@b@ toRemove.set(found++);@b@ }@b@ }@b@ return ((char[])(char[])removeAll(array, toRemove));@b@ }@b@@b@ public static long[] removeAll(long[] array, int[] indices)@b@ {@b@ return ((long[])(long[])removeAll(array, clone(indices)));@b@ }@b@@b@ public static long[] removeElements(long[] array, long[] values)@b@ {@b@ Long v;@b@ int found;@b@ int i;@b@ if ((isEmpty(array)) || (isEmpty(values)))@b@ return clone(array);@b@@b@ HashMap occurrences = new HashMap(values.length);@b@ long[] arr$ = values; int len$ = arr$.length; for (int i$ = 0; i$ < len$; ++i$) { long v = arr$[i$];@b@ Long boxed = Long.valueOf(v);@b@ MutableInt count = (MutableInt)occurrences.get(boxed);@b@ if (count == null)@b@ occurrences.put(boxed, new MutableInt(1));@b@ else@b@ count.increment();@b@ }@b@@b@ BitSet toRemove = new BitSet();@b@ for (Map.Entry e : occurrences.entrySet()) {@b@ v = (Long)e.getKey();@b@ found = 0;@b@ i = 0; for (int ct = ((MutableInt)e.getValue()).intValue(); i < ct; ++i) {@b@ found = indexOf(array, v.longValue(), found);@b@ if (found < 0)@b@ break;@b@@b@ toRemove.set(found++);@b@ }@b@ }@b@ return ((long[])(long[])removeAll(array, toRemove));@b@ }@b@@b@ public static float[] removeAll(float[] array, int[] indices)@b@ {@b@ return ((float[])(float[])removeAll(array, clone(indices)));@b@ }@b@@b@ public static float[] removeElements(float[] array, float[] values)@b@ {@b@ Float v;@b@ int found;@b@ int i;@b@ if ((isEmpty(array)) || (isEmpty(values)))@b@ return clone(array);@b@@b@ HashMap occurrences = new HashMap(values.length);@b@ float[] arr$ = values; int len$ = arr$.length; for (int i$ = 0; i$ < len$; ++i$) { float v = arr$[i$];@b@ Float boxed = Float.valueOf(v);@b@ MutableInt count = (MutableInt)occurrences.get(boxed);@b@ if (count == null)@b@ occurrences.put(boxed, new MutableInt(1));@b@ else@b@ count.increment();@b@ }@b@@b@ BitSet toRemove = new BitSet();@b@ for (Map.Entry e : occurrences.entrySet()) {@b@ v = (Float)e.getKey();@b@ found = 0;@b@ i = 0; for (int ct = ((MutableInt)e.getValue()).intValue(); i < ct; ++i) {@b@ found = indexOf(array, v.floatValue(), found);@b@ if (found < 0)@b@ break;@b@@b@ toRemove.set(found++);@b@ }@b@ }@b@ return ((float[])(float[])removeAll(array, toRemove));@b@ }@b@@b@ public static double[] removeAll(double[] array, int[] indices)@b@ {@b@ return ((double[])(double[])removeAll(array, clone(indices)));@b@ }@b@@b@ public static double[] removeElements(double[] array, double[] values)@b@ {@b@ Double v;@b@ int found;@b@ int i;@b@ if ((isEmpty(array)) || (isEmpty(values)))@b@ return clone(array);@b@@b@ HashMap occurrences = new HashMap(values.length);@b@ double[] arr$ = values; int len$ = arr$.length; for (int i$ = 0; i$ < len$; ++i$) { double v = arr$[i$];@b@ Double boxed = Double.valueOf(v);@b@ MutableInt count = (MutableInt)occurrences.get(boxed);@b@ if (count == null)@b@ occurrences.put(boxed, new MutableInt(1));@b@ else@b@ count.increment();@b@ }@b@@b@ BitSet toRemove = new BitSet();@b@ for (Map.Entry e : occurrences.entrySet()) {@b@ v = (Double)e.getKey();@b@ found = 0;@b@ i = 0; for (int ct = ((MutableInt)e.getValue()).intValue(); i < ct; ++i) {@b@ found = indexOf(array, v.doubleValue(), found);@b@ if (found < 0)@b@ break;@b@@b@ toRemove.set(found++);@b@ }@b@ }@b@ return ((double[])(double[])removeAll(array, toRemove));@b@ }@b@@b@ public static boolean[] removeAll(boolean[] array, int[] indices)@b@ {@b@ return ((boolean[])(boolean[])removeAll(array, clone(indices)));@b@ }@b@@b@ public static boolean[] removeElements(boolean[] array, boolean[] values)@b@ {@b@ Boolean v;@b@ int found;@b@ int i;@b@ if ((isEmpty(array)) || (isEmpty(values)))@b@ return clone(array);@b@@b@ HashMap occurrences = new HashMap(2);@b@ boolean[] arr$ = values; int len$ = arr$.length; for (int i$ = 0; i$ < len$; ++i$) { boolean v = arr$[i$];@b@ Boolean boxed = Boolean.valueOf(v);@b@ MutableInt count = (MutableInt)occurrences.get(boxed);@b@ if (count == null)@b@ occurrences.put(boxed, new MutableInt(1));@b@ else@b@ count.increment();@b@ }@b@@b@ BitSet toRemove = new BitSet();@b@ for (Map.Entry e : occurrences.entrySet()) {@b@ v = (Boolean)e.getKey();@b@ found = 0;@b@ i = 0; for (int ct = ((MutableInt)e.getValue()).intValue(); i < ct; ++i) {@b@ found = indexOf(array, v.booleanValue(), found);@b@ if (found < 0)@b@ break;@b@@b@ toRemove.set(found++);@b@ }@b@ }@b@ return ((boolean[])(boolean[])removeAll(array, toRemove));@b@ }@b@@b@ static Object removeAll(Object array, int[] indices)@b@ {@b@ int length = getLength(array);@b@ int diff = 0;@b@@b@ if (isNotEmpty(indices)) {@b@ Arrays.sort(indices);@b@@b@ int i = indices.length;@b@ int prevIndex = length;@b@ while (true) { int index;@b@ while (true) { if (--i < 0) break label107;@b@ index = indices[i];@b@ if ((index < 0) || (index >= length))@b@ throw new IndexOutOfBoundsException("Index: " + index + ", Length: " + length);@b@@b@ if (index < prevIndex)@b@ break;@b@ }@b@ ++diff;@b@ prevIndex = index;@b@ }@b@ }@b@ label107: Object result = Array.newInstance(array.getClass().getComponentType(), length - diff);@b@ if (diff < length) {@b@ int end = length;@b@ int dest = length - diff;@b@ for (int i = indices.length - 1; i >= 0; --i) {@b@ int index = indices[i];@b@ if (end - index > 1) {@b@ int cp = end - index - 1;@b@ dest -= cp;@b@ System.arraycopy(array, index + 1, result, dest, cp);@b@ }@b@@b@ end = index;@b@ }@b@ if (end > 0)@b@ System.arraycopy(array, 0, result, 0, end);@b@ }@b@@b@ return result;@b@ }@b@@b@ static Object removeAll(Object array, BitSet indices)@b@ {@b@ int srcLength = getLength(array);@b@@b@ int removals = indices.cardinality();@b@ Object result = Array.newInstance(array.getClass().getComponentType(), srcLength - removals);@b@ int srcIndex = 0;@b@ int destIndex = 0;@b@@b@ while ((set = indices.nextSetBit(srcIndex)) != -1) {@b@ int set;@b@ count = set - srcIndex;@b@ if (count > 0) {@b@ System.arraycopy(array, srcIndex, result, destIndex, count);@b@ destIndex += count;@b@ }@b@ srcIndex = indices.nextClearBit(set);@b@ }@b@ int count = srcLength - srcIndex;@b@ if (count > 0)@b@ System.arraycopy(array, srcIndex, result, destIndex, count);@b@@b@ return result;@b@ }@b@}