RFR: 8257512: Remove use of deprecated primitive constructors in JavaFX [v3]

Ambarish Rapte arapte at openjdk.java.net
Thu Mar 11 06:59:09 UTC 2021


On Wed, 10 Mar 2021 23:59:05 GMT, Nir Lisker <nlisker at openjdk.org> wrote:

>> Ambarish Rapte has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   correct Float.valueOf()
>
> apps/toys/LayoutDemo/src/layout/CustomPane.java line 92:
> 
>> 90:         Collections.sort(sortedManagedChidlren, (c1, c2)
>> 91:                 -> Double.valueOf(c2.prefHeight(-1)).compareTo(
>> 92:                         Double.valueOf(c1.prefHeight(-1))));
> 
> This can be replaced with
> 
>     Collections.sort(sortedManagedChidlren, (c1, c2) -> Double.compare(c2.prefHeight(-1), c1.prefHeight(-1)));
> 
> or
> 
>     Collections.sort(sortedManagedChidlren, Comparator.<Node>comparingDouble(n -> n.prefHeight(-1)).reversed());
> 
> I think.
> Same for the other places that do comparing.

As this change is a cleanup and intended to replace deprecated constructor calls with autoboxing or `valueOf()` method, I think we should not make other changes as part of this PR.

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

PR: https://git.openjdk.java.net/jfx/pull/423


More information about the openjfx-dev mailing list