package com.google.common.collect;

import com.google.common.annotations.GwtCompatible;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

/* JADX INFO: Access modifiers changed from: package-private */
/* JADX INFO: loaded from: classes2.dex */
@GwtCompatible
@ElementTypesAreNonnullByDefault
public abstract class AbstractMapBasedMultimap<K, V> extends t implements Serializable {
    private static final long serialVersionUID = 2447537837011683357L;

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

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

    @Override // com.google.common.collect.e1
    public Collection a() {
        Collection collection = this.f23725a;
        if (collection != null) {
            return collection;
        }
        Collection collectionJ = j();
        this.f23725a = collectionJ;
        return collectionJ;
    }

    @Override // com.google.common.collect.e1
    public void clear() {
        Iterator<V> it = this.f23568e.values().iterator();
        while (it.hasNext()) {
            ((Collection) it.next()).clear();
        }
        this.f23568e.clear();
        this.f23569f = 0;
    }

    @Override // com.google.common.collect.t
    public final Iterator e() {
        return new c(this, 1);
    }

    @Override // com.google.common.collect.t
    public final Iterator g() {
        return new c(this, 0);
    }

    public Map h() {
        return new f(this, this.f23568e);
    }

    public abstract Collection i();

    public final Collection j() {
        return this instanceof l1 ? new r(this, 1) : new s(this, 1);
    }

    public Set k() {
        return new h(this, this.f23568e);
    }

    public final Collection l() {
        return new s(this, 0);
    }

    public final void m(Map map) {
        this.f23568e = map;
        this.f23569f = 0;
        for (V v10 : map.values()) {
            com.google.common.base.h.d(!v10.isEmpty());
            this.f23569f = v10.size() + this.f23569f;
        }
    }

    @Override // com.google.common.collect.e1
    public int size() {
        return this.f23569f;
    }

    @Override // com.google.common.collect.e1
    public Collection values() {
        Collection collection = this.f23727c;
        if (collection != null) {
            return collection;
        }
        Collection collectionL = l();
        this.f23727c = collectionL;
        return collectionL;
    }
}
