a_vcard.com.android.internal.util
Class ArrayUtils

java.lang.Object
  extended by a_vcard.com.android.internal.util.ArrayUtils

public class ArrayUtils
extends java.lang.Object

ArrayUtils contains some methods that you can call to find out the most efficient increments by which to grow arrays.


Method Summary
static
<T> boolean
contains(T[] array, T value)
          Checks that value is present as at least one of the elements of the array.
static
<T> T[]
emptyArray(java.lang.Class<T> kind)
          Returns an empty array of the specified type.
static boolean equals(byte[] array1, byte[] array2, int length)
          Checks if the beginnings of two byte arrays are equal.
static int idealBooleanArraySize(int need)
           
static int idealByteArraySize(int need)
           
static int idealCharArraySize(int need)
           
static int idealFloatArraySize(int need)
           
static int idealIntArraySize(int need)
           
static int idealLongArraySize(int need)
           
static int idealObjectArraySize(int need)
           
static int idealShortArraySize(int need)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

idealByteArraySize

public static int idealByteArraySize(int need)

idealBooleanArraySize

public static int idealBooleanArraySize(int need)

idealShortArraySize

public static int idealShortArraySize(int need)

idealCharArraySize

public static int idealCharArraySize(int need)

idealIntArraySize

public static int idealIntArraySize(int need)

idealFloatArraySize

public static int idealFloatArraySize(int need)

idealObjectArraySize

public static int idealObjectArraySize(int need)

idealLongArraySize

public static int idealLongArraySize(int need)

equals

public static boolean equals(byte[] array1,
                             byte[] array2,
                             int length)
Checks if the beginnings of two byte arrays are equal.

Parameters:
array1 - the first byte array
array2 - the second byte array
length - the number of bytes to check
Returns:
true if they're equal, false otherwise

emptyArray

public static <T> T[] emptyArray(java.lang.Class<T> kind)
Returns an empty array of the specified type. The intent is that it will return the same empty array every time to avoid reallocation, although this is not guaranteed.


contains

public static <T> boolean contains(T[] array,
                                   T value)
Checks that value is present as at least one of the elements of the array.

Parameters:
array - the array to check in
value - the value to check for
Returns:
true if the value is present in the array