use sorted flag in hashcode/equals
This commit is contained in:
@@ -645,10 +645,14 @@ public final class IntList implements Serializable, Cloneable {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
||||
if (size == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* only consider values in the range of 0 to size
|
||||
*/
|
||||
int result = 1;
|
||||
for (int i = 0; i < size; i++) {
|
||||
result = 31 * result + data[i];
|
||||
@@ -672,7 +676,13 @@ public final class IntList implements Serializable, Cloneable {
|
||||
if (size != other.size) {
|
||||
return false;
|
||||
}
|
||||
if (sorted != other.sorted) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* only consider values in the range of 0 to size
|
||||
*/
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (data[i] != other.data[i]) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user