Class ArrayHelper
- java.lang.Object
-
- org.hibernate.internal.util.collections.ArrayHelper
-
public final class ArrayHelper extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static boolean[]EMPTY_BOOLEAN_ARRAYstatic byte[]EMPTY_BYTE_ARRAYstatic Class[]EMPTY_CLASS_ARRAYstatic int[]EMPTY_INT_ARRAYstatic Object[]EMPTY_OBJECT_ARRAYstatic String[]EMPTY_STRING_ARRAYstatic Type[]EMPTY_TYPE_ARRAYstatic boolean[]FALSEstatic boolean[]TRUE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> voidaddAll(Collection<T> collection, T[] array)static int[]calculateBatchPartitions(int mappedBatchSize)Calculate the batch partitions needed to handle themappedBatchSize.static booleancontains(int[] array, int value)static booleancontains(Object[] array, Object object)static intcountNonNull(Serializable[] array)static intcountNonNull(Object[] array)static intcountTrue(boolean... array)static Serializable[]extractNonNull(Serializable[] array)static int[]fillArray(int value, int length)static String[]fillArray(String value, int length)static LockMode[]fillArray(LockMode lockMode, int length)static LockOptions[]fillArray(LockOptions lockOptions, int length)static <T> T[]filledArray(T value, Class<T> valueJavaType, int size)static <T> voidforEach(T[] array, Consumer<T> consumer)static int[]getBatchSizes(int maxBatchSize)static inthash(byte[] bytes)calculate the array hash (only the first level)static inthash(char[] array)calculate the array hash (only the first level)static inthash(Object[] array)calculate the array hash (only the first level)static intindexOf(Object[] array, int end, Object object)static intindexOf(Object[] array, Object object)static booleanisAllFalse(boolean... array)static booleanisAllNegative(int[] array)static booleanisAllTrue(boolean... array)static booleanisAnyTrue(boolean... values)static booleanisEmpty(Object[] array)static int[]join(int[] x, int[] y)static String[]join(String[] x, String[] y)static String[]join(String[] x, String[] y, boolean[] use)static <T> T[]join(T[] x, T... y)static boolean[]negate(boolean[] valueNullness)static <T> T[]newInstance(Class<T> elementType, int length)static String[]reverse(String[] source)static Object[]slice(Object[] objects, int begin, int length)static String[]slice(String[] strings, int begin, int length)static int[][]to2DIntArray(Collection<int[]> coll)static String[][]to2DStringArray(Collection<String[]> coll)static boolean[]toBooleanArray(Collection<Boolean> coll)static <T> List<T>toExpandableList(T[] values)static int[]toIntArray(Collection<Integer> coll)static <T> List<T>toList(Iterator<T> iter)static Object[]toObjectArray(Object array)static Object[]toObjectArray(Collection<Object> coll)static StringtoString(Object[] array)static String[]toStringArray(Object[] objects)static String[]toStringArray(Collection<String> coll)static Type[]toTypeArray(Collection<Type> coll)static int[]trim(int[] from, int length)static Object[]typecast(Object[] array, Object[] to)
-
-
-
Field Detail
-
TRUE
public static final boolean[] TRUE
-
FALSE
public static final boolean[] FALSE
-
EMPTY_STRING_ARRAY
public static final String[] EMPTY_STRING_ARRAY
-
EMPTY_INT_ARRAY
public static final int[] EMPTY_INT_ARRAY
-
EMPTY_BOOLEAN_ARRAY
public static final boolean[] EMPTY_BOOLEAN_ARRAY
-
EMPTY_CLASS_ARRAY
public static final Class[] EMPTY_CLASS_ARRAY
-
EMPTY_OBJECT_ARRAY
public static final Object[] EMPTY_OBJECT_ARRAY
-
EMPTY_TYPE_ARRAY
public static final Type[] EMPTY_TYPE_ARRAY
-
EMPTY_BYTE_ARRAY
public static final byte[] EMPTY_BYTE_ARRAY
-
-
Method Detail
-
contains
public static boolean contains(int[] array, int value)
-
filledArray
public static <T> T[] filledArray(T value, Class<T> valueJavaType, int size)
-
fillArray
public static int[] fillArray(int value, int length)
-
fillArray
public static LockOptions[] fillArray(LockOptions lockOptions, int length)
-
toStringArray
public static String[] toStringArray(Collection<String> coll)
-
toObjectArray
public static Object[] toObjectArray(Collection<Object> coll)
-
to2DStringArray
public static String[][] to2DStringArray(Collection<String[]> coll)
-
to2DIntArray
public static int[][] to2DIntArray(Collection<int[]> coll)
-
toTypeArray
public static Type[] toTypeArray(Collection<Type> coll)
-
toIntArray
public static int[] toIntArray(Collection<Integer> coll)
-
toBooleanArray
public static boolean[] toBooleanArray(Collection<Boolean> coll)
-
join
public static int[] join(int[] x, int[] y)
-
join
public static <T> T[] join(T[] x, T... y)
-
isAllNegative
public static boolean isAllNegative(int[] array)
-
isAllTrue
public static boolean isAllTrue(boolean... array)
-
countTrue
public static int countTrue(boolean... array)
-
isAllFalse
public static boolean isAllFalse(boolean... array)
-
isAnyTrue
public static boolean isAnyTrue(boolean... values)
-
negate
public static boolean[] negate(boolean[] valueNullness)
-
addAll
public static <T> void addAll(Collection<T> collection, T[] array)
-
calculateBatchPartitions
public static int[] calculateBatchPartitions(int mappedBatchSize)
Calculate the batch partitions needed to handle themappedBatchSize.- Parameters:
mappedBatchSize- Thebatch-size. Internally this is capped at256- Returns:
- The upper bound for the partitions
- Implementation Note:
- The max batch size is capped at
256
-
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(char[] array)
calculate the array hash (only the first level)
-
hash
public static int hash(byte[] bytes)
calculate the array hash (only the first level)
-
extractNonNull
public static Serializable[] extractNonNull(Serializable[] array)
-
countNonNull
public static int countNonNull(Serializable[] array)
-
countNonNull
public static int countNonNull(Object[] array)
-
trim
public static int[] trim(int[] from, int length)
-
toExpandableList
public static <T> List<T> toExpandableList(T[] values)
-
isEmpty
public static boolean isEmpty(Object[] array)
-
forEach
public static <T> void forEach(T[] array, Consumer<T> consumer)
-
newInstance
public static <T> T[] newInstance(Class<T> elementType, int length)
-
-