RFR: 8355391: Use Double::hashCode in java.util.Locale::hashCode
Chen Liang
liach at openjdk.org
Wed Apr 30 23:27:22 UTC 2025
On Wed, 30 Apr 2025 18:01:08 GMT, Shaojin Wen <swen at openjdk.org> wrote:
> Similar to #24959, java.util.Locale.hashCode can also make the same improvement.
>
> Replace manual bitwise operations in hashCode implementations of java.util.Locale with Double::hashCode.
src/java.base/share/classes/java/util/Locale.java line 3500:
> 3498: h = 17;
> 3499: h = 37*h + range.hashCode();
> 3500: h = 37*h + Long.hashCode(Double.doubleToLongBits(weight));
Suggestion:
h = 37*h + Double.hashCode(weight);
These are equivalent.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24971#discussion_r2069218063
More information about the core-libs-dev
mailing list