StructuredTaskScope API open can use an UnaryOperator instead of a Function

Remi Forax forax at univ-mlv.fr
Tue May 20 06:53:09 UTC 2025


Hello,
i've just taken a look to the new StructuredTaskScope API,
i've seen a small improvement that can be done to the API.

There is a method open that takes a joiner and a configuration function (a configuration builder really)

  open(Joiner<? super T, ? extends R> joiner, Function<Configuration, Configuration> configFunction)

In java.util.function, there is already a type for the function that return the same type as the parameter, it's UnaryOperator,
so the signature of open(joiner, configFunction) can be simplified to

   open(Joiner<? super T, ? extends R> joiner, UnaryOperator<Configuration> configFunction)

regards,
Rémi

   


More information about the loom-dev mailing list