ToShortNullableImpl implements NullableExpression<T, ToShort<T>>, ToShortNullable<T> { @Override public ToDoubleNullable<T> mapToDoubleIfPresent(ShortToDoubleFunction mapper) { return t -> isNull.test(t) ? null : mapper.applyAsDouble(original.applyAsShort(t)); } ToShortNullableImpl(ToShort<T> original, Predicate<T> isNull); @Override ToShort<T> inner(); @Override Predicate<T> isNullPredicate(); @Override Short apply(T t); @Override short applyAsShort(T t); @Override ToShort<T> orThrow(); @Override ToShort<T> orElseGet(ToShort<T> getter); @Override ToShort<T> orElse(Short value); @Override ToDoubleNullable<T> mapToDoubleIfPresent(ShortToDoubleFunction mapper); @Override ToShortNullable<T> mapIfPresent(ShortUnaryOperator mapper); @Override long hash(T object); @Override int compare(T first, T second); @Override boolean isNull(T object); @Override boolean isNotNull(T object); @Override boolean equals(Object o); @Override int hashCode();  }
@Test void mapToDoubleIfPresent() { final ToDoubleNullable<String> toDoubleNullable = instance .mapToDoubleIfPresent(i -> 1); assertNotNull(toDoubleNullable); assertEquals(1, toDoubleNullable.applyAsDouble("three")); assertNull(toDoubleNullable.apply(null)); }