Class ArrayHelper
java.lang.Object
org.hibernate.internal.util.collections.ArrayHelper
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T[]add(T[] x, T y) 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 <T> booleancontains(T[] array, T object) static <T> booleancontainsAll(T[] array, T[] elements) 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[]static LockMode[]static LockOptions[]fillArray(LockOptions lockOptions, int length) static <T> T[]filledArray(T value, Class<T> valueJavaType, int size) static <T> voidstatic 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 intcalculate the array hash (only the first level)static intstatic intstatic booleanisAllFalse(boolean... array) static booleanisAllNegative(int[] array) static booleanisAllTrue(boolean... array) static booleanisAnyTrue(boolean... values) static booleanstatic int[]join(int[] x, int[] y) static String[]static String[]static <T> T[]join(T[] x, T... y) static boolean[]negate(boolean[] valueNullness) static <T> T[]newInstance(Class<T> elementType, int length) Deprecated.static String[]Reverse the elements of the incoming arraystatic String[][]reverseFirst(String[][] objects, int n) Reverse the first n elements of the incoming arraystatic String[]reverseFirst(String[] objects, int n) Reverse the first n elements of the incoming arraystatic <T> intsize(T[] array) static Object[]static String[]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> static Object[]toObjectArray(Object array) static Object[]toObjectArray(Collection<Object> coll) static Stringstatic 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[]
-
Field Details
-
TRUE
public static final boolean[] TRUE -
FALSE
public static final boolean[] FALSE -
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
-
EMPTY_OBJECT_ARRAY
-
EMPTY_TYPE_ARRAY
-
EMPTY_BYTE_ARRAY
public static final byte[] EMPTY_BYTE_ARRAY
-
-
Method Details
-
contains
public static <T> boolean contains(T[] array, T object) -
containsAll
public static <T> boolean containsAll(T[] array, T[] elements) -
contains
public static boolean contains(int[] array, int value) -
indexOf
-
indexOf
-
filledArray
-
toStringArray
-
fillArray
-
fillArray
public static int[] fillArray(int value, int length) -
fillArray
-
fillArray
-
toStringArray
-
toObjectArray
-
to2DStringArray
-
to2DIntArray
-
toTypeArray
-
toIntArray
-
toBooleanArray
-
typecast
-
slice
-
slice
-
toList
-
join
-
join
-
join
public static int[] join(int[] x, int[] y) -
join
public static <T> T[] join(T[] x, T... y) -
add
public static <T> T[] add(T[] x, T y) -
toString
-
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
-
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
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
-
countNonNull
-
countNonNull
-
reverse
Reverse the elements of the incoming array- Returns:
- New array with all elements in reversed order
-
reverseFirst
Reverse the first n elements of the incoming array- Returns:
- New array with the first n elements in reversed order
-
reverseFirst
Reverse the first n elements of the incoming array- Returns:
- New array with the first n elements in reversed order
-
trim
public static int[] trim(int[] from, int length) -
toObjectArray
-
toExpandableList
-
isEmpty
-
forEach
-
newInstance
Deprecated.UseArray.newInstance(Class, int)instead. -
size
public static <T> int size(T[] array)
-
Array.newInstance(Class, int)instead.