gov.sandia.cognition.collection
Class ArrayUtil

java.lang.Object
  extended by gov.sandia.cognition.collection.ArrayUtil

public class ArrayUtil
extends Object

Utility class for handling arrays.

Since:
3.1
Author:
Justin Basilico

Constructor Summary
ArrayUtil()
           
 
Method Summary
static boolean[] copy(boolean[] array)
          Creates a new copy of the given array.
static double[] copy(double[] array)
          Creates a new copy of the given array.
static int[] copy(int[] array)
          Creates a new copy of the given array.
static long[] copy(long[] array)
          Creates a new copy of the given array.
static
<T> T[]
copy(T[] array)
          Creates a new copy of the given array.
static boolean isEmpty(boolean[] array)
          Determines if the given array is null or empty (length 0).
static boolean isEmpty(double[] array)
          Determines if the given array is null or empty (length 0).
static boolean isEmpty(int[] array)
          Determines if the given array is null or empty (length 0).
static boolean isEmpty(long[] array)
          Determines if the given array is null or empty (length 0).
static boolean isEmpty(Object[] array)
          Determines if the given array is null or empty (length 0).
static void reverse(boolean[] array)
          Reverses the ordering of elements in an array.
static void reverse(double[] array)
          Reverses the ordering of elements in an array.
static void reverse(int[] array)
          Reverses the ordering of elements in an array.
static void reverse(long[] array)
          Reverses the ordering of elements in an array.
static void reverse(Object[] array)
          Reverses the ordering of elements in an array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayUtil

public ArrayUtil()
Method Detail

copy

public static boolean[] copy(boolean[] array)
Creates a new copy of the given array.

Parameters:
array - The array to copy.
Returns:
A copy of the given array.

copy

public static int[] copy(int[] array)
Creates a new copy of the given array.

Parameters:
array - The array to copy.
Returns:
A copy of the given array.

copy

public static long[] copy(long[] array)
Creates a new copy of the given array.

Parameters:
array - The array to copy.
Returns:
A copy of the given array.

copy

public static double[] copy(double[] array)
Creates a new copy of the given array.

Parameters:
array - The array to copy.
Returns:
A copy of the given array.

copy

public static <T> T[] copy(T[] array)
Creates a new copy of the given array. Does not copy the elements.

Type Parameters:
T - The type of data in the array.
Parameters:
array - The array to copy. Does not copy the elements.
Returns:
A copy of the given array.

reverse

public static void reverse(boolean[] array)
Reverses the ordering of elements in an array.

Parameters:
array - The array to reverse the elements in.

reverse

public static void reverse(int[] array)
Reverses the ordering of elements in an array.

Parameters:
array - The array to reverse the elements in.

reverse

public static void reverse(long[] array)
Reverses the ordering of elements in an array.

Parameters:
array - The array to reverse the elements in.

reverse

public static void reverse(double[] array)
Reverses the ordering of elements in an array.

Parameters:
array - The array to reverse the elements in.

reverse

public static void reverse(Object[] array)
Reverses the ordering of elements in an array.

Parameters:
array - The array to reverse the elements in.

isEmpty

public static boolean isEmpty(boolean[] array)
Determines if the given array is null or empty (length 0).

Parameters:
array - The array.
Returns:
True if the array is null or length 0. Otherwise, false.

isEmpty

public static boolean isEmpty(int[] array)
Determines if the given array is null or empty (length 0).

Parameters:
array - The array.
Returns:
True if the array is null or length 0. Otherwise, false.

isEmpty

public static boolean isEmpty(long[] array)
Determines if the given array is null or empty (length 0).

Parameters:
array - The array.
Returns:
True if the array is null or length 0. Otherwise, false.

isEmpty

public static boolean isEmpty(double[] array)
Determines if the given array is null or empty (length 0).

Parameters:
array - The array.
Returns:
True if the array is null or length 0. Otherwise, false.

isEmpty

public static boolean isEmpty(Object[] array)
Determines if the given array is null or empty (length 0).

Parameters:
array - The array.
Returns:
True if the array is null or length 0. Otherwise, false.