Class Objects

java.lang.Object
eu.bandm.tools.util.java.Objects

public class Objects extends Object
Library of constants and operations for working with object references.
See Also:
  • Method Details

    • ifNullElse

      public static <D, E> E ifNullElse(@Opt D input, Supplier<E> nullCase, Function<D,E> notNull)
      Computes a value from an argument depending on whether it is null.
      Type Parameters:
      D - the type of the argument
      E - the type of the result
      Parameters:
      input - the argument, maybe null
      nullCase - a function to compute the result if the argument is null
      notNull - a function to compute the result if the argument is non-null
      Returns:
      the result computed either way