map


Description:

public Optional<A> map<A> (MapFunc<Optional<A>,G> mapper)

If a value is present, performs the mapper function with the value, and returns the result. Otherwise returns an empty optional.

The given mapper function must not return null.

Parameters:

mapper

a mapper function that will be performed with the value if a value is present

Returns:

the result of the mapper function if a value is present, otherwise an empty optional