what-the-bank/sources/o/C14952gcq.java

105 lines
3.4 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
/* renamed from: o.gcq, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C14952gcq {
private static final Object[] e = new Object[0];
public static final Object[] c(Collection<?> collection) {
C14957gcv.e(collection, "");
int size = collection.size();
if (size != 0) {
Iterator<?> it = collection.iterator();
if (it.hasNext()) {
Object[] objArr = new Object[size];
int i = 0;
while (true) {
int i2 = i + 1;
objArr[i] = it.next();
if (i2 >= objArr.length) {
if (!it.hasNext()) {
return objArr;
}
int i3 = ((i2 * 3) + 1) >>> 1;
if (i3 <= i2) {
i3 = 2147483645;
if (i2 >= 2147483645) {
throw new OutOfMemoryError();
}
}
objArr = Arrays.copyOf(objArr, i3);
C14957gcv.c(objArr, "");
} else if (!it.hasNext()) {
Object[] copyOf = Arrays.copyOf(objArr, i2);
C14957gcv.c(copyOf, "");
return copyOf;
}
i = i2;
}
}
}
return e;
}
public static final Object[] d(Collection<?> collection, Object[] objArr) {
Object[] objArr2;
C14957gcv.e(collection, "");
int size = collection.size();
int i = 0;
if (size == 0) {
if (objArr.length <= 0) {
return objArr;
}
objArr[0] = null;
return objArr;
}
Iterator<?> it = collection.iterator();
if (!it.hasNext()) {
if (objArr.length <= 0) {
return objArr;
}
objArr[0] = null;
return objArr;
}
if (size <= objArr.length) {
objArr2 = objArr;
} else {
Object newInstance = Array.newInstance(objArr.getClass().getComponentType(), size);
C14957gcv.d(newInstance, "");
objArr2 = (Object[]) newInstance;
}
while (true) {
int i2 = i + 1;
objArr2[i] = it.next();
if (i2 >= objArr2.length) {
if (!it.hasNext()) {
return objArr2;
}
int i3 = ((i2 * 3) + 1) >>> 1;
if (i3 <= i2) {
i3 = 2147483645;
if (i2 >= 2147483645) {
throw new OutOfMemoryError();
}
}
objArr2 = Arrays.copyOf(objArr2, i3);
C14957gcv.c(objArr2, "");
} else if (!it.hasNext()) {
if (objArr2 == objArr) {
objArr[i2] = null;
return objArr;
}
Object[] copyOf = Arrays.copyOf(objArr2, i2);
C14957gcv.c(copyOf, "");
return copyOf;
}
i = i2;
}
}
}