Class Option.Some<T>

    • Method Detail

      • get

        public T get()
        Return the value wrapped in this Option. Only safe to call this on Some.
        Specified by:
        get in interface Option<T>
      • getOrElse

        public T getOrElse​(T t)
        If this is Some, return the value wrapped in this Option. Otherwise, return the given value.
        Specified by:
        getOrElse in interface Option<T>
      • isSome

        public boolean isSome()
        Is this Some?
        Specified by:
        isSome in interface Option<T>
      • match

        public <U> U match​(Fn1<T,​U> has,
                           Fn0<U> hasNot)
        Pass in a function to execute if its Some and another to execute if its None.
        Specified by:
        match in interface Option<T>
      • then

        public <U> Option<U> then​(Fn1<T,​Option<U>> f)
        If this is Some, Apply the given function, else return None. Use this to chain options together, failing fast at the first none() or continuing through as many operations that return some as possible.
        Specified by:
        then in interface Option<T>
      • hashCode

        @Deprecated
        public int hashCode()
        Deprecated.
        Valid, but deprecated because it's usually an error to call this in client code.
        Overrides:
        hashCode in class Object
      • equals

        @Deprecated
        public boolean equals​(Object other)
        Deprecated.
        Valid, but deprecated because it's usually an error to call this in client code.
        Overrides:
        equals in class Object