match<B> abstract method
- B onNone(
- B onSome(
- T t
Execute onSome
when value is Some, otherwise execute onNone
.
[🍌].match(() => 🍎, (🍌) => 🍌 * 2) -> 🍌🍌
[_].match(() => 🍎, (🍌) => 🍌 * 2) -> 🍎
Same as fold
.
Implementation
B match<B>(B Function() onNone, B Function(T t) onSome);