org.jtheque.utils.collections
Class ArrayUtils

java.lang.Object
  extended by org.jtheque.utils.collections.ArrayUtils

public final class ArrayUtils
extends Object

This class provide utility methods to the use of arrays.

Author:
Baptiste Wicht

Field Summary
static Object[] ZERO_LENGTH_ARRAY
           
 
Method Summary
static
<T> T[]
copyOf(T[] array)
          Return a copy of the array.
static int indexOf(Object object, Object[] tab)
          Return the index of the object on the tab.
static boolean isEmpty(Object[] array)
          Test if the array is empty or contains only null values.
static void reverse(int[] array)
          Reverse the array.
static void reverse(Object[] array)
          Inverse the order of the array and return it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZERO_LENGTH_ARRAY

public static final Object[] ZERO_LENGTH_ARRAY
Method Detail

reverse

public static void reverse(Object[] array)
Inverse the order of the array and return it.

Parameters:
array - The array to inverse.

indexOf

public static int indexOf(Object object,
                          Object[] tab)
Return the index of the object on the tab.

Parameters:
object - The object to search for.
tab - The tab to search in.
Returns:
The index of the objet in the tab else -1 if the object is not present in the tab.

reverse

public static void reverse(int[] array)
Reverse the array.

Parameters:
array - The array to reverse.

isEmpty

public static boolean isEmpty(Object[] array)
Test if the array is empty or contains only null values.

Parameters:
array - The array to test.
Returns:
true if the array size is 0 or if the array contains only null values.

copyOf

public static <T> T[] copyOf(T[] array)
Return a copy of the array.

Type Parameters:
T - The type of objects.
Parameters:
array - The array to copy.
Returns:
The copy of the array.


Copyright © 2010 JTheque. All Rights Reserved.