package o; import android.content.SharedPreferences; import android.content.res.Resources; import java.util.ArrayList; import java.util.Collection; import java.util.Comparator; import java.util.Iterator; import java.util.List; /* renamed from: o.Bq, reason: case insensitive filesystem */ /* loaded from: classes3.dex */ public final class C0220Bq extends C16157lj { /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ @InterfaceC13391fZD public C0220Bq(Resources resources, SharedPreferences sharedPreferences) { super(resources, sharedPreferences); C14957gcv.e(resources, ""); C14957gcv.e(sharedPreferences, ""); } public final C1101Vq a(List list, boolean z) { Object obj; String str; C14957gcv.e(list, ""); List list2 = list; C14957gcv.e(list2, ""); ArrayList arrayList = new ArrayList(list2 instanceof Collection ? list2.size() : 10); for (PiE piE : list2) { if (b()) { str = piE.c; } else { str = piE.b; } arrayList.add(new C1102Vr(str, piE.a)); } List a = C14881gav.a((Iterable) arrayList, (Comparator) new Sts()); C14957gcv.e(a, ""); ArrayList arrayList2 = new ArrayList(a); if (z) { Iterator it = arrayList2.iterator(); while (true) { if (!it.hasNext()) { obj = null; break; } obj = it.next(); if (gdZ.a(((C1102Vr) obj).e, "th", true)) { break; } } C1102Vr c1102Vr = (C1102Vr) obj; if (c1102Vr != null) { arrayList2.remove(c1102Vr); arrayList2.add(0, c1102Vr); } } return new C1101Vq(arrayList2, b()); } /* renamed from: o.Bq$Sts */ /* loaded from: classes3.dex */ public static final class Sts implements Comparator { /* JADX WARN: Multi-variable type inference failed */ @Override // java.util.Comparator public final int compare(T t, T t2) { String str = ((C1102Vr) t).c; String str2 = ((C1102Vr) t2).c; if (str == str2) { return 0; } if (str == null) { return -1; } if (str2 == null) { return 1; } return str.compareTo(str2); } } }