package com.google.android.gms.internal.firebase_ml; 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 zzwp implements Iterator> { private int pos; private Iterator> zzbse; private final zzwh zzbsf; private boolean zzbsj; private zzwp(zzwh zzwhVar) { this.zzbsf = zzwhVar; this.pos = -1; } @Override // java.util.Iterator public final boolean hasNext() { List list; Map map; int i = this.pos + 1; list = this.zzbsf.zzbrz; if (i >= list.size()) { map = this.zzbsf.zzbsa; if (map.isEmpty() || !zztc().hasNext()) { return false; } } return true; } @Override // java.util.Iterator public final void remove() { List list; if (!this.zzbsj) { throw new IllegalStateException("remove() was called before next()"); } this.zzbsj = false; this.zzbsf.zzta(); int i = this.pos; list = this.zzbsf.zzbrz; if (i >= list.size()) { zztc().remove(); return; } zzwh zzwhVar = this.zzbsf; int i2 = this.pos; this.pos = i2 - 1; zzwhVar.zzdq(i2); } private final Iterator> zztc() { Map map; if (this.zzbse == null) { map = this.zzbsf.zzbsa; this.zzbse = map.entrySet().iterator(); } return this.zzbse; } @Override // java.util.Iterator public final /* synthetic */ Object next() { List list; List list2; this.zzbsj = true; int i = this.pos + 1; this.pos = i; list = this.zzbsf.zzbrz; if (i >= list.size()) { return zztc().next(); } list2 = this.zzbsf.zzbrz; return (Map.Entry) list2.get(this.pos); } /* JADX INFO: Access modifiers changed from: package-private */ public /* synthetic */ zzwp(zzwh zzwhVar, zzwi zzwiVar) { this(zzwhVar); } }