src/share/classes/java/util/function/DoubleFunction.java

Print this page
rev 6189 : 8004015: Add Extends and deaults for basic functional interface types
Summary: Adds the appropriate extends and default methods for  core functional interfaces used by the JSR335 libraries.
Reviewed-by: duke

*** 26,40 **** /** * Apply a function to the input object yielding an appropriate {@code double} * value; this is the {@code double}-bearing specialization for {@link Function}. * * @param <T> the type of input objects to the function * * @since 1.8 */ ! public interface DoubleFunction<T> { /** * Apply a function to the input object yielding an appropriate * {@code double} value. * --- 26,55 ---- /** * Apply a function to the input object yielding an appropriate {@code double} * value; this is the {@code double}-bearing specialization for {@link Function}. * + * <p>When used as a {@code Function} the default {@code apply} implementation + * provided by this interface neither accepts null parameters nor does it return + * null results. + * * @param <T> the type of input objects to the function * * @since 1.8 */ ! public interface DoubleFunction<T> extends Function<T,Double> { ! ! /** ! * {@inheritDoc} ! * ! * @param t {@inheritDoc}, must be non-null ! * @return {@inheritDoc}, always non-null ! */ ! @Override ! public default Double apply(T t) { ! return applyAsDouble(t); ! } /** * Apply a function to the input object yielding an appropriate * {@code double} value. *