src/share/classes/java/util/function/LongUnaryOperator.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

*** 25,37 **** package java.util.function; /** * An operation on a single {@code long} operand yielding a {@code long} result. * * @since 1.8 */ ! public interface LongUnaryOperator { /** * Returns the {@code long} result of the operation upon the {@code long} * operand. * --- 25,54 ---- package java.util.function; /** * An operation on a single {@code long} operand yielding a {@code long} result. * + * <p>This is the primitive type specialization of {@link UnaryOperator} for + * {@code long} and also may be used as a {@code UnaryOperator<Long>}. When + * used as a {@code UnaryOperator} the default {@code operate} implementation + * provided by this interface neither accepts null parameters nor does it return + * null results. + * * @since 1.8 */ ! public interface LongUnaryOperator extends UnaryOperator<Long> { ! ! /** ! * {@inheritDoc} ! * ! * @param operand {@inheritDoc}, must be non-null ! * @return {@inheritDoc}, always non-null ! */ ! @Override ! public default Long operate(Long operand) { ! return operateAsLong((long)operand); ! } /** * Returns the {@code long} result of the operation upon the {@code long} * operand. *