Skip to content

Commit

Permalink
8262927: Explicitly state fields examined for BigDecimal.hashCode
Browse files Browse the repository at this point in the history
Reviewed-by: bpb
  • Loading branch information
jddarcy committed Mar 3, 2021
1 parent b397472 commit 2848938
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/java.base/share/classes/java/math/BigDecimal.java
Original file line number Diff line number Diff line change
Expand Up @@ -3215,8 +3215,13 @@ public BigDecimal max(BigDecimal val) {
// Hash Function

/**
* Returns the hash code for this {@code BigDecimal}. Note that
* two {@code BigDecimal} objects that are numerically equal but
* Returns the hash code for this {@code BigDecimal}.
* The hash code is computed as a function of the {@linkplain
* unscaledValue() unscaled value} and the {@linkplain scale()
* scale} of this {@code BigDecimal}.
*
* @apiNote
* Two {@code BigDecimal} objects that are numerically equal but
* differ in scale (like 2.0 and 2.00) will generally <em>not</em>
* have the same hash code.
*
Expand Down

1 comment on commit 2848938

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.