Class Present<T>

  • All Implemented Interfaces:
    Optional<T>

    public final class Present<T>
    extends java.lang.Object
    implements Optional<T>
    A special Optional that's always present. As a consequence this doesn't take null values.
    • Constructor Summary

      Constructors 
      Constructor Description
      Present​(T value)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isPresent()
      Returns whether the optional value is present.
      T value()
      Returns the optional value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Present

        public Present​(T value)
    • Method Detail

      • 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()
        Description copied from interface: Optional
        Returns the optional value.
        Specified by:
        value in interface Optional<T>