@Override
    public boolean equals(Object object) {
        if (this == object) {
            return true;
        }
        if (object instanceof Set) {
            Set<?> set = (Set<?>) object;
            if (size() != set.size()) {
                return false;
            }

            try {
                for (int i = 0; i < mSize; i++) {
                    E mine = valueAt(i);
                    if (!set.contains(mine)) {
                        return false;
                    }
                }
            } catch (NullPointerException ignored) {
                return false;
            } catch (ClassCastException ignored) {
                return false;
            }
            return true;
        }
        return false;
    }
{@inheritDoc}

<p>This implementation returns false if the object is not a set, or
if the sets have different sizes.  Otherwise, for each value in this
set, it checks to make sure the value also exists in the other set.
If any value doesn't exist, the method returns false; otherwise, it
returns true.
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/util/collection/ArraySet.java