package com.fyber.inneractive.sdk.protobuf; import com.fyber.inneractive.sdk.protobuf.y; import java.nio.charset.Charset; import java.util.AbstractList; import java.util.Arrays; import java.util.Collection; import java.util.RandomAccess; /* loaded from: classes2.dex */ public final class x extends c implements y.g, RandomAccess, x0 { public static final x d; public int[] b; public int c; static { x xVar = new x(new int[0], 0); d = xVar; xVar.a = false; } public x() { this(new int[10], 0); } @Override // java.util.AbstractList, java.util.List public final void add(int i, Object obj) { int i2; int intValue = ((Integer) obj).intValue(); e(); if (i < 0 || i > (i2 = this.c)) { StringBuilder a = com.fyber.inneractive.sdk.bidder.h.a("Index:", i, ", Size:"); a.append(this.c); throw new IndexOutOfBoundsException(a.toString()); } int[] iArr = this.b; if (i2 < iArr.length) { System.arraycopy(iArr, i, iArr, i + 1, i2 - i); } else { int[] iArr2 = new int[((i2 * 3) / 2) + 1]; System.arraycopy(iArr, 0, iArr2, 0, i); System.arraycopy(this.b, i, iArr2, i + 1, this.c - i); this.b = iArr2; } this.b[i] = intValue; this.c++; ((AbstractList) this).modCount++; } @Override // com.fyber.inneractive.sdk.protobuf.c, java.util.AbstractCollection, java.util.Collection, java.util.List public final boolean addAll(Collection collection) { e(); Charset charset = y.a; collection.getClass(); if (!(collection instanceof x)) { return super.addAll(collection); } x xVar = (x) collection; int i = xVar.c; if (i == 0) { return false; } int i2 = this.c; if (Integer.MAX_VALUE - i2 < i) { throw new OutOfMemoryError(); } int i3 = i2 + i; int[] iArr = this.b; if (i3 > iArr.length) { this.b = Arrays.copyOf(iArr, i3); } System.arraycopy(xVar.b, 0, this.b, this.c, xVar.c); this.c = i3; ((AbstractList) this).modCount++; return true; } public final void c(int i) { e(); int i2 = this.c; int[] iArr = this.b; if (i2 == iArr.length) { int[] iArr2 = new int[((i2 * 3) / 2) + 1]; System.arraycopy(iArr, 0, iArr2, 0, i2); this.b = iArr2; } int[] iArr3 = this.b; int i3 = this.c; this.c = i3 + 1; iArr3[i3] = i; } @Override // java.util.AbstractCollection, java.util.Collection, java.util.List public final boolean contains(Object obj) { return indexOf(obj) != -1; } @Override // com.fyber.inneractive.sdk.protobuf.c, java.util.AbstractList, java.util.Collection, java.util.List public final boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof x)) { return super.equals(obj); } x xVar = (x) obj; if (this.c != xVar.c) { return false; } int[] iArr = xVar.b; for (int i = 0; i < this.c; i++) { if (this.b[i] != iArr[i]) { return false; } } return true; } @Override // java.util.AbstractList, java.util.List public final Object get(int i) { return Integer.valueOf(d(i)); } @Override // java.util.AbstractList, java.util.List public final int indexOf(Object obj) { if (!(obj instanceof Integer)) { return -1; } int intValue = ((Integer) obj).intValue(); int i = this.c; for (int i2 = 0; i2 < i; i2++) { if (this.b[i2] == intValue) { return i2; } } return -1; } @Override // com.fyber.inneractive.sdk.protobuf.c, java.util.AbstractList, java.util.List public final Object remove(int i) { int i2; e(); if (i < 0 || i >= (i2 = this.c)) { StringBuilder a = com.fyber.inneractive.sdk.bidder.h.a("Index:", i, ", Size:"); a.append(this.c); throw new IndexOutOfBoundsException(a.toString()); } int[] iArr = this.b; int i3 = iArr[i]; if (i < i2 - 1) { System.arraycopy(iArr, i + 1, iArr, i, (i2 - i) - 1); } this.c--; ((AbstractList) this).modCount++; return Integer.valueOf(i3); } @Override // java.util.AbstractList public final void removeRange(int i, int i2) { e(); if (i2 < i) { throw new IndexOutOfBoundsException("toIndex < fromIndex"); } int[] iArr = this.b; System.arraycopy(iArr, i2, iArr, i, this.c - i2); this.c -= i2 - i; ((AbstractList) this).modCount++; } @Override // java.util.AbstractList, java.util.List public final Object set(int i, Object obj) { int intValue = ((Integer) obj).intValue(); e(); if (i < 0 || i >= this.c) { StringBuilder a = com.fyber.inneractive.sdk.bidder.h.a("Index:", i, ", Size:"); a.append(this.c); throw new IndexOutOfBoundsException(a.toString()); } int[] iArr = this.b; int i2 = iArr[i]; iArr[i] = intValue; return Integer.valueOf(i2); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.List public final int size() { return this.c; } public x(int[] iArr, int i) { this.b = iArr; this.c = i; } public final int d(int i) { if (i >= 0 && i < this.c) { return this.b[i]; } StringBuilder a = com.fyber.inneractive.sdk.bidder.h.a("Index:", i, ", Size:"); a.append(this.c); throw new IndexOutOfBoundsException(a.toString()); } @Override // com.fyber.inneractive.sdk.protobuf.c, java.util.AbstractList, java.util.Collection, java.util.List public final int hashCode() { int i = 1; for (int i2 = 0; i2 < this.c; i2++) { i = (i * 31) + this.b[i2]; } return i; } @Override // com.fyber.inneractive.sdk.protobuf.y.j /* renamed from: e, reason: merged with bridge method [inline-methods] */ public final x a(int i) { if (i >= this.c) { return new x(Arrays.copyOf(this.b, i), this.c); } throw new IllegalArgumentException(); } @Override // com.fyber.inneractive.sdk.protobuf.c, java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List public final boolean add(Object obj) { c(((Integer) obj).intValue()); return true; } }