org.hibernate.util

Class ArrayHelper


public final class ArrayHelper
extends java.lang.Object

Field Summary

static boolean[]
EMPTY_BOOLEAN_ARRAY
static Class[]
EMPTY_CLASS_ARRAY
static int[]
EMPTY_INT_ARRAY
static Object[]
EMPTY_OBJECT_ARRAY
static String[]
EMPTY_STRING_ARRAY
static Type[]
EMPTY_TYPE_ARRAY
static boolean[]
FALSE
static boolean[]
TRUE

Method Summary

static void
addAll(Collection collection, Object[] array)
static int
countTrue(boolean[] array)
static String[]
fillArray(String value, int length)
static int[]
fillArray(int value, int length)
static LockMode[]
fillArray(LockMode lockMode, int length)
static int[]
getBatchSizes(int maxBatchSize)
static int
hash(Object[] array)
calculate the array hash (only the first level)
static int
hash(byte[] bytes)
calculate the array hash (only the first level)
static int
hash(char[] array)
calculate the array hash (only the first level)
static int
indexOf(Object[] array, Object object)
static boolean
isAllFalse(boolean[] array)
static boolean
isAllNegative(int[] array)
static boolean
isAllTrue(boolean[] array)
static boolean
isEquals(Object[] o1, Object[] o2)
Compare 2 arrays only at the first level
static boolean
isEquals(byte[] b1, byte[] b2)
Compare 2 arrays only at the first level
static boolean
isEquals(char[] o1, char[] o2)
Compare 2 arrays only at the first level
static String[]
join(String[] x, String[] y)
static String[]
join(String[] x, String[] y, boolean[] use)
static int[]
join(int[] x, int[] y)
static Object[]
slice(Object[] objects, int begin, int length)
static String[]
slice(String[] strings, int begin, int length)
static int[][]
to2DIntArray(Collection coll)
static String[][]
to2DStringArray(Collection coll)
static boolean[]
toBooleanArray(Collection coll)
static int[]
toIntArray(Collection coll)
static List
toList(Iterator iter)
static List
toList(Object array)
static String
toString(Object[] array)
static String[]
toStringArray(Collection coll)
static String[]
toStringArray(Object[] objects)
static Type[]
toTypeArray(Collection coll)
static Object[]
typecast(Object[] array, Object[] to)

Field Details

EMPTY_BOOLEAN_ARRAY

public static final boolean[] EMPTY_BOOLEAN_ARRAY

EMPTY_CLASS_ARRAY

public static final Class[] EMPTY_CLASS_ARRAY

EMPTY_INT_ARRAY

public static final int[] EMPTY_INT_ARRAY

EMPTY_OBJECT_ARRAY

public static final Object[] EMPTY_OBJECT_ARRAY

EMPTY_STRING_ARRAY

public static final String[] EMPTY_STRING_ARRAY

EMPTY_TYPE_ARRAY

public static final Type[] EMPTY_TYPE_ARRAY

FALSE

public static final boolean[] FALSE

TRUE

public static final boolean[] TRUE

Method Details

addAll

public static void addAll(Collection collection,
                          Object[] array)

countTrue

public static int countTrue(boolean[] array)

fillArray

public static String[] fillArray(String value,
                                 int length)

fillArray

public static int[] fillArray(int value,
                              int length)

fillArray

public static LockMode[] fillArray(LockMode lockMode,
                                   int length)

getBatchSizes

public static int[] getBatchSizes(int maxBatchSize)

hash

public static int hash(Object[] array)
calculate the array hash (only the first level)

hash

public static int hash(byte[] bytes)
calculate the array hash (only the first level)

hash

public static int hash(char[] array)
calculate the array hash (only the first level)

indexOf

public static int indexOf(Object[] array,
                          Object object)

isAllFalse

public static boolean isAllFalse(boolean[] array)

isAllNegative

public static boolean isAllNegative(int[] array)

isAllTrue

public static boolean isAllTrue(boolean[] array)

isEquals

public static boolean isEquals(Object[] o1,
                               Object[] o2)
Compare 2 arrays only at the first level

isEquals

public static boolean isEquals(byte[] b1,
                               byte[] b2)
Compare 2 arrays only at the first level

isEquals

public static boolean isEquals(char[] o1,
                               char[] o2)
Compare 2 arrays only at the first level

join

public static String[] join(String[] x,
                            String[] y)

join

public static String[] join(String[] x,
                            String[] y,
                            boolean[] use)

join

public static int[] join(int[] x,
                         int[] y)

slice

public static Object[] slice(Object[] objects,
                             int begin,
                             int length)

slice

public static String[] slice(String[] strings,
                             int begin,
                             int length)

to2DIntArray

public static int[][] to2DIntArray(Collection coll)

to2DStringArray

public static String[][] to2DStringArray(Collection coll)

toBooleanArray

public static boolean[] toBooleanArray(Collection coll)

toIntArray

public static int[] toIntArray(Collection coll)

toList

public static List toList(Iterator iter)

toList

public static List toList(Object array)

toString

public static String toString(Object[] array)

toStringArray

public static String[] toStringArray(Collection coll)

toStringArray

public static String[] toStringArray(Object[] objects)

toTypeArray

public static Type[] toTypeArray(Collection coll)

typecast

public static Object[] typecast(Object[] array,
                                Object[] to)