RFR: 8317993: Add capturing factories to classes in java.util.function package [v3]

Per Minborg pminborg at openjdk.org
Wed Oct 18 08:33:37 UTC 2023


On Tue, 17 Oct 2023 13:22:29 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

>> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update naming and javadocs
>
> src/java.base/share/classes/java/util/function/BiConsumer.java line 105:
> 
>> 103:      */
>> 104:     static <T, U> BiConsumer<T, U> of(BiConsumer<T, U> uncaptured) {
>> 105:         return Objects.requireNonNull(uncaptured);
> 
> This does more than just capturing: not sure if the `null` check is generally useful here and elsewhere.

I have added a `@throws NullPointerException if source is null` clause where needed. I think there is no valid use case for providing null as a parameter and so I believe this is a desired property of the contemplated methods. However, there might be contrary arguments that I have not seen?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16213#discussion_r1363455782


More information about the core-libs-dev mailing list