when<R> method
Pattern matching
if some
and none
all null Return None(null
)
else when it has return Some(some(it)) or not has return Some(none(it))
Implementation
Maybe<R> when<R>({R some(T val)?, R none()?}) {
if (this != null) {
if (some != null) return Some(some(this!.value));
} else {
if (none != null) return Some(none());
}
return None<R>();
}