package com.bumptech.glide.provider; import com.bumptech.glide.load.ResourceDecoder; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; /* loaded from: classes.dex */ public class ResourceDecoderRegistry { private final List a = new ArrayList(); private final Map>> b = new HashMap(); private static class Entry { private final Class a; final Class b; final ResourceDecoder c; public Entry(Class cls, Class cls2, ResourceDecoder resourceDecoder) { this.a = cls; this.b = cls2; this.c = resourceDecoder; } public boolean a(Class cls, Class cls2) { return this.a.isAssignableFrom(cls) && cls2.isAssignableFrom(this.b); } } public synchronized void a(List list) { ArrayList arrayList = new ArrayList(this.a); this.a.clear(); this.a.addAll(list); for (String str : arrayList) { if (!list.contains(str)) { this.a.add(str); } } } public synchronized List> b(Class cls, Class cls2) { ArrayList arrayList; arrayList = new ArrayList(); Iterator it = this.a.iterator(); while (it.hasNext()) { List> list = this.b.get(it.next()); if (list != null) { for (Entry entry : list) { if (entry.a(cls, cls2) && !arrayList.contains(entry.b)) { arrayList.add(entry.b); } } } } return arrayList; } public synchronized List> a(Class cls, Class cls2) { ArrayList arrayList; arrayList = new ArrayList(); Iterator it = this.a.iterator(); while (it.hasNext()) { List> list = this.b.get(it.next()); if (list != null) { for (Entry entry : list) { if (entry.a(cls, cls2)) { arrayList.add(entry.c); } } } } return arrayList; } public synchronized void a(String str, ResourceDecoder resourceDecoder, Class cls, Class cls2) { a(str).add(new Entry<>(cls, cls2, resourceDecoder)); } private synchronized List> a(String str) { List> list; if (!this.a.contains(str)) { this.a.add(str); } list = this.b.get(str); if (list == null) { list = new ArrayList<>(); this.b.put(str, list); } return list; } }