package com.google.android.libraries.places.internal; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; /* loaded from: classes2.dex */ public final class zzaga extends LinkedHashMap { private static final zzaga zza; private boolean zzb; static { zzaga zzagaVar = new zzaga(); zza = zzagaVar; zzagaVar.zzb = false; } private zzaga() { this.zzb = true; } private static int zze(Object obj) { if (obj instanceof byte[]) { return zzafh.zzb((byte[]) obj); } if (obj instanceof zzafa) { throw new UnsupportedOperationException(); } return obj.hashCode(); } private final void zzf() { if (!this.zzb) { throw new UnsupportedOperationException(); } } @Override // java.util.LinkedHashMap, java.util.HashMap, java.util.AbstractMap, java.util.Map public final void clear() { zzf(); super.clear(); } @Override // java.util.LinkedHashMap, java.util.HashMap, java.util.AbstractMap, java.util.Map public final Set entrySet() { return isEmpty() ? Collections.emptySet() : super.entrySet(); } @Override // java.util.AbstractMap, java.util.Map public final boolean equals(Object obj) { boolean equals; if (!(obj instanceof Map)) { return false; } Map map = (Map) obj; if (this == map) { return true; } if (size() != map.size()) { return false; } Iterator it = entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); if (!map.containsKey(entry.getKey())) { return false; } Object value = entry.getValue(); Object obj2 = map.get(entry.getKey()); if (!(value instanceof byte[]) || !(obj2 instanceof byte[])) { equals = value.equals(obj2); } else { equals = Arrays.equals((byte[]) value, (byte[]) obj2); } if (!equals) { return false; } } return true; } @Override // java.util.AbstractMap, java.util.Map public final int hashCode() { Iterator it = entrySet().iterator(); int i = 0; while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); i += zze(entry.getValue()) ^ zze(entry.getKey()); } return i; } @Override // java.util.HashMap, java.util.AbstractMap, java.util.Map public final Object put(Object obj, Object obj2) { zzf(); zzafh.zze(obj); zzafh.zze(obj2); return super.put(obj, obj2); } @Override // java.util.HashMap, java.util.AbstractMap, java.util.Map public final void putAll(Map map) { zzf(); for (Object obj : map.keySet()) { zzafh.zze(obj); zzafh.zze(map.get(obj)); } super.putAll(map); } @Override // java.util.HashMap, java.util.AbstractMap, java.util.Map public final Object remove(Object obj) { zzf(); return super.remove(obj); } public final zzaga zza() { return isEmpty() ? new zzaga() : new zzaga(this); } public final void zzc(zzaga zzagaVar) { zzf(); if (zzagaVar.isEmpty()) { return; } putAll(zzagaVar); } private zzaga(Map map) { super(map); this.zzb = true; } public final boolean zzd() { return this.zzb; } public final void zzb() { this.zzb = false; } }