Class OptionalUtils

java.lang.Object
org.mapfish.print.OptionalUtils

public final class OptionalUtils extends Object
Utilities for Java's Optional class.
  • Method Details

    • or

      public static <T> Optional<T> or(Optional<T> a, Optional<? extends T> b)
      Return the first optional to be defined.
      Type Parameters:
      T - The type
      Parameters:
      a - The first
      b - The second
      Returns:
      a or b or empty
    • or

      @SafeVarargs public static <T> Optional<T> or(Supplier<Optional<? extends T>>... optionals)
      Return the first optional to be defined.
      Type Parameters:
      T - The type
      Parameters:
      optionals - the lambdas returning the optionals
      Returns:
      the first non-empty or empty