Class ArrayUtil


  • public class ArrayUtil
    extends java.lang.Object
    Provides hashCode, equals and toString methods that can handle array.
    • Constructor Summary

      Constructors 
      Constructor Description
      ArrayUtil()  
    • Method Summary

      Modifier and Type Method Description
      static boolean equals​(java.lang.Object thisObj, java.lang.Object thatObj)
      Compares two objects.
      static int hashCode​(java.lang.Object obj)
      Returns a hash code for obj.
      static java.lang.String toString​(java.lang.Object obj)
      If the obj is an array, toString() method of Arrays is called.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ArrayUtil

        public ArrayUtil()
    • Method Detail

      • hashCode

        public static int hashCode​(java.lang.Object obj)
        Returns a hash code for obj.
        Parameters:
        obj - The object to get a hash code for. May be an array or null.
        Returns:
        A hash code of obj or 0 if obj is null
      • equals

        public static boolean equals​(java.lang.Object thisObj,
                                     java.lang.Object thatObj)
        Compares two objects. Returns true if
        • thisObj and thatObj are both null
        • thisObj and thatObj are instances of the same type and Object.equals(Object) returns true
        • thisObj and thatObj are arrays with the same component type and equals() method of Arrays returns true (not deepEquals())
        Parameters:
        thisObj - The left hand object to compare. May be an array or null
        thatObj - The right hand object to compare. May be an array or null
        Returns:
        true if two objects are equal; false otherwise.
      • toString

        public static java.lang.String toString​(java.lang.Object obj)
        If the obj is an array, toString() method of Arrays is called. Otherwise Object.toString() is called. Returns "null" if obj is null.
        Parameters:
        obj - An object. May be an array or null.
        Returns:
        String representation of the obj.