public boolean areEqual(Object o1, Object o2) {
if ((o1 instanceof String) && (o2 instanceof String))
return o1.equals(o2);
if ((o1 instanceof CharSequence) && (o2 instanceof String)) {
final CharSequence csq = (CharSequence) o1;
final String str = (String) o2;
final int length = str.length();
if (csq.length() != length)
return false;
for (int i = 0; i < length;) {
if (str.charAt(i) != csq.charAt(i++))
return false;
}
return true;
}
if ((o1 instanceof String) && (o2 instanceof CharSequence)) {
final CharSequence csq = (CharSequence) o2;
final String str = (String) o1;
final int length = str.length();
if (csq.length() != length)
return false;
for (int i = 0; i < length;) {
if (str.charAt(i) != csq.charAt(i++))
return false;
}
return true;
}
if ((o1 == null) || (o2 == null))
return o1 == o2;
final CharSequence csq1 = (CharSequence) o1;
final CharSequence csq2 = (CharSequence) o2;
final int length = csq1.length();
if (csq2.length() != length)
return false;
for (int i = 0; i < length;) {
if (csq1.charAt(i) != csq2.charAt(i++))
return false;
}
return true;
}