package androidx.compose.runtime;

import androidx.compose.runtime.tooling.CompositionGroup;
import java.util.Iterator;

/* JADX INFO: loaded from: classes.dex */
final class GroupIterator implements Iterator<CompositionGroup>, K4.a {
    private final int end;
    private int index;
    private final SlotTable table;
    private final int version;

    public GroupIterator(SlotTable slotTable, int i6, int i7) {
        this.table = slotTable;
        this.end = i7;
        this.index = i6;
        this.version = slotTable.getVersion$runtime();
        if (slotTable.getWriter$runtime()) {
            SlotTableKt.throwConcurrentModificationException();
        }
    }

    private final void validateRead() {
        if (this.table.getVersion$runtime() != this.version) {
            SlotTableKt.throwConcurrentModificationException();
        }
    }

    public final int getEnd() {
        return this.end;
    }

    public final SlotTable getTable() {
        return this.table;
    }

    @Override // java.util.Iterator
    public boolean hasNext() {
        return this.index < this.end;
    }

    @Override // java.util.Iterator
    public void remove() {
        throw new UnsupportedOperationException("Operation is not supported for read-only collection");
    }

    /* JADX WARN: Can't rename method to resolve collision */
    @Override // java.util.Iterator
    public CompositionGroup next() {
        validateRead();
        int i6 = this.index;
        this.index = SlotTableKt.groupSize(this.table.getGroups(), i6) + i6;
        return new SlotTableGroup(this.table, i6, this.version);
    }
}
