package i.b.a.j;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Iterator;
import java.util.concurrent.locks.ReentrantLock;

/* JADX INFO: compiled from: IdentityScopeLong.java */
/* JADX INFO: loaded from: classes.dex */
public class b<T> implements a<Long, T> {
    private final i.b.a.k.c<Reference<T>> a = new i.b.a.k.c<>();

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final ReentrantLock f4265b = new ReentrantLock();

    @Override // i.b.a.j.a
    public void c(Iterable<Long> iterable) {
        this.f4265b.lock();
        try {
            Iterator<Long> it = iterable.iterator();
            while (it.hasNext()) {
                this.a.d(it.next().longValue());
            }
        } finally {
            this.f4265b.unlock();
        }
    }

    @Override // i.b.a.j.a
    public void clear() {
        this.f4265b.lock();
        try {
            this.a.a();
        } finally {
            this.f4265b.unlock();
        }
    }

    @Override // i.b.a.j.a
    public void e(int i2) {
        this.a.e(i2);
    }

    @Override // i.b.a.j.a
    /* JADX INFO: renamed from: f, reason: merged with bridge method [inline-methods] */
    public boolean b(Long l, T t) {
        boolean z;
        this.f4265b.lock();
        try {
            if (get(l) != t || t == null) {
                z = false;
            } else {
                remove(l);
                z = true;
            }
            return z;
        } finally {
            this.f4265b.unlock();
        }
    }

    @Override // i.b.a.j.a
    /* JADX INFO: renamed from: g, reason: merged with bridge method [inline-methods] */
    public T get(Long l) {
        return h(l.longValue());
    }

    public T h(long j2) {
        this.f4265b.lock();
        try {
            Reference<T> referenceB = this.a.b(j2);
            if (referenceB != null) {
                return referenceB.get();
            }
            return null;
        } finally {
            this.f4265b.unlock();
        }
    }

    public T i(long j2) {
        Reference<T> referenceB = this.a.b(j2);
        if (referenceB != null) {
            return referenceB.get();
        }
        return null;
    }

    @Override // i.b.a.j.a
    /* JADX INFO: renamed from: j, reason: merged with bridge method [inline-methods] */
    public T d(Long l) {
        return i(l.longValue());
    }

    @Override // i.b.a.j.a
    /* JADX INFO: renamed from: k, reason: merged with bridge method [inline-methods] */
    public void put(Long l, T t) {
        l(l.longValue(), t);
    }

    public void l(long j2, T t) {
        this.f4265b.lock();
        try {
            this.a.c(j2, new WeakReference(t));
        } finally {
            this.f4265b.unlock();
        }
    }

    @Override // i.b.a.j.a
    public void lock() {
        this.f4265b.lock();
    }

    public void m(long j2, T t) {
        this.a.c(j2, new WeakReference(t));
    }

    @Override // i.b.a.j.a
    /* JADX INFO: renamed from: n, reason: merged with bridge method [inline-methods] */
    public void a(Long l, T t) {
        m(l.longValue(), t);
    }

    @Override // i.b.a.j.a
    /* JADX INFO: renamed from: o, reason: merged with bridge method [inline-methods] */
    public void remove(Long l) {
        this.f4265b.lock();
        try {
            this.a.d(l.longValue());
        } finally {
            this.f4265b.unlock();
        }
    }

    @Override // i.b.a.j.a
    public void unlock() {
        this.f4265b.unlock();
    }
}
