@Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Set)) return false;

        if (o instanceof RangeSet) {
            RangeSet other = (RangeSet) o;
            return this.from == other.from && this.to == other.to;
        }

        Set<?> otherSet = (Set<?>) o;
        if (otherSet.size() != this.size()) return false;

        for (int i = from; i < to; i++) {
            if (!otherSet.contains(i)) return false;
        }
        return true;
    }
Compares the specified object with this set for equality.
Returns {@code true} if the specified object is also a set,
the two sets have the same size, and every member of the specified
set is contained in this set.

@param o object to be compared for equality with this set
@return {@code true} if the specified object is equal to this set
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/assignor/RangeSet.java