Class Lib


  • public class Lib
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static long adler32​(byte[] bytes)
      Faster than CRC32, nearly as good.
      static java.lang.String className​(java.lang.Object obj)
      Safely return the class short name for an object -- obj.getClass().getSimpleName()
      static java.lang.String classShortName​(java.lang.Class<?> cls)
      Safely return the class short name for a class
      static <X> java.util.Set<X> concurrentHashSet()
      "ConcurrentHashSet"
      static long crc32​(byte[] bytes)  
      static <T> boolean equals​(T obj1, T obj2)
      Return true if obj1 and obj are both null or are .equals, else return false Prefer Objects.equals(Object, Object)
      static boolean equalsIgnoreCase​(java.lang.String str1, java.lang.String str2)
      Return true if obj1 and obj are both null or are .equals, else return false
      static <T> boolean equalsListAsSet​(java.util.List<T> list1, java.util.List<T> list2)
      Do two lists have the same elements without considering the order of the lists?
      static int hashCodeObject​(java.lang.Object obj)
      HashCode - allow nulls
      static int hashCodeObject​(java.lang.Object obj, int nullHashCode)
      HashCode - allow nulls
      static java.lang.String murmurHashHex​(java.lang.String string)
      Calculate the Murmur3 hash of a string, and return it as a hex-encoded string.
      static <T> boolean notEqual​(T obj1, T obj2)
      Return true if obj1 and obj are not equal
      static <X> X readThreadLocal​(java.lang.ThreadLocal<X> threadLocal)
      Read thread local, assuming that "null" means it does not exist for this thread.
      static void sleep​(int milliSeconds)  
      static void sync​(java.lang.Object object)  
      static java.lang.UnsupportedOperationException unsupportedMethod​(java.lang.Object object, java.lang.String method)
      Create UnsupportedOperationException with formatted message.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • concurrentHashSet

        public static final <X> java.util.Set<X> concurrentHashSet()
        "ConcurrentHashSet"
      • sync

        public static final void sync​(java.lang.Object object)
      • equals

        public static final <T> boolean equals​(T obj1,
                                               T obj2)
        Return true if obj1 and obj are both null or are .equals, else return false Prefer Objects.equals(Object, Object)
      • equalsIgnoreCase

        public static final boolean equalsIgnoreCase​(java.lang.String str1,
                                                     java.lang.String str2)
        Return true if obj1 and obj are both null or are .equals, else return false
      • notEqual

        public static final <T> boolean notEqual​(T obj1,
                                                 T obj2)
        Return true if obj1 and obj are not equal
      • className

        public static final java.lang.String className​(java.lang.Object obj)
        Safely return the class short name for an object -- obj.getClass().getSimpleName()
      • classShortName

        public static final java.lang.String classShortName​(java.lang.Class<?> cls)
        Safely return the class short name for a class
      • unsupportedMethod

        public static java.lang.UnsupportedOperationException unsupportedMethod​(java.lang.Object object,
                                                                                java.lang.String method)
        Create UnsupportedOperationException with formatted message.
      • equalsListAsSet

        public static <T> boolean equalsListAsSet​(java.util.List<T> list1,
                                                  java.util.List<T> list2)
        Do two lists have the same elements without considering the order of the lists?
      • hashCodeObject

        public static final int hashCodeObject​(java.lang.Object obj)
        HashCode - allow nulls
      • hashCodeObject

        public static final int hashCodeObject​(java.lang.Object obj,
                                               int nullHashCode)
        HashCode - allow nulls
      • sleep

        public static final void sleep​(int milliSeconds)
      • readThreadLocal

        public static <X> X readThreadLocal​(java.lang.ThreadLocal<X> threadLocal)
        Read thread local, assuming that "null" means it does not exist for this thread. If null is read, the thread local is removed.
      • crc32

        public static long crc32​(byte[] bytes)
        See Also:
        CRC32
      • adler32

        public static long adler32​(byte[] bytes)
        Faster than CRC32, nearly as good.
        See Also:
        Adler32
      • murmurHashHex

        public static java.lang.String murmurHashHex​(java.lang.String string)
        Calculate the Murmur3 hash of a string, and return it as a hex-encoded string.