mapOrElse<U> method
U
mapOrElse<U>(
- U op(
- T
- U def()
inherited
Maps an Option<T>
to U
by applying a function to a contained T
value, or computes a default (if not).
Implementation
U mapOrElse<U>(U Function(T) op, U Function() def) {
final val = toNullable();
if (val != null) {
return op(val);
} else {
return def();
}
}