Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e288e180 authored by Jeff Brown's avatar Jeff Brown Committed by Android (Google) Code Review
Browse files

Merge "Implement equals() and hashCode() like a good little object." into jb-mr1-dev

parents 722565a6 94838913
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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.