RFR: 8310813: Simplify and modernize equals, hashCode, and compareTo for BigInteger
Pavel Rappo
prappo at openjdk.org
Sat Jun 24 10:50:14 UTC 2023
On Fri, 23 Jun 2023 17:27:00 GMT, Pavel Rappo <prappo at openjdk.org> wrote:
> Please review this PR to use modern APIs and language features to simplify equals, hashCode, and compareTo for BigInteger. If you have any performance concerns, please raise them.
>
> This PR is cherry-picked from a bigger, not-yet-published PR, to test the waters. That latter PR will be published soon.
Note, that along with further improvements to `equals`, commit a9cbbe5, boldly suggests dropping `&` in `hashCode` to fold its implementation into a single call to a utility method.
Now, I'm not an expert, but the `test/jdk/java/math` tests pass. To my (non-expert) opinion, `&` was also dulling down `hashCode`; but I'm eager to hear comments from those who understand that more than I do.
Perhaps this PR needs to be accompanied by benchmarks.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14630#issuecomment-1605381393
More information about the core-libs-dev
mailing list