package com.bumptech.glide.load.data;

import com.bumptech.glide.load.data.e;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/* loaded from: classes4.dex */
public class f {

    /* renamed from: b, reason: collision with root package name */
    private static final e.a f12584b = new a();

    /* renamed from: a, reason: collision with root package name */
    private final Map f12585a = new HashMap();

    /* loaded from: classes4.dex */
    class a implements e.a {
        a() {
        }

        @Override // com.bumptech.glide.load.data.e.a
        public Class a() {
            throw new UnsupportedOperationException("Not implemented");
        }

        @Override // com.bumptech.glide.load.data.e.a
        public e b(Object obj) {
            return new b(obj);
        }
    }

    /* loaded from: classes4.dex */
    private static final class b implements e {

        /* renamed from: a, reason: collision with root package name */
        private final Object f12586a;

        b(Object obj) {
            this.f12586a = obj;
        }

        @Override // com.bumptech.glide.load.data.e
        public Object a() {
            return this.f12586a;
        }

        @Override // com.bumptech.glide.load.data.e
        public void b() {
        }
    }

    public synchronized e a(Object obj) {
        e.a aVar;
        ei.k.d(obj);
        aVar = (e.a) this.f12585a.get(obj.getClass());
        if (aVar == null) {
            Iterator it = this.f12585a.values().iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                e.a aVar2 = (e.a) it.next();
                if (aVar2.a().isAssignableFrom(obj.getClass())) {
                    aVar = aVar2;
                    break;
                }
            }
        }
        if (aVar == null) {
            aVar = f12584b;
        }
        return aVar.b(obj);
    }

    public synchronized void b(e.a aVar) {
        this.f12585a.put(aVar.a(), aVar);
    }
}
