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

@@ -30,11 +30,16 @@
  *
  * @param <T> the type of operand to {@code operate} and of the result
  *
  * @since 1.8
  */
-public interface UnaryOperator<T> {
+public interface UnaryOperator<T> extends Function<T, T> {
+
+    @Override
+    public default T apply(T operand) {
+        return operate(operand);
+    }
 
     /**
      * Returns the result of the operation upon the operand.
      *
      * @param operand the operand