forgot to check length()

This commit is contained in:
Alexey Kudravtsev
2016-08-24 12:55:08 +03:00
parent b7dccaf434
commit 03a35a3f0a
2 changed files with 1 additions and 17 deletions
@@ -93,22 +93,6 @@ public class DiffString extends CharArrayCharSequence {
System.arraycopy(myChars, myStart, dst, start, length());
}
@Override
public boolean equals(@Nullable Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DiffString that = (DiffString)o;
if (length() != that.length()) return false;
if (hashCode() != that.hashCode()) return false;
for (int i = 0; i < length(); i++) {
if (data(i) != that.data(i)) return false;
}
return true;
}
@Nullable
public static DiffString concatenateNullable(@Nullable DiffString s1, @Nullable DiffString s2) {
if (s1 == null || s2 == null) {
@@ -78,7 +78,7 @@ public class CharArrayCharSequence implements CharSequenceBackedByArray, CharSeq
if (this == anObject) {
return true;
}
if (anObject == null || getClass() != anObject.getClass()) {
if (anObject == null || getClass() != anObject.getClass() || length() != ((CharSequence)anObject).length()) {
return false;
}
return CharArrayUtil.regionMatches(myChars, myStart, myEnd, (CharSequence)anObject);