package o; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; import java.util.NoSuchElementException; import java.util.Set; /* renamed from: o.gat, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public class C14879gat extends C14876gaq { public static final int d(T[] tArr, T t) { C14957gcv.e(tArr, ""); int i = 0; if (t == null) { int length = tArr.length; while (i < length) { if (tArr[i] == null) { return i; } i++; } return -1; } int length2 = tArr.length; while (i < length2) { if (C14957gcv.b(t, tArr[i])) { return i; } i++; } return -1; } public static final int e(byte[] bArr, byte b) { C14957gcv.e(bArr, ""); int length = bArr.length; for (int i = 0; i < length; i++) { if (b == bArr[i]) { return i; } } return -1; } public static final T c(T[] tArr, AbstractC14971gdc abstractC14971gdc) { C14957gcv.e(tArr, ""); C14957gcv.e(abstractC14971gdc, ""); if (tArr.length == 0) { throw new NoSuchElementException("Array is empty."); } return tArr[abstractC14971gdc.a(tArr.length)]; } public static final char d(char[] cArr) { C14957gcv.e(cArr, ""); int length = cArr.length; if (length == 0) { throw new NoSuchElementException("Array is empty."); } if (length == 1) { return cArr[0]; } throw new IllegalArgumentException("Array has more than one element."); } public static final , T> C d(T[] tArr, C c) { C14957gcv.e(tArr, ""); C14957gcv.e(c, ""); for (T t : tArr) { if (t != null) { c.add(t); } } return c; } public static final > T[] a(T[] tArr) { C14957gcv.e(tArr, ""); if (tArr.length == 0) { return tArr; } Object[] copyOf = Arrays.copyOf(tArr, tArr.length); C14957gcv.c(copyOf, ""); T[] tArr2 = (T[]) ((Comparable[]) copyOf); C14957gcv.e(tArr2, ""); if (tArr2.length > 1) { Arrays.sort(tArr2); } return tArr2; } public static final > C b(T[] tArr, C c) { C14957gcv.e(tArr, ""); C14957gcv.e(c, ""); for (T t : tArr) { c.add(t); } return c; } public static final List d(T[] tArr) { C14957gcv.e(tArr, ""); int length = tArr.length; if (length == 0) { return C14851gaI.c; } if (length != 1) { C14957gcv.e(tArr, ""); C14957gcv.e(tArr, ""); return new ArrayList(new C14873gan(tArr, false)); } List singletonList = Collections.singletonList(tArr[0]); C14957gcv.c(singletonList, ""); return singletonList; } public static final List b(T[] tArr) { C14957gcv.e(tArr, ""); C14957gcv.e(tArr, ""); return new ArrayList(new C14873gan(tArr, false)); } public static final Set e(T[] tArr) { C14957gcv.e(tArr, ""); int length = tArr.length; if (length == 0) { return gaH.e; } if (length != 1) { return (Set) C14875gap.b(tArr, new LinkedHashSet(C14856gaP.a(tArr.length))); } Set singleton = Collections.singleton(tArr[0]); C14957gcv.c(singleton, ""); return singleton; } public static final String b(T[] tArr, CharSequence charSequence, CharSequence charSequence2, CharSequence charSequence3, CharSequence charSequence4) { C14957gcv.e(tArr, ""); C14957gcv.e(charSequence, ""); C14957gcv.e(charSequence2, ""); C14957gcv.e(charSequence3, ""); C14957gcv.e(charSequence4, ""); StringBuilder sb = new StringBuilder(); C14957gcv.e(tArr, ""); C14957gcv.e(sb, ""); C14957gcv.e(charSequence, ""); C14957gcv.e(charSequence2, ""); C14957gcv.e(charSequence3, ""); C14957gcv.e(charSequence4, ""); sb.append(charSequence2); int i = 0; for (T t : tArr) { i++; if (i > 1) { sb.append(charSequence); } gdZ.e(sb, t, (InterfaceC14894gbR) null); } sb.append(charSequence3); String obj = sb.toString(); C14957gcv.c((Object) obj, ""); return obj; } public static /* synthetic */ String a(byte[] bArr, CharSequence charSequence, InterfaceC14894gbR interfaceC14894gbR) { C14957gcv.e(bArr, ""); C14957gcv.e(charSequence, ""); C14957gcv.e(r1, ""); C14957gcv.e(r2, ""); C14957gcv.e(r3, ""); StringBuilder sb = new StringBuilder(); C14957gcv.e(bArr, ""); C14957gcv.e(sb, ""); C14957gcv.e(charSequence, ""); C14957gcv.e(r1, ""); C14957gcv.e(r2, ""); C14957gcv.e(r3, ""); sb.append((CharSequence) r1); int i = 0; for (byte b : bArr) { i++; if (i > 1) { sb.append(charSequence); } if (interfaceC14894gbR != null) { sb.append((CharSequence) interfaceC14894gbR.invoke(Byte.valueOf(b))); } else { sb.append((CharSequence) String.valueOf((int) b)); } } sb.append((CharSequence) r2); String obj = sb.toString(); C14957gcv.c((Object) obj, ""); return obj; } }