package com.google.android.libraries.places.internal; import java.util.AbstractList; import java.util.Arrays; import java.util.Collection; import java.util.RandomAccess; /* loaded from: classes2.dex */ final class zzaez extends zzadr implements RandomAccess, zzafd, zzagn { private static final zzaez zza; private int[] zzb; private int zzc; static { zzaez zzaezVar = new zzaez(new int[0], 0); zza = zzaezVar; zzaezVar.zzb(); } zzaez() { this(new int[10], 0); } private final String zzg(int i) { int i2 = this.zzc; StringBuilder sb = new StringBuilder("Index:"); sb.append(i); sb.append(", Size:"); sb.append(i2); return sb.toString(); } private final void zzh(int i) { if (i < 0 || i >= this.zzc) { throw new IndexOutOfBoundsException(zzg(i)); } } @Override // com.google.android.libraries.places.internal.zzadr, java.util.AbstractList, java.util.List public final /* synthetic */ void add(int i, Object obj) { int i2; int intValue = ((Integer) obj).intValue(); zza(); if (i < 0 || i > (i2 = this.zzc)) { throw new IndexOutOfBoundsException(zzg(i)); } int[] iArr = this.zzb; 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.zzb, i, iArr2, i + 1, this.zzc - i); this.zzb = iArr2; } this.zzb[i] = intValue; this.zzc++; ((AbstractList) this).modCount++; } @Override // com.google.android.libraries.places.internal.zzadr, java.util.AbstractCollection, java.util.Collection, java.util.List public final boolean addAll(Collection collection) { zza(); zzafh.zze(collection); if (!(collection instanceof zzaez)) { return super.addAll(collection); } zzaez zzaezVar = (zzaez) collection; int i = zzaezVar.zzc; if (i == 0) { return false; } int i2 = this.zzc; if (Integer.MAX_VALUE - i2 < i) { throw new OutOfMemoryError(); } int i3 = i2 + i; int[] iArr = this.zzb; if (i3 > iArr.length) { this.zzb = Arrays.copyOf(iArr, i3); } System.arraycopy(zzaezVar.zzb, 0, this.zzb, this.zzc, zzaezVar.zzc); this.zzc = 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.google.android.libraries.places.internal.zzadr, java.util.AbstractList, java.util.Collection, java.util.List public final boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof zzaez)) { return super.equals(obj); } zzaez zzaezVar = (zzaez) obj; if (this.zzc != zzaezVar.zzc) { return false; } int[] iArr = zzaezVar.zzb; for (int i = 0; i < this.zzc; i++) { if (this.zzb[i] != iArr[i]) { return false; } } return true; } @Override // java.util.AbstractList, java.util.List public final /* synthetic */ Object get(int i) { zzh(i); return Integer.valueOf(this.zzb[i]); } @Override // com.google.android.libraries.places.internal.zzadr, java.util.AbstractList, java.util.Collection, java.util.List public final int hashCode() { int i = 1; for (int i2 = 0; i2 < this.zzc; i2++) { i = (i * 31) + this.zzb[i2]; } return 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.zzc; for (int i2 = 0; i2 < i; i2++) { if (this.zzb[i2] == intValue) { return i2; } } return -1; } @Override // com.google.android.libraries.places.internal.zzadr, java.util.AbstractList, java.util.List public final /* synthetic */ Object remove(int i) { zza(); zzh(i); int[] iArr = this.zzb; int i2 = iArr[i]; if (i < this.zzc - 1) { System.arraycopy(iArr, i + 1, iArr, i, (r2 - i) - 1); } this.zzc--; ((AbstractList) this).modCount++; return Integer.valueOf(i2); } @Override // java.util.AbstractList protected final void removeRange(int i, int i2) { zza(); if (i2 < i) { throw new IndexOutOfBoundsException("toIndex < fromIndex"); } int[] iArr = this.zzb; System.arraycopy(iArr, i2, iArr, i, this.zzc - i2); this.zzc -= i2 - i; ((AbstractList) this).modCount++; } @Override // com.google.android.libraries.places.internal.zzadr, java.util.AbstractList, java.util.List public final /* synthetic */ Object set(int i, Object obj) { int intValue = ((Integer) obj).intValue(); zza(); zzh(i); int[] iArr = this.zzb; int i2 = iArr[i]; iArr[i] = intValue; return Integer.valueOf(i2); } public final int zzd(int i) { zzh(i); return this.zzb[i]; } @Override // com.google.android.libraries.places.internal.zzafg public final /* synthetic */ zzafg zzf(int i) { if (i < this.zzc) { throw new IllegalArgumentException(); } return new zzaez(Arrays.copyOf(this.zzb, i), this.zzc); } private zzaez(int[] iArr, int i) { this.zzb = iArr; this.zzc = i; } @Override // com.google.android.libraries.places.internal.zzadr, java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List public final /* synthetic */ boolean add(Object obj) { int intValue = ((Integer) obj).intValue(); zza(); int i = this.zzc; int[] iArr = this.zzb; if (i == iArr.length) { int[] iArr2 = new int[((i * 3) / 2) + 1]; System.arraycopy(iArr, 0, iArr2, 0, i); this.zzb = iArr2; } int[] iArr3 = this.zzb; int i2 = this.zzc; this.zzc = i2 + 1; iArr3[i2] = intValue; return true; } @Override // java.util.AbstractCollection, java.util.Collection, java.util.List public final int size() { return this.zzc; } public static zzaez zze() { return zza; } }