--- old/src/share/classes/java/util/function/BiFunction.java 2013-05-06 18:46:56.159523965 -0700 +++ new/src/share/classes/java/util/function/BiFunction.java 2013-05-06 18:46:55.959523955 -0700 @@ -24,15 +24,17 @@ */ package java.util.function; +import java.util.Objects; + /** * Apply a function to the input arguments, yielding an appropriate result. This * is the two-arity specialization of {@link Function}. A function may * variously provide a mapping between types, object instances or keys and * values or any other form of transformation upon the input. * - * @param the type of the first argument to the {@code apply} operation. - * @param the type of the second argument to the {@code apply} operation. - * @param the type of results returned by the {@code apply} operation. + * @param the type of the first argument to the {@code apply} operation + * @param the type of the second argument to the {@code apply} operation + * @param the type of results returned by the {@code apply} operation * * @see Function * @since 1.8 @@ -48,4 +50,21 @@ * @return the function result */ R apply(T t, U u); + + /** + * Compose a new function which applies this function followed by the + * provided function. + * + * @param Type of output objects to the combined function. May be the + * same type as {@code }, {@code } or {@code } + * @param after An additional function to be applied after this function is + * applied + * @return A function which performs this function followed by the provided + * function + * @throws NullPointerException if after is null + */ + default BiFunction andThen(Function after) { + Objects.requireNonNull(after); + return (T t, U u) -> after.apply(apply(t, u)); + } }