package com.google.android.gms.internal.ads;

import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;

/* JADX INFO: loaded from: classes2.dex */
public final class ar1 implements Iterator {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final Iterator f9267a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public Collection f9268b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public Iterator f9269c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ zzgsv f9270d;

    public ar1(zzgsv zzgsvVar) {
        Objects.requireNonNull(zzgsvVar);
        this.f9270d = zzgsvVar;
        this.f9267a = zzgsvVar.f19755d.entrySet().iterator();
        this.f9268b = null;
        this.f9269c = zzguw.f19782a;
    }

    @Override // java.util.Iterator
    /* JADX INFO: renamed from: a, reason: merged with bridge method [inline-methods] */
    public final boolean hasNext() {
        return this.f9267a.hasNext() || this.f9269c.hasNext();
    }

    @Override // java.util.Iterator
    /* JADX INFO: renamed from: b, reason: merged with bridge method [inline-methods] */
    public final Object next() {
        if (!this.f9269c.hasNext()) {
            Map.Entry entry = (Map.Entry) this.f9267a.next();
            entry.getKey();
            Collection collection = (Collection) entry.getValue();
            this.f9268b = collection;
            this.f9269c = collection.iterator();
        }
        return this.f9269c.next();
    }

    @Override // java.util.Iterator
    /* JADX INFO: renamed from: c, reason: merged with bridge method [inline-methods] */
    public final void remove() {
        this.f9269c.remove();
        Collection collection = this.f9268b;
        Objects.requireNonNull(collection);
        if (collection.isEmpty()) {
            this.f9267a.remove();
        }
        zzgsv zzgsvVar = this.f9270d;
        zzgsvVar.f19756e--;
    }
}
