Class Lib

java.lang.Object
org.apache.jena.atlas.lib.Lib

public class Lib extends Object
  • Method Details

    • concatPaths

      public static String concatPaths(String directory, String path)
      Concatenate two "/" delimited path names.
      • If path (second argument) starts with "/", it is assumed to be absolute and path is returned.
      • If path (second argument) is "", return the directory.
      • Otherwise the arguments are concatenated ensuring there is a "/" between them.
    • toList

      public static <X> List<X> toList(Stream<X> stream)
      Stream to List
    • concurrentHashSet

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

      public static final void sync(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(String str1, 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 String className(Object obj)
      Safely return the class short name for an object -- obj.getClass().getSimpleName()
    • classShortName

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

      public static UnsupportedOperationException unsupportedMethod(Object object, String method)
      Create UnsupportedOperationException with formatted message.
    • runtimeException

      public static RuntimeException runtimeException(Exception ex)
      Return a RuntimeException. If the argument is already RuntimeException, return the argument. Otherwise, wrap in RuntimeException, with the same message, and return the RuntimeException
    • equalsListAsSet

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

      public static final int hashCodeObject(Object obj)
      HashCode - allow nulls
    • hashCodeObject

      public static final int hashCodeObject(Object obj, int nullHashCode)
      HashCode - allow nulls
    • isEmpty

      public static boolean isEmpty(CharSequence cs)
    • lowercase

      public static String lowercase(String string)
      Non-locale lowercase Locale.ROOT
    • uppercase

      public static String uppercase(String string)
      Non-locale uppercase Locale.ROOT
    • sleep

      public static final void sleep(int milliSeconds)
    • getenv

      public static String getenv(String name)
      Get an environment variable value; if not found try in the system properties.
    • getenv

      public static String getenv(String sysPropName, String envName)
      Get system properties (argument sysPropName) or if not found, read an environment variable value (argument envName).
    • isPropertyOrEnvVarSetToTrue

      public static boolean isPropertyOrEnvVarSetToTrue(String name)
      Test whether a property (environment variable or system property) is true.
    • isPropertyOrEnvVarSetToTrue

      public static boolean isPropertyOrEnvVarSetToTrue(String sysPropName, String envName)
      Test whether a property (argument sysPropName) or an environment variable (argument envName) is true.
    • readThreadLocal

      public static <X> X readThreadLocal(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:
    • adler32

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

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

      public static <X> Set<Set<X>> powerSet(Set<X> elts)
      PowerSet