<i18n dev> RFR: 8342863: Use pattern matching for instanceof in equals methods of wrapper classes
Chen Liang
liach at openjdk.org
Wed Oct 23 02:17:07 UTC 2024
On Wed, 23 Oct 2024 02:06:20 GMT, Joe Darcy <darcy at openjdk.org> wrote:
> Noticed this refactoring opportunity while doing some other work in the area.
src/java.base/share/classes/java/lang/Long.java line 1249:
> 1247: public boolean equals(Object obj) {
> 1248: if (obj instanceof Long ell) {
> 1249: return value == ell.longValue();
Suggestion:
if (obj instanceof Long l) {
return value == l.longValue();
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21652#discussion_r1811668798
More information about the i18n-dev
mailing list