package com.google.android.gms.internal.vision; import java.util.Iterator; import java.util.List; import java.util.Map; /* JADX INFO: Add missing generic type declarations: [V, K] */ /* loaded from: classes2.dex */ final class zzih implements Iterator> { private int pos; private Iterator> zzaak; private final zzhz zzaal; private boolean zzaap; private zzih(zzhz zzhzVar) { this.zzaal = zzhzVar; this.pos = -1; } @Override // java.util.Iterator public final boolean hasNext() { List list; Map map; int i = this.pos + 1; list = this.zzaal.zzaaf; if (i >= list.size()) { map = this.zzaal.zzaag; if (map.isEmpty() || !zzgz().hasNext()) { return false; } } return true; } @Override // java.util.Iterator public final void remove() { List list; if (!this.zzaap) { throw new IllegalStateException("remove() was called before next()"); } this.zzaap = false; this.zzaal.zzgx(); int i = this.pos; list = this.zzaal.zzaaf; if (i >= list.size()) { zzgz().remove(); return; } zzhz zzhzVar = this.zzaal; int i2 = this.pos; this.pos = i2 - 1; zzhzVar.zzbq(i2); } private final Iterator> zzgz() { Map map; if (this.zzaak == null) { map = this.zzaal.zzaag; this.zzaak = map.entrySet().iterator(); } return this.zzaak; } @Override // java.util.Iterator public final /* synthetic */ Object next() { List list; List list2; this.zzaap = true; int i = this.pos + 1; this.pos = i; list = this.zzaal.zzaaf; if (i >= list.size()) { return zzgz().next(); } list2 = this.zzaal.zzaaf; return (Map.Entry) list2.get(this.pos); } /* JADX INFO: Access modifiers changed from: package-private */ public /* synthetic */ zzih(zzhz zzhzVar, zzia zziaVar) { this(zzhzVar); } }