Class LangUtils


  • public final class LangUtils
    extends java.lang.Object
    A set of utility methods to help produce consistent equals and hashCode methods.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int HASH_OFFSET  
      static int HASH_SEED  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private LangUtils()
      Disabled default constructor.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean equals​(java.lang.Object obj1, java.lang.Object obj2)
      Check if two objects are equal.
      static boolean equalsIgnoreCase​(java.lang.String s1, java.lang.String s2)
      Check if two strings are equal, ignoring case considerations.
      static int hashCode​(int seed, boolean b)  
      static int hashCode​(int seed, int hashcode)  
      static int hashCode​(int seed, java.lang.Object obj)  
      • Methods inherited from class java.lang.Object

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

      • LangUtils

        private LangUtils()
        Disabled default constructor.
    • Method Detail

      • hashCode

        public static int hashCode​(int seed,
                                   int hashcode)
      • hashCode

        public static int hashCode​(int seed,
                                   boolean b)
      • hashCode

        public static int hashCode​(int seed,
                                   java.lang.Object obj)
      • equals

        public static boolean equals​(java.lang.Object obj1,
                                     java.lang.Object obj2)
        Check if two objects are equal.
        Parameters:
        obj1 - first object to compare, may be null
        obj2 - second object to compare, may be null
        Returns:
        true if the objects are equal or both null
      • equalsIgnoreCase

        public static boolean equalsIgnoreCase​(java.lang.String s1,
                                               java.lang.String s2)
        Check if two strings are equal, ignoring case considerations.
        Parameters:
        s1 - first string to compare, may be null
        s2 - second string to compare, may be null
        Returns:
        true if the objects are equal or both null