@Override
    public Iterator<Integer> iterator() {
        return new Iterator<Integer>() {
            private int current = from;

            @Override
            public boolean hasNext() {
                return current < to;
            }

            @Override
            public Integer next() {
                if (!hasNext()) throw new NoSuchElementException();
                return current++;
            }
        };
    }
Constructs a {@code RangeSet} with the specified range.

@param from      The starting value (inclusive) of the range.
@param to        The ending value (exclusive) of the range.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/assignor/RangeSet.java