match
public java.util.Optional<R> match(T value)
Description copied from interface: Case
Match against the supplied value.
Value will be passed into the current predicate
If it passes / holds, value will be passed to the current function.
The result of function application will be returned wrapped in an Optional.
If the predicate does not hold, Optional.empty() is returned.
- Specified by:
match
in interface Case<T,R>
- Parameters:
value
- To match against
- Returns:
- Optional.empty if doesn't match, result of the application of current function if it does wrapped in an Optional