--- old/src/share/classes/java/util/function/Function.java 2012-12-20 16:32:18.200520652 -0800 +++ new/src/share/classes/java/util/function/Function.java 2012-12-20 16:32:17.976520642 -0800 @@ -24,6 +24,8 @@ */ package java.util.function; +import java.util.Objects; + /** * Apply a function to the input object yielding an appropriate result object. A * function may variously provide a mapping between types, object instances or @@ -44,4 +46,20 @@ * @return the function result */ public R apply(T t); + + /** + * Combine with another function returning a function which performs both + * functions. + * + * @param Type of output objects from the combined function. May be the + * same type as {@code }. + * @param after An additional function to be applied to the result of this + * function. + * @return A function which performs both the original function followed by + * a second function. + */ + public default Function compose(Function after) { + Objects.requireNonNull(after); + return (T t) -> after.apply(apply(t)); + } }