ICU-8268 equals(Object o) methods assume that o is the correct type.

X-SVN-Rev: 30736
This commit is contained in:
Abhinav Gupta 2011-09-28 20:30:06 +00:00
parent 6916271396
commit 7048d48b6e
2 changed files with 9 additions and 3 deletions

View file

@ -2055,7 +2055,9 @@ public class DateTimePatternGenerator implements Freezable<DateTimePatternGenera
}
public boolean equals(Object other) {
if (other == null) return false;
if (!(other instanceof DateTimeMatcher)) {
return false;
}
DateTimeMatcher that = (DateTimeMatcher) other;
for (int i = 0; i < original.length; ++i) {
if (!original[i].equals(that.original[i])) return false;

View file

@ -731,8 +731,12 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
* @stable ICU 2.0
*/
public boolean equals(Object obj) {
if (obj == null) return false;
if (this == obj) return true;
if (!(obj instanceof DecimalFormatSymbols)) {
return false;
}
if (this == obj) {
return true;
}
DecimalFormatSymbols other = (DecimalFormatSymbols) obj;
for (int i = 0; i <= CURRENCY_SPC_INSERT; i++) {
if (!currencySpcBeforeSym[i].equals(other.currencySpcBeforeSym[i])) {