match<R> method

  1. @override
R match<R>(
  1. R okop(
    1. T
    ),
  2. R errop(
    1. E
    )
)
override

Invokes either the okop or the errop depending on the result.

This is an attempt at providing something similar to the Rust match expression, which makes it easy to get at the value or error, depending on the result.

See also when for another way to achieve the same behavior.

Implementation

@override
R match<R>(R Function(T) okop, R Function(E) errop) => errop(_err);