Class Option.None<T>

java.lang.Object
io.vavr.control.Option.None<T>
Type Parameters:
T - The type of the optional value.
All Implemented Interfaces:
Option<T>, Value<T>, Serializable, Iterable<T>
Enclosing interface:
Option<T>

public static final class Option.None<T> extends Object implements Option<T>, Serializable
None is a singleton representation of the undefined Option.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • INSTANCE

      private static final Option.None<?> INSTANCE
      The singleton instance of None.
  • Constructor Details

    • None

      private None()
      Hidden constructor.
  • Method Details

    • get

      public T get()
      Description copied from interface: Option
      Gets the value if this is a Some or throws if this is a None.
      Specified by:
      get in interface Option<T>
      Specified by:
      get in interface Value<T>
      Returns:
      the value
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: Option
      Returns true, if this is None, otherwise false, if this is Some.
      Specified by:
      isEmpty in interface Option<T>
      Specified by:
      isEmpty in interface Value<T>
      Returns:
      true, if this Option is empty, false otherwise
    • equals

      public boolean equals(Object o)
      Description copied from interface: Value
      Clarifies that values have a proper equals() method implemented.

      See Object.equals(Object).

      Specified by:
      equals in interface Option<T>
      Specified by:
      equals in interface Value<T>
      Overrides:
      equals in class Object
      Parameters:
      o - An object
      Returns:
      true, if this equals o, false otherwise
    • hashCode

      public int hashCode()
      Description copied from interface: Value
      Clarifies that values have a proper hashCode() method implemented.

      See Object.hashCode().

      Specified by:
      hashCode in interface Option<T>
      Specified by:
      hashCode in interface Value<T>
      Overrides:
      hashCode in class Object
      Returns:
      The hashcode of this object
    • stringPrefix

      public String stringPrefix()
      Description copied from interface: Value
      Returns the name of this Value type, which is used by toString().
      Specified by:
      stringPrefix in interface Value<T>
      Returns:
      This type name.
    • toString

      public String toString()
      Description copied from interface: Value
      Clarifies that values have a proper toString() method implemented.

      See Object.toString().

      Specified by:
      toString in interface Option<T>
      Specified by:
      toString in interface Value<T>
      Overrides:
      toString in class Object
      Returns:
      A String representation of this object
    • readResolve

      private Object readResolve()
      Instance control for object serialization.
      Returns:
      The singleton instance of None.
      See Also: