Class Option.Some<T>

  • Type Parameters:
    T - The type of the optional value.
    All Implemented Interfaces:
    Iterable<T>, Value<T>, java.io.Serializable, java.lang.Iterable<T>
    Enclosing class:
    Option<T>

    @Deprecated
    public static final class Option.Some<T>
    extends Option<T>
    implements java.io.Serializable
    Deprecated.
    will be removed from the public API
    Some represents a defined Option. It contains a value which may be null. However, to create an Option containing null, new Some(null) has to be called. In all other cases Option.of(Object) is sufficient.
    See Also:
    Serialized Form
    • Method Detail

      • get

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

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

        public boolean equals​(java.lang.Object obj)
        Deprecated.
        Description copied from interface: Value
        Clarifies that values have a proper equals() method implemented.

        See Object.equals(Object).

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

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

        See Object.hashCode().

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

        public java.lang.String stringPrefix()
        Deprecated.
        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 java.lang.String toString()
        Deprecated.
        Description copied from interface: Value
        Clarifies that values have a proper toString() method implemented.

        See Object.toString().

        Specified by:
        toString in interface Value<T>
        Overrides:
        toString in class java.lang.Object
        Returns:
        A String representation of this object