package o; import java.util.Comparator; /* loaded from: classes6.dex */ public final class gjN { public int b = 0; public final gjN b(Object obj, Object obj2, Comparator comparator) { int i; if (this.b != 0 || obj == obj2) { return this; } if (obj == null) { i = -1; } else { if (obj2 != null) { if (obj.getClass().isArray()) { a(obj, obj2, comparator); } else if (comparator == null) { this.b = ((Comparable) obj).compareTo(obj2); } else { this.b = comparator.compare(obj, obj2); } return this; } i = 1; } this.b = i; return this; } private void a(Object obj, Object obj2, Comparator comparator) { int i; int i2; int i3; int i4; int i5; int i6; int i7; int i8; int i9 = 0; if (obj instanceof long[]) { long[] jArr = (long[]) obj; long[] jArr2 = (long[]) obj2; if (this.b != 0 || jArr == jArr2) { return; } if (jArr == null) { this.b = -1; return; } if (jArr2 == null) { this.b = 1; return; } if (jArr.length != jArr2.length) { this.b = jArr.length >= jArr2.length ? 1 : -1; return; } while (i9 < jArr.length && (i8 = this.b) == 0) { long j = jArr[i9]; long j2 = jArr2[i9]; if (i8 == 0) { this.b = Long.compare(j, j2); } i9++; } return; } if (obj instanceof int[]) { int[] iArr = (int[]) obj; int[] iArr2 = (int[]) obj2; if (this.b != 0 || iArr == iArr2) { return; } if (iArr == null) { this.b = -1; return; } if (iArr2 == null) { this.b = 1; return; } if (iArr.length != iArr2.length) { this.b = iArr.length >= iArr2.length ? 1 : -1; return; } while (i9 < iArr.length && (i7 = this.b) == 0) { int i10 = iArr[i9]; int i11 = iArr2[i9]; if (i7 == 0) { this.b = Integer.compare(i10, i11); } i9++; } return; } if (obj instanceof short[]) { short[] sArr = (short[]) obj; short[] sArr2 = (short[]) obj2; if (this.b != 0 || sArr == sArr2) { return; } if (sArr == null) { this.b = -1; return; } if (sArr2 == null) { this.b = 1; return; } if (sArr.length != sArr2.length) { this.b = sArr.length >= sArr2.length ? 1 : -1; return; } while (i9 < sArr.length && (i6 = this.b) == 0) { short s = sArr[i9]; short s2 = sArr2[i9]; if (i6 == 0) { this.b = Short.compare(s, s2); } i9++; } return; } if (obj instanceof char[]) { char[] cArr = (char[]) obj; char[] cArr2 = (char[]) obj2; if (this.b != 0 || cArr == cArr2) { return; } if (cArr == null) { this.b = -1; return; } if (cArr2 == null) { this.b = 1; return; } if (cArr.length != cArr2.length) { this.b = cArr.length >= cArr2.length ? 1 : -1; return; } while (i9 < cArr.length && (i5 = this.b) == 0) { char c = cArr[i9]; char c2 = cArr2[i9]; if (i5 == 0) { this.b = Character.compare(c, c2); } i9++; } return; } if (obj instanceof byte[]) { byte[] bArr = (byte[]) obj; byte[] bArr2 = (byte[]) obj2; if (this.b != 0 || bArr == bArr2) { return; } if (bArr == null) { this.b = -1; return; } if (bArr2 == null) { this.b = 1; return; } if (bArr.length != bArr2.length) { this.b = bArr.length >= bArr2.length ? 1 : -1; return; } while (i9 < bArr.length && (i4 = this.b) == 0) { byte b = bArr[i9]; byte b2 = bArr2[i9]; if (i4 == 0) { this.b = Byte.compare(b, b2); } i9++; } return; } if (obj instanceof double[]) { double[] dArr = (double[]) obj; double[] dArr2 = (double[]) obj2; if (this.b != 0 || dArr == dArr2) { return; } if (dArr == null) { this.b = -1; return; } if (dArr2 == null) { this.b = 1; return; } if (dArr.length != dArr2.length) { this.b = dArr.length >= dArr2.length ? 1 : -1; return; } while (i9 < dArr.length && (i3 = this.b) == 0) { double d = dArr[i9]; double d2 = dArr2[i9]; if (i3 == 0) { this.b = Double.compare(d, d2); } i9++; } return; } if (obj instanceof float[]) { float[] fArr = (float[]) obj; float[] fArr2 = (float[]) obj2; if (this.b != 0 || fArr == fArr2) { return; } if (fArr == null) { this.b = -1; return; } if (fArr2 == null) { this.b = 1; return; } if (fArr.length != fArr2.length) { this.b = fArr.length >= fArr2.length ? 1 : -1; return; } while (i9 < fArr.length && (i2 = this.b) == 0) { float f = fArr[i9]; float f2 = fArr2[i9]; if (i2 == 0) { this.b = Float.compare(f, f2); } i9++; } return; } if (obj instanceof boolean[]) { boolean[] zArr = (boolean[]) obj; boolean[] zArr2 = (boolean[]) obj2; if (this.b != 0 || zArr == zArr2) { return; } if (zArr == null) { this.b = -1; return; } if (zArr2 == null) { this.b = 1; return; } if (zArr.length != zArr2.length) { this.b = zArr.length >= zArr2.length ? 1 : -1; return; } while (i9 < zArr.length && (i = this.b) == 0) { boolean z = zArr[i9]; boolean z2 = zArr2[i9]; if (i == 0 && z != z2) { if (z) { this.b = 1; } else { this.b = -1; } } i9++; } return; } Object[] objArr = (Object[]) obj; Object[] objArr2 = (Object[]) obj2; if (this.b != 0 || objArr == objArr2) { return; } if (objArr == null) { this.b = -1; return; } if (objArr2 == null) { this.b = 1; return; } if (objArr.length != objArr2.length) { this.b = objArr.length >= objArr2.length ? 1 : -1; return; } while (i9 < objArr.length && this.b == 0) { b(objArr[i9], objArr2[i9], comparator); i9++; } } }