You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can use safe dot operation with this datatype and also all operation of the Option class. To check if the value is empty you have to compare it with nil.
stub class Option<T> {
//Get the value or throw exception
def get : T
//Get the value if defined or return the parameter
def getOr(value : T) : T
//Return self if defined or the parameter
def or(option : T?) : T?
//Execute the lambda if defined
def for(f : T -> void)
//Return new option with mapped value or none
def map<X>(f : T -> X) : X?
//Return the option returned with the lambda or none
def flatMap<X>(f : T -> X?) : X?
}