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

Per Minborg pminborg at openjdk.org
Wed Oct 18 09:25:05 UTC 2023


On Wed, 18 Oct 2023 09:12:23 GMT, Chen Liang <liach at openjdk.org> wrote:

>> src/java.base/share/classes/java/util/function/UnaryOperator.java line 68:
>> 
>>> 66:      * @see Function#andThen(Function)
>>> 67:      */
>>> 68:     default UnaryOperator<T> andThenUnary(UnaryOperator<T> after) {
>> 
>> What are your comments on this proposed method?
>
> Just curious, do we have any idea how extensively `UnaryOperator` is used as a parameter type in user code compared to plain `Function<T, T>`? If it's not preferred over `Function<T, T>`, this new method might not be very useful.

Generally speaking, there are 1,594 usages of `Function` and 208 usages of `UnaryFunction` in the JDK itself. More specifically, there are 8 usages of `Function::andThen` and zero use of `UnaryOperator::andThen` in the JDK.

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

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


More information about the core-libs-dev mailing list