Keeping task list stable across multiple task switches

Change-Id: I3b334a8c8fb13ad54bc19e782cae016fe3c78ff6
This commit is contained in:
Sunny Goyal
2019-01-03 14:33:29 -08:00
parent 2f979d2639
commit 849d7e6c41
6 changed files with 148 additions and 2 deletions

View File

@@ -99,6 +99,14 @@ public class IntArray implements Cloneable {
mSize += count;
}
/**
* Sets the array to be same as {@param other}
*/
public void copyFrom(IntArray other) {
clear();
addAll(other);
}
/**
* Ensures capacity to append at least <code>count</code> values.
*/
@@ -127,6 +135,25 @@ public class IntArray implements Cloneable {
return wrap(toArray());
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof IntArray) {
IntArray arr = (IntArray) obj;
if (mSize == arr.mSize) {
for (int i = 0; i < mSize; i++) {
if (arr.mValues[i] != mValues[i]) {
return false;
}
}
return true;
}
}
return false;
}
/**
* Returns the value at the specified position in this array.
*/