edu.harvard.seas.iis.util.collections
Class ArrayUtils
java.lang.Object
edu.harvard.seas.iis.util.collections.ArrayUtils
public class ArrayUtils
- extends Object
- Author:
- kgajos
ArrayUtils
public ArrayUtils()
search
public static int search(Object[] array,
Object key)
- Searches the array for the first occurance of key
- Parameters:
array
- array to be searchedkey
- object to be found
- Returns:
- index of the first occurance of the object in the array or -1 if
not found
appendArrays
public static <T> T[] appendArrays(T[] a1,
T[] a2)
asArrayList
public static <T> ArrayList<T> asArrayList(T[] a)
union
public static <T> T[] union(T[] a1,
T[] a2)
intersection
public static <T> T[] intersection(T[] a1,
T[] a2)
asArrayList
public static ArrayList<Double> asArrayList(double[] a)
toPrimitiveArray
public static double[] toPrimitiveArray(Double[] in)
getRandomSubset
public static double[] getRandomSubset(double[] source,
int subsetSize)