@NotNull
    public OptionalInt mapToInt(@NotNull DoubleToIntFunction mapper) {
        if (!isPresent()) {
            return OptionalInt.empty();
        }
        Objects.requireNonNull(mapper);
        return OptionalInt.of(mapper.applyAsInt(value));
    }
@ NotNull public OptionalInt mapToInt ( @ NotNull DoubleToIntFunction mapper ) { if ( ! isPresent ( ) ) { return OptionalInt . empty ( ) ; } Objects . requireNonNull ( mapper ) ; return OptionalInt . of ( mapper . applyAsInt ( value ) ) ; }
Invokes the given mapping function on inner value if present.

@param mapper  mapping function
@return an {@code OptionalInt} with transformed value if present,
otherwise an empty {@code OptionalInt}
@throws NullPointerException if value is present and
{@code mapper} is {@code null}