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

import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

/* JADX INFO: loaded from: classes2.dex */
abstract class zzgsv extends or1 implements Serializable {

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final transient Map f19755d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public transient int f19756e;

    public zzgsv(Map map) {
        ih1.x(map.isEmpty());
        this.f19755d = map;
    }

    @Override // com.google.android.gms.internal.ads.or1
    public final Collection b() {
        return new nr1(this);
    }

    @Override // com.google.android.gms.internal.ads.or1
    public final Iterator d() {
        return new ar1(this);
    }

    public final boolean h(Double d10, Integer num) {
        Map map = this.f19755d;
        Collection collection = (Collection) map.get(d10);
        if (collection != null) {
            if (!collection.add(num)) {
                return false;
            }
            this.f19756e++;
            return true;
        }
        List list = (List) ((zzgvv) this).f19784f.zza();
        if (!list.add(num)) {
            throw new AssertionError("New Collection violated the Collection spec");
        }
        this.f19756e++;
        map.put(d10, list);
        return true;
    }

    @Override // com.google.android.gms.internal.ads.os1
    public final int zzd() {
        return this.f19756e;
    }

    @Override // com.google.android.gms.internal.ads.os1
    public final void zzf() {
        Map map = this.f19755d;
        Iterator it = map.values().iterator();
        while (it.hasNext()) {
            ((Collection) it.next()).clear();
        }
        map.clear();
        this.f19756e = 0;
    }
}
