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 f0 extends c implements y.i, RandomAccess, x0 { public static final f0 d; public long[] b; public int c; static { f0 f0Var = new f0(new long[0], 0); d = f0Var; f0Var.a = false; } public f0() { this(new long[10], 0); } @Override // java.util.AbstractList, java.util.List public final void add(int i, Object obj) { int i2; long longValue = ((Long) obj).longValue(); 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()); } long[] jArr = this.b; if (i2 < jArr.length) { System.arraycopy(jArr, i, jArr, i + 1, i2 - i); } else { long[] jArr2 = new long[((i2 * 3) / 2) + 1]; System.arraycopy(jArr, 0, jArr2, 0, i); System.arraycopy(this.b, i, jArr2, i + 1, this.c - i); this.b = jArr2; } this.b[i] = longValue; 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 f0)) { return super.addAll(collection); } f0 f0Var = (f0) collection; int i = f0Var.c; if (i == 0) { return false; } int i2 = this.c; if (Integer.MAX_VALUE - i2 < i) { throw new OutOfMemoryError(); } int i3 = i2 + i; long[] jArr = this.b; if (i3 > jArr.length) { this.b = Arrays.copyOf(jArr, i3); } System.arraycopy(f0Var.b, 0, this.b, this.c, f0Var.c); this.c = i3; ((AbstractList) this).modCount++; return true; } @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 f0)) { return super.equals(obj); } f0 f0Var = (f0) obj; if (this.c != f0Var.c) { return false; } long[] jArr = f0Var.b; for (int i = 0; i < this.c; i++) { if (this.b[i] != jArr[i]) { return false; } } return true; } @Override // java.util.AbstractList, java.util.List public final int indexOf(Object obj) { if (!(obj instanceof Long)) { return -1; } long longValue = ((Long) obj).longValue(); int i = this.c; for (int i2 = 0; i2 < i; i2++) { if (this.b[i2] == longValue) { 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()); } long[] jArr = this.b; long j = jArr[i]; if (i < i2 - 1) { System.arraycopy(jArr, i + 1, jArr, i, (i2 - i) - 1); } this.c--; ((AbstractList) this).modCount++; return Long.valueOf(j); } @Override // java.util.AbstractList public final void removeRange(int i, int i2) { e(); if (i2 < i) { throw new IndexOutOfBoundsException("toIndex < fromIndex"); } long[] jArr = this.b; System.arraycopy(jArr, i2, jArr, 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) { long longValue = ((Long) obj).longValue(); 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()); } long[] jArr = this.b; long j = jArr[i]; jArr[i] = longValue; return Long.valueOf(j); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.List public final int size() { return this.c; } public f0(long[] jArr, int i) { this.b = jArr; this.c = i; } public final void a(long j) { e(); int i = this.c; long[] jArr = this.b; if (i == jArr.length) { long[] jArr2 = new long[((i * 3) / 2) + 1]; System.arraycopy(jArr, 0, jArr2, 0, i); this.b = jArr2; } long[] jArr3 = this.b; int i2 = this.c; this.c = i2 + 1; jArr3[i2] = j; } @Override // java.util.AbstractList, java.util.List public final Object get(int i) { if (i >= 0 && i < this.c) { return Long.valueOf(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) + y.a(this.b[i2]); } return i; } @Override // com.fyber.inneractive.sdk.protobuf.y.j /* renamed from: c, reason: merged with bridge method [inline-methods] */ public final f0 a(int i) { if (i >= this.c) { return new f0(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) { a(((Long) obj).longValue()); return true; } }