Class Absent<T>

java.lang.Object
org.dmfs.jems2.optional.Absent<T>
All Implemented Interfaces:
Optional<T>

public final class Absent<T> extends Object implements Optional<T>
An Optional value that's never present.
  • Constructor Details

    • Absent

      public Absent()
  • Method Details

    • absent

      public static <T> Absent<T> absent()
      Returns an Absent value.
      Type Parameters:
      T - The type of the absent value.
      Returns:
      An Absent of the given type.
    • isPresent

      public boolean isPresent()
      Description copied from interface: Optional
      Returns whether the optional value is present.
      Specified by:
      isPresent in interface Optional<T>
    • value

      public T value() throws NoSuchElementException
      Description copied from interface: Optional
      Returns the optional value.
      Specified by:
      value in interface Optional<T>
      Throws:
      NoSuchElementException - if the optional value is not present.