--- old/src/share/classes/java/util/function/BiConsumer.java 2013-05-06 18:46:55.499523933 -0700 +++ new/src/share/classes/java/util/function/BiConsumer.java 2013-05-06 18:46:55.299523923 -0700 @@ -24,14 +24,16 @@ */ package java.util.function; +import java.util.Objects; + /** * An operation which accepts two input arguments and returns no result. This is * the two-arity specialization of {@link Consumer}. Unlike most other * functional interfaces, {@code BiConsumer} is expected to operate via * side-effects. * - * @param the type of the first argument to the {@code accept} operation. - * @param the type of the second argument to the {@code accept} operation. + * @param the type of the first argument to the {@code accept} operation + * @param the type of the second argument to the {@code accept} operation * * @see Consumer * @since 1.8 @@ -47,4 +49,26 @@ * @param u an input object */ void accept(T t, U u); + + /** + * Returns a BiConsumer which performs in sequence the {@code accept} + * methods of multiple BiConsumers. This BiConsumer's {@code accept} method + * is performed followed by the {@code accept} method of the specified + * BiConsumer operation. + * + * @param other an additional BiConsumer which will be chained after this + * BiConsumer + * @return a BiConsumer which performs in sequence the {@code accept} method + * of this BiConsumer and the {@code accept} method of the specified + * BiConsumer operation + * @throws NullPointerException if other is null + */ + default BiConsumer chain(BiConsumer other) { + Objects.requireNonNull(other); + + return (l, r) -> { + accept(l, r); + other.accept(l, r); + }; + } } --- 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)); + } } --- old/src/share/classes/java/util/function/BiPredicate.java 2013-05-06 18:46:56.823523997 -0700 +++ new/src/share/classes/java/util/function/BiPredicate.java 2013-05-06 18:46:56.623523986 -0700 @@ -30,8 +30,8 @@ * Determines if the input objects match some criteria. This is the two-arity * specialization of {@link Predicate}. * - * @param the type of the first argument to {@code test}. - * @param the type of the second argument to {@code test}. + * @param the type of the first argument to {@code test} + * @param the type of the second argument to {@code test} * * @see Predicate * @since 1.8 @@ -42,9 +42,9 @@ /** * Return {@code true} if the inputs match some criteria. * - * @param t an input object. - * @param u an input object. - * @return {@code true} if the inputs match some criteria. + * @param t an input object + * @param u an input object + * @return {@code true} if the inputs match some criteria */ boolean test(T t, U u); @@ -54,11 +54,12 @@ * this predicate returns {@code false} then the remaining predicate is not * evaluated. * - * @param p a predicate which will be logically-ANDed with this predicate. + * @param p a predicate which will be logically-ANDed with this predicate * @return a new predicate which returns {@code true} only if both - * predicates return {@code true}. + * predicates return {@code true} + * @throws NullPointerException if p is null */ - public default BiPredicate and(BiPredicate p) { + default BiPredicate and(BiPredicate p) { Objects.requireNonNull(p); return (T t, U u) -> test(t, u) && p.test(t, u); } @@ -67,9 +68,9 @@ * Returns a predicate which negates the result of this predicate. * * @return a new predicate who's result is always the opposite of this - * predicate. + * predicate */ - public default BiPredicate negate() { + default BiPredicate negate() { return (T t, U u) -> !test(t, u); } @@ -79,25 +80,13 @@ * predicate returns {@code true} then the remaining predicate is not * evaluated. * - * @param p a predicate which will be logically-ORed with this predicate. + * @param p a predicate which will be logically-ORed with this predicate * @return a new predicate which returns {@code true} if either predicate - * returns {@code true}. + * returns {@code true} + * @throws NullPointerException if p is null */ - public default BiPredicate or(BiPredicate p) { + default BiPredicate or(BiPredicate p) { Objects.requireNonNull(p); return (T t, U u) -> test(t, u) || p.test(t, u); } - - /** - * Returns a predicate that evaluates to {@code true} if both or neither of - * the component predicates evaluate to {@code true}. - * - * @param p a predicate which will be logically-XORed with this predicate. - * @return a predicate that evaluates to {@code true} if both or neither of - * the component predicates evaluate to {@code true}. - */ - public default BiPredicate xor(BiPredicate p) { - Objects.requireNonNull(p); - return (T t, U u) -> test(t, u) ^ p.test(t, u); - } } --- old/src/share/classes/java/util/function/BooleanSupplier.java 2013-05-06 18:46:57.487524029 -0700 +++ new/src/share/classes/java/util/function/BooleanSupplier.java 2013-05-06 18:46:57.283524018 -0700 @@ -40,5 +40,5 @@ * * @return a {@code boolean} value */ - public boolean getAsBoolean(); + boolean getAsBoolean(); } --- old/src/share/classes/java/util/function/Consumer.java 2013-05-06 18:46:58.147524060 -0700 +++ new/src/share/classes/java/util/function/Consumer.java 2013-05-06 18:46:57.947524050 -0700 @@ -24,6 +24,8 @@ */ package java.util.function; +import java.util.Objects; + /** * An operation which accepts a single input argument and returns no result. * Unlike most other functional interfaces, {@code Consumer} is expected to @@ -41,5 +43,22 @@ * * @param t the input object */ - public void accept(T t); + void accept(T t); + + /** + * Returns a Consumer which performs in sequence the {@code apply} methods + * of multiple Consumers. This Consumer's {@code accept} method is performed + * followed by the {@code accept} method of the specified Consumer operation. + * + * @param other an additional Consumer which will be chained after this + * Consumer + * @return a Consumer which performs in sequence the {@code accept} method + * of this Consumer and the {@code accept} method of the specified Consumer + * operation + * @throws NullPointerException if other is null + */ + default Consumer chain(Consumer other) { + Objects.requireNonNull(other); + return (T t) -> { accept(t); other.accept(t); }; + } } --- old/src/share/classes/java/util/function/DoubleBinaryOperator.java 2013-05-06 18:46:58.807524093 -0700 +++ new/src/share/classes/java/util/function/DoubleBinaryOperator.java 2013-05-06 18:46:58.607524083 -0700 @@ -43,5 +43,5 @@ * @param right the right operand value * @return the result of the operation */ - public double applyAsDouble(double left, double right); + double applyAsDouble(double left, double right); } --- old/src/share/classes/java/util/function/DoubleConsumer.java 2013-05-06 18:46:59.463524124 -0700 +++ new/src/share/classes/java/util/function/DoubleConsumer.java 2013-05-06 18:46:59.263524114 -0700 @@ -41,5 +41,5 @@ * * @param value the input value */ - public void accept(double value); + void accept(double value); } --- old/src/share/classes/java/util/function/DoubleFunction.java 2013-05-06 18:47:00.123524155 -0700 +++ new/src/share/classes/java/util/function/DoubleFunction.java 2013-05-06 18:46:59.927524146 -0700 @@ -43,5 +43,5 @@ * @param value the input value * @return the function result */ - public R apply(double value); + R apply(double value); } --- old/src/share/classes/java/util/function/DoublePredicate.java 2013-05-06 18:47:00.783524188 -0700 +++ new/src/share/classes/java/util/function/DoublePredicate.java 2013-05-06 18:47:00.583524179 -0700 @@ -40,11 +40,11 @@ /** * Returns {@code true} if the input value matches some criteria. * - * @param value the value to be tested. + * @param value the value to be tested * @return {@code true} if the input value matches some criteria, otherwise - * {@code false}. + * {@code false} */ - public boolean test(double value); + boolean test(double value); /** * Returns a predicate which evaluates to {@code true} only if this @@ -52,11 +52,12 @@ * this predicate returns {@code false} then the remaining predicate is not * evaluated. * - * @param p a predicate which will be logically-ANDed with this predicate. + * @param p a predicate which will be logically-ANDed with this predicate * @return a new predicate which returns {@code true} only if both - * predicates return {@code true}. + * predicates return {@code true} + * @throws NullPointerException if p is null */ - public default DoublePredicate and(DoublePredicate p) { + default DoublePredicate and(DoublePredicate p) { Objects.requireNonNull(p); return (value) -> test(value) && p.test(value); } @@ -65,9 +66,9 @@ * Returns a predicate which negates the result of this predicate. * * @return a new predicate who's result is always the opposite of this - * predicate. + * predicate */ - public default DoublePredicate negate() { + default DoublePredicate negate() { return (value) -> !test(value); } @@ -77,25 +78,13 @@ * predicate returns {@code true} then the remaining predicate is not * evaluated. * - * @param p a predicate which will be logically-ANDed with this predicate. + * @param p a predicate which will be logically-ANDed with this predicate * @return a new predicate which returns {@code true} if either predicate - * returns {@code true}. + * returns {@code true} + * @throws NullPointerException if p is null */ - public default DoublePredicate or(DoublePredicate p) { + default DoublePredicate or(DoublePredicate p) { Objects.requireNonNull(p); return (value) -> test(value) || p.test(value); } - - /** - * Returns a predicate that evaluates to {@code true} if both or neither of - * the component predicates evaluate to {@code true}. - * - * @param p a predicate which will be logically-XORed with this predicate. - * @return a predicate that evaluates to {@code true} if all or none of the - * component predicates evaluate to {@code true}. - */ - public default DoublePredicate xor(DoublePredicate p) { - Objects.requireNonNull(p); - return (value) -> test(value) ^ p.test(value); - } } --- old/src/share/classes/java/util/function/DoubleSupplier.java 2013-05-06 18:47:01.451524221 -0700 +++ new/src/share/classes/java/util/function/DoubleSupplier.java 2013-05-06 18:47:01.255524210 -0700 @@ -39,5 +39,5 @@ * * @return a {@code double} value */ - public double getAsDouble(); + double getAsDouble(); } --- old/src/share/classes/java/util/function/DoubleUnaryOperator.java 2013-05-06 18:47:02.107524252 -0700 +++ new/src/share/classes/java/util/function/DoubleUnaryOperator.java 2013-05-06 18:47:01.907524242 -0700 @@ -42,5 +42,14 @@ * @param operand the operand value * @return the operation result value */ - public double applyAsDouble(double operand); + double applyAsDouble(double operand); + + /** + * 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 DoubleUnaryOperator identity() { + return t -> t; + } } --- old/src/share/classes/java/util/function/Function.java 2013-05-06 18:47:02.767524283 -0700 +++ new/src/share/classes/java/util/function/Function.java 2013-05-06 18:47:02.567524275 -0700 @@ -24,14 +24,15 @@ */ package java.util.function; +import java.util.Objects; /** * Apply a function to the input argument, yielding an appropriate result. 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 input to the {@code apply} operation. - * @param the type of the result of the {@code apply} operation. + * @param the type of the input to the {@code apply} operation + * @param the type of the result of the {@code apply} operation * * @since 1.8 */ @@ -44,5 +45,48 @@ * @param t the input object * @return the function result */ - public R apply(T t); + R apply(T t); + + /** + * Compose a new function which applies the provided function followed by + * this function. + * + * @param Type of input objects to the combined function. May be the + * same type as {@code } or {@code } + * @param before An additional function to be applied before this function + * is applied + * @return A function which performs the provided function followed by this + * function + * @throws NullPointerException if before is null + */ + default Function compose(Function before) { + Objects.requireNonNull(before); + return (V v) -> apply(before.apply(v)); + } + + /** + * 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 } 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 followed + * @throws NullPointerException if after is null + */ + default Function andThen(Function after) { + Objects.requireNonNull(after); + return (T t) -> after.apply(apply(t)); + } + + /** + * Returns a {@code Function} whose {@code apply} method returns its input. + * + * @param the type of the input and output objects to the function + */ + static Function identity() { + return t -> t; + } } --- old/src/share/classes/java/util/function/IntBinaryOperator.java 2013-05-06 18:47:03.423524316 -0700 +++ new/src/share/classes/java/util/function/IntBinaryOperator.java 2013-05-06 18:47:03.231524307 -0700 @@ -44,5 +44,5 @@ * @param right the right operand value * @return the result of the operation */ - public int applyAsInt(int left, int right); + int applyAsInt(int left, int right); } --- old/src/share/classes/java/util/function/IntConsumer.java 2013-05-06 18:47:04.087524348 -0700 +++ new/src/share/classes/java/util/function/IntConsumer.java 2013-05-06 18:47:03.887524338 -0700 @@ -41,5 +41,5 @@ * * @param value the input value */ - public void accept(int value); + void accept(int value); } --- old/src/share/classes/java/util/function/IntFunction.java 2013-05-06 18:47:04.755524381 -0700 +++ new/src/share/classes/java/util/function/IntFunction.java 2013-05-06 18:47:04.555524371 -0700 @@ -43,5 +43,5 @@ * @param value the input value * @return the function result */ - public R apply(int value); + R apply(int value); } --- old/src/share/classes/java/util/function/IntPredicate.java 2013-05-06 18:47:05.419524413 -0700 +++ new/src/share/classes/java/util/function/IntPredicate.java 2013-05-06 18:47:05.219524402 -0700 @@ -39,11 +39,11 @@ /** * Returns {@code true} if the input value matches some criteria. * - * @param value the value to be tested. + * @param value the value to be tested * @return {@code true} if the input value matches some criteria, otherwise * {@code false} */ - public boolean test(int value); + boolean test(int value); /** * Returns a predicate which evaluates to {@code true} only if this @@ -51,11 +51,12 @@ * this predicate returns {@code false} then the remaining predicate is not * evaluated. * - * @param p a predicate which will be logically-ANDed with this predicate. + * @param p a predicate which will be logically-ANDed with this predicate * @return a new predicate which returns {@code true} only if both - * predicates return {@code true}. + * predicates return {@code true} + * @throws NullPointerException if p is null */ - public default IntPredicate and(IntPredicate p) { + default IntPredicate and(IntPredicate p) { Objects.requireNonNull(p); return (value) -> test(value) && p.test(value); } @@ -64,9 +65,9 @@ * Returns a predicate which negates the result of this predicate. * * @return a new predicate who's result is always the opposite of this - * predicate. + * predicate */ - public default IntPredicate negate() { + default IntPredicate negate() { return (value) -> !test(value); } @@ -76,25 +77,13 @@ * predicate returns {@code true} then the remaining predicate is not * evaluated. * - * @param p a predicate which will be logically-ORed with this predicate. + * @param p a predicate which will be logically-ORed with this predicate * @return a new predicate which returns {@code true} if either predicate - * returns {@code true}. + * returns {@code true} + * @throws NullPointerException if p is null */ - public default IntPredicate or(IntPredicate p) { + default IntPredicate or(IntPredicate p) { Objects.requireNonNull(p); return (value) -> test(value) || p.test(value); } - - /** - * Returns a predicate that evaluates to {@code true} if both or neither of - * the component predicates evaluate to {@code true}. - * - * @param p a predicate which will be logically-XORed with this predicate. - * @return a predicate that evaluates to {@code true} if both or neither of - * the component predicates evaluate to {@code true} - */ - public default IntPredicate xor(IntPredicate p) { - Objects.requireNonNull(p); - return (value) -> test(value) ^ p.test(value); - } } --- old/src/share/classes/java/util/function/IntSupplier.java 2013-05-06 18:47:06.079524444 -0700 +++ new/src/share/classes/java/util/function/IntSupplier.java 2013-05-06 18:47:05.879524434 -0700 @@ -39,5 +39,5 @@ * * @return an {@code int} value */ - public int getAsInt(); + int getAsInt(); } --- old/src/share/classes/java/util/function/IntUnaryOperator.java 2013-05-06 18:47:06.735524476 -0700 +++ new/src/share/classes/java/util/function/IntUnaryOperator.java 2013-05-06 18:47:06.543524466 -0700 @@ -37,10 +37,19 @@ /** * Returns the {@code int} value result of the operation upon the - * {@code int} operand. + * {@code int} operand. * * @param operand the operand value * @return the operation result value */ - public int applyAsInt(int operand); + int applyAsInt(int operand); + + /** + * 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 IntUnaryOperator identity() { + return t -> t; + } } --- old/src/share/classes/java/util/function/LongBinaryOperator.java 2013-05-06 18:47:07.399524509 -0700 +++ new/src/share/classes/java/util/function/LongBinaryOperator.java 2013-05-06 18:47:07.199524499 -0700 @@ -44,5 +44,5 @@ * @param right the right operand value * @return the result of the operation */ - public long applyAsLong(long left, long right); + long applyAsLong(long left, long right); } --- old/src/share/classes/java/util/function/LongConsumer.java 2013-05-06 18:47:08.059524540 -0700 +++ new/src/share/classes/java/util/function/LongConsumer.java 2013-05-06 18:47:07.859524530 -0700 @@ -41,5 +41,5 @@ * * @param value the input value */ - public void accept(long value); + void accept(long value); } --- old/src/share/classes/java/util/function/LongFunction.java 2013-05-06 18:47:08.727524573 -0700 +++ new/src/share/classes/java/util/function/LongFunction.java 2013-05-06 18:47:08.523524562 -0700 @@ -43,5 +43,5 @@ * @param value the input value * @return the function result */ - public R apply(long value); + R apply(long value); } --- old/src/share/classes/java/util/function/LongPredicate.java 2013-05-06 18:47:09.391524605 -0700 +++ new/src/share/classes/java/util/function/LongPredicate.java 2013-05-06 18:47:09.195524595 -0700 @@ -39,11 +39,11 @@ /** * Returns {@code true} if the input value matches some criteria. * - * @param value the value to be tested. + * @param value the value to be tested * @return {@code true} if the input value matches some criteria, otherwise - * {@code false}. + * {@code false} */ - public boolean test(long value); + boolean test(long value); /** * Returns a predicate which evaluates to {@code true} only if this @@ -51,11 +51,11 @@ * this predicate returns {@code false} then the remaining predicate is not * evaluated. * - * @param p a predicate which will be logically-ANDed with this predicate. + * @param p a predicate which will be logically-ANDed with this predicate * @return a new predicate which returns {@code true} only if both - * predicates return {@code true}. + * predicates return {@code true} */ - public default LongPredicate and(LongPredicate p) { + default LongPredicate and(LongPredicate p) { Objects.requireNonNull(p); return (value) -> test(value) && p.test(value); } @@ -64,9 +64,9 @@ * Returns a predicate which negates the result of this predicate. * * @return a new predicate who's result is always the opposite of this - * predicate. + * predicate */ - public default LongPredicate negate() { + default LongPredicate negate() { return (value) -> !test(value); } @@ -76,25 +76,13 @@ * predicate returns {@code true} then the remaining predicate is not * evaluated. * - * @param p a predicate which will be logically-ORed with this predicate. + * @param p a predicate which will be logically-ORed with this predicate * @return a new predicate which returns {@code true} if either predicate - * returns {@code true}. + * returns {@code true} + * @throws NullPointerException if p is null */ - public default LongPredicate or(LongPredicate p) { + default LongPredicate or(LongPredicate p) { Objects.requireNonNull(p); return (value) -> test(value) || p.test(value); } - - /** - * Returns a predicate that evaluates to {@code true} if both or neither of - * the component predicates evaluate to {@code true}. - * - * @param p a predicate which will be logically-XORed with this predicate. - * @return a predicate that evaluates to {@code true} if both or neither of - * the component predicates evaluate to {@code true}. - */ - public default LongPredicate xor(LongPredicate p) { - Objects.requireNonNull(p); - return (value) -> test(value) ^ p.test(value); - } } --- old/src/share/classes/java/util/function/LongSupplier.java 2013-05-06 18:47:10.059524637 -0700 +++ new/src/share/classes/java/util/function/LongSupplier.java 2013-05-06 18:47:09.863524628 -0700 @@ -39,5 +39,5 @@ * * @return a {@code long} value */ - public long getAsLong(); + long getAsLong(); } --- old/src/share/classes/java/util/function/LongUnaryOperator.java 2013-05-06 18:47:10.723524669 -0700 +++ new/src/share/classes/java/util/function/LongUnaryOperator.java 2013-05-06 18:47:10.523524659 -0700 @@ -42,5 +42,14 @@ * @param operand the operand value * @return the operation result value */ - public long applyAsLong(long operand); + long applyAsLong(long operand); + + /** + * 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 LongUnaryOperator identity() { + return t -> t; + } } --- old/src/share/classes/java/util/function/ObjDoubleConsumer.java 2013-05-06 18:47:11.383524700 -0700 +++ new/src/share/classes/java/util/function/ObjDoubleConsumer.java 2013-05-06 18:47:11.183524692 -0700 @@ -44,5 +44,5 @@ * @param t an input object * @param value an input value */ - public void accept(T t, double value); + void accept(T t, double value); } --- old/src/share/classes/java/util/function/ObjIntConsumer.java 2013-05-06 18:47:12.043524733 -0700 +++ new/src/share/classes/java/util/function/ObjIntConsumer.java 2013-05-06 18:47:11.847524724 -0700 @@ -30,7 +30,7 @@ * {@link BiConsumer}. Unlike most other functional interfaces, * {@code ObjIntConsumer} is expected to operate via side-effects. * - * @param Type of reference argument to {@code accept()}. + * @param Type of reference argument to {@code accept()} * * @see BiConsumer * @since 1.8 @@ -44,5 +44,5 @@ * @param t an input object * @param value an input value */ - public void accept(T t, int value); + void accept(T t, int value); } --- old/src/share/classes/java/util/function/ObjLongConsumer.java 2013-05-06 18:47:12.711524766 -0700 +++ new/src/share/classes/java/util/function/ObjLongConsumer.java 2013-05-06 18:47:12.511524756 -0700 @@ -30,7 +30,7 @@ * {@link BiConsumer}. Unlike most other functional interfaces, * {@code ObjLongConsumer} is expected to operate via side-effects. * - * @param Type of reference argument to {@code accept()}. + * @param Type of reference argument to {@code accept()} * * @see BiConsumer * @since 1.8 @@ -44,5 +44,5 @@ * @param t an input object * @param value an input value */ - public void accept(T t, long value); + void accept(T t, long value); } --- old/src/share/classes/java/util/function/Predicate.java 2013-05-06 18:47:13.371524798 -0700 +++ new/src/share/classes/java/util/function/Predicate.java 2013-05-06 18:47:13.171524788 -0700 @@ -43,7 +43,7 @@ * @return {@code true} if the input object matches some criteria, otherwise * {@code false} */ - public boolean test(T t); + boolean test(T t); /** * Returns a predicate which evaluates to {@code true} only if this @@ -51,11 +51,12 @@ * this predicate returns {@code false} then the remaining predicate is not * evaluated. * - * @param p a predicate which will be logically-ANDed with this predicate. + * @param p a predicate which will be logically-ANDed with this predicate * @return a new predicate which returns {@code true} only if both - * predicates return {@code true}. + * predicates return {@code true} + * @throws NullPointerException if p is null */ - public default Predicate and(Predicate p) { + default Predicate and(Predicate p) { Objects.requireNonNull(p); return (t) -> test(t) && p.test(t); } @@ -66,7 +67,7 @@ * @return a new predicate who's result is always the opposite of this * predicate. */ - public default Predicate negate() { + default Predicate negate() { return (t) -> !test(t); } @@ -76,25 +77,28 @@ * predicate returns {@code true} then the remaining predicate is not * evaluated. * - * @param p a predicate which will be logically-ORed with this predicate. + * @param p a predicate which will be logically-ORed with this predicate * @return a new predicate which returns {@code true} if either predicate - * returns {@code true}. + * returns {@code true} + * @throws NullPointerException if p is null */ - public default Predicate or(Predicate p) { + default Predicate or(Predicate p) { Objects.requireNonNull(p); return (t) -> test(t) || p.test(t); } /** - * Returns a predicate that evaluates to {@code true} if both or neither of - * the component predicates evaluate to {@code true}. + * Returns a predicate who's result matches + * {@code Objects.equals(target, t)}. * - * @param p a predicate which will be logically-XORed with this predicte. - * @return a predicate that evaluates to {@code true} if both or neither of - * the component predicates evaluate to {@code true}. + * @param the type of values evaluated by the predicate + * @param target the target value to be compared for equality + * @return a predicate who's result matches + * {@code Objects.equals(target, t)} */ - public default Predicate xor(Predicate p) { - Objects.requireNonNull(p); - return (t) -> test(t) ^ p.test(t); + static Predicate isEqual(Object target) { + return (null == target) + ? Objects::isNull + : object -> target.equals(object); } } --- old/src/share/classes/java/util/function/Supplier.java 2013-05-06 18:47:14.035524830 -0700 +++ new/src/share/classes/java/util/function/Supplier.java 2013-05-06 18:47:13.835524819 -0700 @@ -40,5 +40,5 @@ * * @return an object */ - public T get(); + T get(); } --- old/src/share/classes/java/util/function/ToDoubleBiFunction.java 2013-05-06 18:47:14.703524862 -0700 +++ new/src/share/classes/java/util/function/ToDoubleBiFunction.java 2013-05-06 18:47:14.507524853 -0700 @@ -46,5 +46,5 @@ * @param u an input object * @return the function result value */ - public double applyAsDouble(T t, U u); + double applyAsDouble(T t, U u); } --- old/src/share/classes/java/util/function/ToDoubleFunction.java 2013-05-06 18:47:15.367524894 -0700 +++ new/src/share/classes/java/util/function/ToDoubleFunction.java 2013-05-06 18:47:15.171524885 -0700 @@ -42,5 +42,5 @@ * @param t the input object * @return the function result value */ - public double applyAsDouble(T t); + double applyAsDouble(T t); } --- old/src/share/classes/java/util/function/ToIntBiFunction.java 2013-05-06 18:47:16.039524927 -0700 +++ new/src/share/classes/java/util/function/ToIntBiFunction.java 2013-05-06 18:47:15.835524917 -0700 @@ -28,10 +28,10 @@ * Apply a function to the input arguments, yielding an appropriate result. * This is the {@code int}-bearing specialization for {@link BiFunction}. * - * @param the type of the first argument to the {@code applyAsLong} - * operation. - * @param the type of the second argument to the {@code applyAsLong} - * operation. + * @param the type of the first argument to the {@code applyAsInt} + * operation + * @param the type of the second argument to the {@code applyAsInt} + * operation * * @see BiFunction * @since 1.8 @@ -46,5 +46,5 @@ * @param u an input object * @return the function result value */ - public int applyAsInt(T t, U u); + int applyAsInt(T t, U u); } --- old/src/share/classes/java/util/function/ToIntFunction.java 2013-05-06 18:47:16.699524959 -0700 +++ new/src/share/classes/java/util/function/ToIntFunction.java 2013-05-06 18:47:16.499524949 -0700 @@ -42,5 +42,5 @@ * @param t the input object * @return the function result value */ - public int applyAsInt(T t); + int applyAsInt(T t); } --- old/src/share/classes/java/util/function/ToLongBiFunction.java 2013-05-06 18:47:17.359524990 -0700 +++ new/src/share/classes/java/util/function/ToLongBiFunction.java 2013-05-06 18:47:17.163524980 -0700 @@ -46,5 +46,5 @@ * @param u an input object * @return the function result value */ - public long applyAsLong(T t, U u); + long applyAsLong(T t, U u); } --- old/src/share/classes/java/util/function/ToLongFunction.java 2013-05-06 18:47:18.031525023 -0700 +++ new/src/share/classes/java/util/function/ToLongFunction.java 2013-05-06 18:47:17.831525013 -0700 @@ -42,5 +42,5 @@ * @param t the input object * @return the function result value */ - public long applyAsLong(T t); + long applyAsLong(T t); } --- old/src/share/classes/java/util/function/UnaryOperator.java 2013-05-06 18:47:18.699525056 -0700 +++ new/src/share/classes/java/util/function/UnaryOperator.java 2013-05-06 18:47:18.495525045 -0700 @@ -36,4 +36,13 @@ */ @FunctionalInterface public interface UnaryOperator extends Function { + + /** + * 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 UnaryOperator identity() { + return t -> t; + } }