transformNullable<S> method

Optional<S> transformNullable <S>(S transformer(T value))

Transforms the Optional value.

If the Optional is absent(), returns absent() without applying the transformer.

Returns absent() if the transformer returns null.

Implementation

Optional<S> transformNullable<S>(S transformer(T value)) {
  return _value == null
      ? new Optional.absent()
      : new Optional.fromNullable(transformer(_value));
}