package t8; import com.google.android.gms.ads.RequestConfiguration; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.NoSuchElementException; import java.util.Set; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public abstract class u extends t { public static final Object j(Iterable iterable) { d9.j.e(iterable, ""); if (iterable instanceof List) { return k((List) iterable); } Iterator it = iterable.iterator(); if (it.hasNext()) { return it.next(); } throw new NoSuchElementException("Collection is empty."); } public static final Object k(List list) { d9.j.e(list, ""); if (list.isEmpty()) { throw new NoSuchElementException("List is empty."); } return list.get(0); } public static final Appendable l(Iterable iterable, Appendable appendable, CharSequence charSequence, CharSequence charSequence2, CharSequence charSequence3, int i10, CharSequence charSequence4, c9.l lVar) { d9.j.e(iterable, ""); d9.j.e(appendable, "buffer"); d9.j.e(charSequence, "separator"); d9.j.e(charSequence2, "prefix"); d9.j.e(charSequence3, "postfix"); d9.j.e(charSequence4, "truncated"); appendable.append(charSequence2); int i11 = 0; for (Object obj : iterable) { i11++; if (i11 > 1) { appendable.append(charSequence); } if (i10 >= 0 && i11 > i10) { break; } j9.f.a(appendable, obj, lVar); } if (i10 >= 0 && i11 > i10) { appendable.append(charSequence4); } appendable.append(charSequence3); return appendable; } public static final String m(Iterable iterable, CharSequence charSequence, CharSequence charSequence2, CharSequence charSequence3, int i10, CharSequence charSequence4, c9.l lVar) { d9.j.e(iterable, ""); d9.j.e(charSequence, "separator"); d9.j.e(charSequence2, "prefix"); d9.j.e(charSequence3, "postfix"); d9.j.e(charSequence4, "truncated"); String sb = ((StringBuilder) l(iterable, new StringBuilder(), charSequence, charSequence2, charSequence3, i10, charSequence4, lVar)).toString(); d9.j.d(sb, "joinTo(StringBuilder(), …ed, transform).toString()"); return sb; } public static /* synthetic */ String n(Iterable iterable, CharSequence charSequence, CharSequence charSequence2, CharSequence charSequence3, int i10, CharSequence charSequence4, c9.l lVar, int i11, Object obj) { if ((i11 & 1) != 0) { charSequence = ", "; } int i12 = i11 & 2; CharSequence charSequence5 = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED; CharSequence charSequence6 = i12 != 0 ? RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED : charSequence2; if ((i11 & 4) == 0) { charSequence5 = charSequence3; } int i13 = (i11 & 8) != 0 ? -1 : i10; if ((i11 & 16) != 0) { charSequence4 = "..."; } CharSequence charSequence7 = charSequence4; if ((i11 & 32) != 0) { lVar = null; } return m(iterable, charSequence, charSequence6, charSequence5, i13, charSequence7, lVar); } public static List o(Collection collection, Iterable iterable) { d9.j.e(collection, ""); d9.j.e(iterable, "elements"); if (!(iterable instanceof Collection)) { ArrayList arrayList = new ArrayList(collection); r.i(arrayList, iterable); return arrayList; } Collection collection2 = (Collection) iterable; ArrayList arrayList2 = new ArrayList(collection.size() + collection2.size()); arrayList2.addAll(collection); arrayList2.addAll(collection2); return arrayList2; } public static List p(Iterable iterable, int i10) { d9.j.e(iterable, ""); int i11 = 0; if (!(i10 >= 0)) { throw new IllegalArgumentException(("Requested element count " + i10 + " is less than zero.").toString()); } if (i10 == 0) { return m.d(); } if (iterable instanceof Collection) { if (i10 >= ((Collection) iterable).size()) { return t(iterable); } if (i10 == 1) { return l.b(j(iterable)); } } ArrayList arrayList = new ArrayList(i10); Iterator it = iterable.iterator(); while (it.hasNext()) { arrayList.add(it.next()); i11++; if (i11 == i10) { break; } } return m.f(arrayList); } public static byte[] q(Collection collection) { d9.j.e(collection, ""); byte[] bArr = new byte[collection.size()]; Iterator it = collection.iterator(); int i10 = 0; while (it.hasNext()) { bArr[i10] = ((Number) it.next()).byteValue(); i10++; } return bArr; } public static final Collection r(Iterable iterable, Collection collection) { d9.j.e(iterable, ""); d9.j.e(collection, "destination"); Iterator it = iterable.iterator(); while (it.hasNext()) { collection.add(it.next()); } return collection; } public static int[] s(Collection collection) { d9.j.e(collection, ""); int[] iArr = new int[collection.size()]; Iterator it = collection.iterator(); int i10 = 0; while (it.hasNext()) { iArr[i10] = ((Number) it.next()).intValue(); i10++; } return iArr; } public static List t(Iterable iterable) { d9.j.e(iterable, ""); if (!(iterable instanceof Collection)) { return m.f(u(iterable)); } Collection collection = (Collection) iterable; int size = collection.size(); if (size == 0) { return m.d(); } if (size != 1) { return v(collection); } return l.b(iterable instanceof List ? ((List) iterable).get(0) : iterable.iterator().next()); } public static final List u(Iterable iterable) { d9.j.e(iterable, ""); return iterable instanceof Collection ? v((Collection) iterable) : (List) r(iterable, new ArrayList()); } public static final List v(Collection collection) { d9.j.e(collection, ""); return new ArrayList(collection); } public static Set w(Iterable iterable) { int a10; d9.j.e(iterable, ""); if (!(iterable instanceof Collection)) { return i0.c((Set) r(iterable, new LinkedHashSet())); } Collection collection = (Collection) iterable; int size = collection.size(); if (size == 0) { return i0.b(); } if (size == 1) { return h0.a(iterable instanceof List ? ((List) iterable).get(0) : iterable.iterator().next()); } a10 = c0.a(collection.size()); return (Set) r(iterable, new LinkedHashSet(a10)); } /* JADX WARN: Code restructure failed: missing block: B:13:0x0031, code lost: r5 = g9.f.c(r10, r0 - r2); */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ public static java.util.List x(java.lang.Iterable r9, int r10, int r11, boolean r12) { /* java.lang.String r0 = "" d9.j.e(r9, r0) t8.j0.a(r10, r11) boolean r0 = r9 instanceof java.util.RandomAccess r1 = 0 if (r0 == 0) goto L55 boolean r0 = r9 instanceof java.util.List if (r0 == 0) goto L55 java.util.List r9 = (java.util.List) r9 int r0 = r9.size() int r2 = r0 / r11 int r3 = r0 % r11 r4 = 1 if (r3 != 0) goto L20 r3 = 0 goto L21 L20: r3 = 1 L21: int r2 = r2 + r3 java.util.ArrayList r3 = new java.util.ArrayList r3.(r2) r2 = 0 L28: if (r2 < 0) goto L2e if (r2 >= r0) goto L2e r5 = 1 goto L2f L2e: r5 = 0 L2f: if (r5 == 0) goto L54 int r5 = r0 - r2 int r5 = g9.d.c(r10, r5) if (r5 >= r10) goto L3b if (r12 == 0) goto L54 L3b: java.util.ArrayList r6 = new java.util.ArrayList r6.(r5) r7 = 0 L41: if (r7 >= r5) goto L4f int r8 = r7 + r2 java.lang.Object r8 = r9.get(r8) r6.add(r8) int r7 = r7 + 1 goto L41 L4f: r3.add(r6) int r2 = r2 + r11 goto L28 L54: return r3 L55: java.util.ArrayList r0 = new java.util.ArrayList r0.() java.util.Iterator r9 = r9.iterator() java.util.Iterator r9 = t8.j0.b(r9, r10, r11, r12, r1) L62: boolean r10 = r9.hasNext() if (r10 == 0) goto L72 java.lang.Object r10 = r9.next() java.util.List r10 = (java.util.List) r10 r0.add(r10) goto L62 L72: return r0 */ throw new UnsupportedOperationException("Method not decompiled: t8.u.x(java.lang.Iterable, int, int, boolean):java.util.List"); } }