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

Per Minborg pminborg at openjdk.org
Wed Oct 18 10:37:30 UTC 2023


On Wed, 18 Oct 2023 09:22:39 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> 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.

I've run some corpus analysis and this came up:


pminborg at pminborg-mac open % cat ~/Downloads/experiment-2.log | grep Function.andThen | wc -l
    6689
pminborg at pminborg-mac open % cat ~/Downloads/experiment-2.log | grep UnaryOperator.andThen | wc -l
     153

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

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


More information about the core-libs-dev mailing list