edu.harvard.seas.iis.util.collections
Class ArrayUtils

java.lang.Object
  extended by edu.harvard.seas.iis.util.collections.ArrayUtils

public class ArrayUtils
extends java.lang.Object

Author:
kgajos

Constructor Summary
ArrayUtils()
           
 
Method Summary
static
<T> T[]
appendArrays(T[] a1, T[] a2)
           
static java.util.ArrayList<java.lang.Double> asArrayList(double[] a)
           
static
<T> java.util.ArrayList<T>
asArrayList(T[] a)
           
static double[] getRandomSubset(double[] source, int subsetSize)
           
static
<T> T[]
intersection(T[] a1, T[] a2)
           
static int search(java.lang.Object[] array, java.lang.Object key)
          Searches the array for the first occurance of key
static double[] toPrimitiveArray(java.lang.Double[] in)
           
static
<T> T[]
union(T[] a1, T[] a2)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayUtils

public ArrayUtils()
Method Detail

search

public static int search(java.lang.Object[] array,
                         java.lang.Object key)
Searches the array for the first occurance of key

Parameters:
array - array to be searched
key - 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> java.util.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 java.util.ArrayList<java.lang.Double> asArrayList(double[] a)

toPrimitiveArray

public static double[] toPrimitiveArray(java.lang.Double[] in)

getRandomSubset

public static double[] getRandomSubset(double[] source,
                                       int subsetSize)