Class Optionals

java.lang.Object
io.github.torand.javacommons.functional.Optionals

public final class Optionals extends Object
General purpose utilities for optionals.
  • Method Details

    • mapSafely

      public static <T, U> U mapSafely(T value, Function<T,U> mapper)
      Executes the specified mapping function on the value if it is not null. Returns null if it is.
      Type Parameters:
      T - the type to map from.
      U - the type to map to.
      Parameters:
      value - the value to map.
      mapper - the mapper function.
      Returns:
      the mapped value if not null.