On Wed, 25 Nov 2020 19:48:32 GMT, Jim Laskey <jlas...@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

Reply via email to