am e288e180: Merge "Implement equals() and hashCode() like a good little object." into jb-mr1-dev
* commit 'e288e180bb22ed14b6b55f7299af66a5a98106c8': Implement equals() and hashCode() like a good little object.
This commit is contained in:
@@ -76,6 +76,20 @@ public class WorkSource implements Parcelable {
|
||||
mNum = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return o instanceof WorkSource && !diff((WorkSource)o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = 0;
|
||||
for (int i = 0; i < mNum; i++) {
|
||||
result = ((result << 4) | (result >>> 28)) ^ mUids[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare this WorkSource with another.
|
||||
* @param other The WorkSource to compare against.
|
||||
|
||||
Reference in New Issue
Block a user