package com.google.android.gms.common.server.converter; import android.os.Parcel; import android.os.Parcelable; import android.util.SparseArray; import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; import com.google.android.gms.common.internal.safeparcel.SafeParcelWriter; import com.google.android.gms.common.server.response.FastJsonResponse; import java.util.ArrayList; import java.util.HashMap; /* loaded from: classes.dex */ public final class StringToIntConverter extends AbstractSafeParcelable implements FastJsonResponse.FieldConverter { public static final Parcelable.Creator CREATOR = new zad(); final int zaa; private final HashMap zab; private final SparseArray zac; public StringToIntConverter() { this.zaa = 1; this.zab = new HashMap<>(); this.zac = new SparseArray<>(); } public final StringToIntConverter add(String str, int i) { this.zab.put(str, Integer.valueOf(i)); this.zac.put(i, str); return this; } @Override // android.os.Parcelable public final void writeToParcel(Parcel parcel, int i) { int beginObjectHeader = SafeParcelWriter.beginObjectHeader(parcel); SafeParcelWriter.writeInt(parcel, 1, this.zaa); ArrayList arrayList = new ArrayList(); for (String str : this.zab.keySet()) { arrayList.add(new zac(str, this.zab.get(str).intValue())); } SafeParcelWriter.writeTypedList(parcel, 2, arrayList, false); SafeParcelWriter.finishObjectHeader(parcel, beginObjectHeader); } @Override // com.google.android.gms.common.server.response.FastJsonResponse.FieldConverter public final int zaa() { return 7; } @Override // com.google.android.gms.common.server.response.FastJsonResponse.FieldConverter public final int zab() { return 0; } @Override // com.google.android.gms.common.server.response.FastJsonResponse.FieldConverter public final /* synthetic */ Integer zac(String str) { Integer num = this.zab.get(str); return num == null ? this.zab.get("gms_unknown") : num; } @Override // com.google.android.gms.common.server.response.FastJsonResponse.FieldConverter public final /* synthetic */ String zad(Integer num) { String str = this.zac.get(num.intValue()); return (str == null && this.zab.containsKey("gms_unknown")) ? "gms_unknown" : str; } /* JADX INFO: Access modifiers changed from: package-private */ public StringToIntConverter(int i, ArrayList arrayList) { this.zaa = i; this.zab = new HashMap<>(); this.zac = new SparseArray<>(); int size = arrayList.size(); for (int i2 = 0; i2 < size; i2++) { zac zacVar = arrayList.get(i2); add(zacVar.zab, zacVar.zac); } } }