<i18n dev> RFR: 8355391: Use Long::hashCode in java.time

Shaojin Wen swen at openjdk.org
Wed Apr 30 17:32:45 UTC 2025


On Wed, 30 Apr 2025 06:46:07 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:

> Replace manual bitwise operations in `hashCode` implementations of `java.time` with `Long::hashCode`.

There is a place in java.util.Locale::hashCode that can also be changed
Current version

long bitsWeight = Double.doubleToLongBits(weight);
h = 37*h + (int)(bitsWeight ^ (bitsWeight >>> 32));


Can be changed to

h = 37*h + Long.hashCode(Double.doubleToLongBits(weight));

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

PR Comment: https://git.openjdk.org/jdk/pull/24959#issuecomment-2842775815


More information about the i18n-dev mailing list