mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8311188: Simplify and modernize equals and hashCode in java.text
Reviewed-by: lancea, naoto, rriggs
This commit is contained in:
parent
1fc726a8b3
commit
1dfb0fb3e2
15 changed files with 72 additions and 98 deletions
|
@ -497,6 +497,7 @@ public class ChoiceFormat extends NumberFormat {
|
|||
/**
|
||||
* Generates a hash code for the message format object.
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = choiceLimits.length;
|
||||
if (choiceFormats.length > 0) {
|
||||
|
@ -509,11 +510,11 @@ public class ChoiceFormat extends NumberFormat {
|
|||
/**
|
||||
* Equality comparison between two
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) return false;
|
||||
if (this == obj) // quick check
|
||||
return true;
|
||||
if (getClass() != obj.getClass())
|
||||
if (obj == null || getClass() != obj.getClass())
|
||||
return false;
|
||||
ChoiceFormat other = (ChoiceFormat) obj;
|
||||
return (Arrays.equals(choiceLimits, other.choiceLimits)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue