RFR : 8004015 : (S) Additional Functional Interface instance and static methods (original) (raw)

David Holmes david.holmes at oracle.com
Fri May 17 04:36:35 UTC 2013


Hi Mike,

A general comment regarding exceptional behaviour. There are a lot of operations that involve composite operations (compose, andThen, or, and, xor etc) and if the first operation throws an exception the second never gets evaluated. Does this need to be spelled out somewhere or is this obviously the only way it would work ?


BiConsumer.java

54 * Returns a BiConsumer which performs in sequence the {@code accept} 55 * methods of multiple BiConsumers.

It doesn't perform for multiple BiConsumers but only the one specified. That may be chained to another and so forth but each chain operation only relates to a single BiConsumer. You might then simply describe this method as:

"Returns a BiConsumer which chains this BiConsumer with another BiConsumer. The returned BiConsumer's accept method invokes this BiConsumer's accept method followed by the accept method of the specified BiConsumer."


BiFunction.java

Why is the documentation style for BiFunction.andThen so different to BiConsumer.chain when they effectively do the same thing? Shouldn't andThen be described as:

"Returns a BiFunction that composes this BiFunction with another BiFunction ..."

"additional" is superfluous - additional to what?


Consumer.java

Same basic comments as for BiConsumer.


Function.java

Same basic comments as BiFunction.


Thanks, David

On 15/05/2013 2:22 PM, Mike Duigou wrote:

Hello all;

This a fairly small set of additional methods for the existing Java 8 functional interfaces. These methods have been held back until now awaiting support for static interface methods. http://cr.openjdk.java.net/~mduigou/JDK-8004015/0/webrev/ Mike



More information about the core-libs-dev mailing list