mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +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
|
@ -729,9 +729,9 @@ public class RuleBasedCollator extends Collator{
|
|||
* @return true if the current table-based collation object is the same
|
||||
* as the table-based collation object obj; false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) return false;
|
||||
if (!super.equals(obj)) return false; // super does class check
|
||||
if (!super.equals(obj)) return false; // super does null and class checks
|
||||
RuleBasedCollator other = (RuleBasedCollator) obj;
|
||||
// all other non-transient information is also contained in rules.
|
||||
return (getRules().equals(other.getRules()));
|
||||
|
@ -740,6 +740,7 @@ public class RuleBasedCollator extends Collator{
|
|||
/**
|
||||
* Generates the hash code for the table-based collation object
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getRules().hashCode();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue