package com.google.android.libraries.places.internal; import java.util.AbstractList; import java.util.Arrays; import java.util.RandomAccess; /* loaded from: classes2.dex */ final class zzagp extends zzadr implements RandomAccess { private static final zzagp zza; private Object[] zzb; private int zzc; static { zzagp zzagpVar = new zzagp(new Object[0], 0); zza = zzagpVar; zzagpVar.zzb(); } zzagp() { this(new Object[10], 0); } private final String zze(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 zzg(int i) { if (i < 0 || i >= this.zzc) { throw new IndexOutOfBoundsException(zze(i)); } } @Override // com.google.android.libraries.places.internal.zzadr, java.util.AbstractList, java.util.List public final void add(int i, Object obj) { int i2; zza(); if (i < 0 || i > (i2 = this.zzc)) { throw new IndexOutOfBoundsException(zze(i)); } Object[] objArr = this.zzb; if (i2 < objArr.length) { System.arraycopy(objArr, i, objArr, i + 1, i2 - i); } else { Object[] objArr2 = new Object[((i2 * 3) / 2) + 1]; System.arraycopy(objArr, 0, objArr2, 0, i); System.arraycopy(this.zzb, i, objArr2, i + 1, this.zzc - i); this.zzb = objArr2; } this.zzb[i] = obj; this.zzc++; ((AbstractList) this).modCount++; } @Override // java.util.AbstractList, java.util.List public final Object get(int i) { zzg(i); return this.zzb[i]; } @Override // com.google.android.libraries.places.internal.zzadr, java.util.AbstractList, java.util.List public final Object remove(int i) { zza(); zzg(i); Object[] objArr = this.zzb; Object obj = objArr[i]; if (i < this.zzc - 1) { System.arraycopy(objArr, i + 1, objArr, i, (r2 - i) - 1); } this.zzc--; ((AbstractList) this).modCount++; return obj; } @Override // com.google.android.libraries.places.internal.zzadr, java.util.AbstractList, java.util.List public final Object set(int i, Object obj) { zza(); zzg(i); Object[] objArr = this.zzb; Object obj2 = objArr[i]; objArr[i] = obj; ((AbstractList) this).modCount++; return obj2; } private zzagp(Object[] objArr, int i) { this.zzb = objArr; this.zzc = 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 zzagp(Arrays.copyOf(this.zzb, i), this.zzc); } @Override // com.google.android.libraries.places.internal.zzadr, java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List public final boolean add(Object obj) { zza(); int i = this.zzc; Object[] objArr = this.zzb; if (i == objArr.length) { this.zzb = Arrays.copyOf(objArr, ((i * 3) / 2) + 1); } Object[] objArr2 = this.zzb; int i2 = this.zzc; this.zzc = i2 + 1; objArr2[i2] = obj; ((AbstractList) this).modCount++; return true; } @Override // java.util.AbstractCollection, java.util.Collection, java.util.List public final int size() { return this.zzc; } public static zzagp zzd() { return zza; } }