RFR: 8248862: Implement Enhanced Pseudo-Random Number Generators [v3]

Rémi Forax github.com+828220+forax at openjdk.java.net
Wed Nov 25 20:43:01 UTC 2020


On Wed, 25 Nov 2020 19:48:32 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:

>> At least, it's more clear that it's reversed, i've initially miss the fact that f and g are swapped.
>> And :: is able to do inference so, i believe it can be written
>>   `.sorted(Comparator.comparingInt(RandomGeneratorFactory::stateBits).reversed())`
>
> Unfortunately it couldn't be inferred

It's because you have added reverse() as a postfix operation so the inference can not flow backward as it should,
using Collections.reverseOrder() should fix that
`.sorted(Collections.reverseOrder(Comparator.comparingInt(RandomGeneratorFactory::stateBits)))`

using some import statics for reverseOrder and comparintInt make the code readable but given it's in the doc, we are out of luck here.

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

PR: https://git.openjdk.java.net/jdk/pull/1292



More information about the security-dev mailing list