package com.google.android.libraries.places.internal; import java.util.AbstractList; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.RandomAccess; /* loaded from: classes2.dex */ public final class zzafn extends zzadr implements RandomAccess, zzafo { public static final zzafo zza; private static final zzafn zzb; private final List zzc; static { zzafn zzafnVar = new zzafn(10); zzb = zzafnVar; zzafnVar.zzb(); zza = zzafnVar; } public zzafn() { this(10); } private static String zzi(Object obj) { if (obj instanceof String) { return (String) obj; } if (obj instanceof zzaed) { return ((zzaed) obj).zzm(zzafh.zzb); } return zzafh.zzg((byte[]) obj); } @Override // com.google.android.libraries.places.internal.zzadr, java.util.AbstractList, java.util.List public final /* synthetic */ void add(int i, Object obj) { zza(); this.zzc.add(i, (String) obj); ((AbstractList) this).modCount++; } @Override // com.google.android.libraries.places.internal.zzadr, java.util.AbstractList, java.util.List public final boolean addAll(int i, Collection collection) { zza(); if (collection instanceof zzafo) { collection = ((zzafo) collection).zzh(); } boolean addAll = this.zzc.addAll(i, collection); ((AbstractList) this).modCount++; return addAll; } @Override // com.google.android.libraries.places.internal.zzadr, java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List public final void clear() { zza(); this.zzc.clear(); ((AbstractList) this).modCount++; } @Override // com.google.android.libraries.places.internal.zzadr, java.util.AbstractList, java.util.List public final /* synthetic */ Object remove(int i) { zza(); Object remove = this.zzc.remove(i); ((AbstractList) this).modCount++; return zzi(remove); } @Override // com.google.android.libraries.places.internal.zzadr, java.util.AbstractList, java.util.List public final /* synthetic */ Object set(int i, Object obj) { zza(); return zzi(this.zzc.set(i, (String) obj)); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.List public final int size() { return this.zzc.size(); } @Override // com.google.android.libraries.places.internal.zzafo public final zzafo zzd() { return zzc() ? new zzahn(this) : this; } @Override // com.google.android.libraries.places.internal.zzafo public final Object zze(int i) { return this.zzc.get(i); } @Override // com.google.android.libraries.places.internal.zzafg public final /* synthetic */ zzafg zzf(int i) { if (i < size()) { throw new IllegalArgumentException(); } ArrayList arrayList = new ArrayList(i); arrayList.addAll(this.zzc); return new zzafn(arrayList); } @Override // java.util.AbstractList, java.util.List /* renamed from: zzg, reason: merged with bridge method [inline-methods] */ public final String get(int i) { Object obj = this.zzc.get(i); if (obj instanceof String) { return (String) obj; } if (obj instanceof zzaed) { zzaed zzaedVar = (zzaed) obj; String zzm = zzaedVar.zzm(zzafh.zzb); if (zzaedVar.zzi()) { this.zzc.set(i, zzm); } return zzm; } byte[] bArr = (byte[]) obj; String zzg = zzafh.zzg(bArr); if (zzafh.zzh(bArr)) { this.zzc.set(i, zzg); } return zzg; } @Override // com.google.android.libraries.places.internal.zzafo public final List zzh() { return Collections.unmodifiableList(this.zzc); } public zzafn(int i) { this.zzc = new ArrayList(i); } private zzafn(ArrayList arrayList) { this.zzc = arrayList; } @Override // com.google.android.libraries.places.internal.zzadr, java.util.AbstractCollection, java.util.Collection, java.util.List public final boolean addAll(Collection collection) { return addAll(size(), collection); } }