Class ArrayUtils


  • public final class ArrayUtils
    extends Object
    Static utility methods for dealing with arrays.
    • Method Detail

      • isPrimitiveArray

        public static boolean isPrimitiveArray​(Object o)
        Check if the given object is a primitive array.
        Parameters:
        o - to check.
        Returns:
        true iff o is a primitive array.
      • isPrimitiveOrStringArray

        public static boolean isPrimitiveOrStringArray​(Object o)
        Check if the given object is a primitive array or an array of Strings.
        Parameters:
        o - to check.
        Returns:
        true iff o is a primitive array or an array of Strings.
      • isArray

        public static boolean isArray​(Object o)
        Check if the given object is an array.
        Parameters:
        o - to check.
        Returns:
        true iff o is an array.
      • arrayFriendlyEquals

        public static boolean arrayFriendlyEquals​(Object o1,
                                                  Object o2)
        Check whether two objects, potentially arrays, are equal.
        Parameters:
        o1 - object 1
        o2 - object 2
        Returns:
        true iff o1 and o2 are equal.
      • arrayFriendlyHashCode

        public static int arrayFriendlyHashCode​(Object o)
        Get has code of the object, which could be an arrays. Hash codes of arrays that are equal according to arrayFriendlyEquals(Object, Object) are the same.
        Parameters:
        o - to get a hash code for.
        Returns:
        hash code.
      • primitiveOrStringArrayToString

        public static String primitiveOrStringArrayToString​(Object o)
        Convert a primitive array or an array of Strings to string.
        Parameters:
        o - to convert.
        Returns:
        as string.
        Throws:
        IllegalArgumentException - if o isn't a primitive array or an array of Strings.
      • arrayFriendlyMapEquals

        public static <T> boolean arrayFriendlyMapEquals​(Map<String,​T> map1,
                                                         Map<String,​T> map2)
        Check equality of both maps that can have arrays as values.
        Parameters:
        map1 -
        map2 -
        Returns:
        true iff the maps are equal.