Class ArrayUtils


  • public class ArrayUtils
    extends Object
    Utility class for managing arrays
    • Field Detail

      • EMPTY_OBJECT_ARRAY

        public static final Object[] EMPTY_OBJECT_ARRAY
      • EMPTY_STRING_ARRAY

        public static final String[] EMPTY_STRING_ARRAY
    • Constructor Detail

      • ArrayUtils

        protected ArrayUtils()
    • Method Detail

      • concat

        public static Object concat​(Object arr1,
                                    Object arr2)
        Concatenates two arrays into one. If arr1 is null or empty, returns arr2. If arr2 is null or empty, returns arr1. May return null if both arrays are null, or one is empty and the other null.
        The concatenated array has componentType which is compatible with both input arrays (or Object[])
        Parameters:
        arr1 - input array
        arr2 - input array
        Returns:
        Object the concatenated array, elements of arr1 first
      • concat

        public static Object concat​(Object[] arrs)
        Concatenates arrays into one. Any null or empty arrays are ignored. If all arrays are null or empty, returns null. Elements will be ordered in the order in which the arrays are supplied.
        Parameters:
        arrs - array of arrays
        Returns:
        the concatenated array
      • concatSameType

        public static Object concatSameType​(Object toArray,
                                            Object[] arrs)
      • contains

        public static boolean contains​(Object[] array,
                                       Object value)