src/share/classes/java/util/function/UnaryOperator.java
Print this page
rev 7047 : 8004015: Additional static and instance utils for functional interfaces.
Reviewed-by: briangoetz
*** 34,39 ****
--- 34,48 ----
* @see Function
* @since 1.8
*/
@FunctionalInterface
public interface UnaryOperator<T> extends Function<T, T> {
+
+ /**
+ * Returns a unary operator that provides its input value as the result.
+ *
+ * @return a unary operator that provides its input value as the result
+ */
+ static <T> UnaryOperator<T> identity() {
+ return t -> t;
+ }
}