Class ArrayHelper


  • public final class ArrayHelper
    extends Object
    • 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​(Object[] array,
                                       Object object)
      • contains

        public static boolean contains​(int[] array,
                                       int value)
      • indexOf

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

        public static int indexOf​(Object[] array,
                                  int end,
                                  Object object)
      • filledArray

        public static <T> T[] filledArray​(T value,
                                          Class<T> valueJavaType,
                                          int size)
      • toStringArray

        public static String[] toStringArray​(Object[] objects)
      • 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)
      • to2DIntArray

        public static int[][] to2DIntArray​(Collection<int[]> coll)
      • toBooleanArray

        public static boolean[] toBooleanArray​(Collection<Boolean> coll)
      • slice

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

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

        public static <T> List<T> toList​(Iterator<T> iter)
      • join

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

        public static <T> T[] join​(T[] x,
                                   T... y)
      • toString

        public static String toString​(Object[] array)
      • 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 the mappedBatchSize.
        Parameters:
        mappedBatchSize - The batch-size. Internally this is capped at 256
        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)
      • countNonNull

        public static int countNonNull​(Serializable[] array)
      • countNonNull

        public static int countNonNull​(Object[] array)
      • reverse

        public static String[] reverse​(String[] source)
      • trim

        public static int[] trim​(int[] from,
                                 int length)
      • toObjectArray

        public static Object[] toObjectArray​(Object array)
      • 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)