package gnu.trove; import java.util.ConcurrentModificationException; import java.util.NoSuchElementException; /* loaded from: classes2.dex */ abstract class TIterator { protected final THash a; protected int b; protected int c; public TIterator(THash tHash) { this.a = tHash; this.b = this.a.size(); this.c = this.a.capacity(); } protected final void a() { int nextIndex = nextIndex(); this.c = nextIndex; if (nextIndex < 0) { throw new NoSuchElementException(); } } public boolean hasNext() { return nextIndex() >= 0; } protected abstract int nextIndex(); public void remove() { if (this.b != this.a.size()) { throw new ConcurrentModificationException(); } this.a.stopCompactingOnRemove(); try { this.a.removeAt(this.c); this.a.startCompactingOnRemove(false); this.b--; } catch (Throwable th) { this.a.startCompactingOnRemove(false); throw th; } } }