package com.google.android.gms.internal.measurement; import java.util.Arrays; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; /* loaded from: classes.dex */ public final class zzkw extends LinkedHashMap { private static final zzkw zza; private boolean zzb; static { zzkw zzkwVar = new zzkw(); zza = zzkwVar; zzkwVar.zzb = false; } private zzkw() { this.zzb = true; } private static int zzf(Object obj) { if (obj instanceof byte[]) { return zzkf.zzb((byte[]) obj); } if (obj instanceof zzjz) { throw new UnsupportedOperationException(); } return obj.hashCode(); } private final void zzg() { if (!this.zzb) { throw new UnsupportedOperationException(); } } @Override // java.util.LinkedHashMap, java.util.HashMap, java.util.AbstractMap, java.util.Map public final void clear() { zzg(); 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; } for (Map.Entry entry : entrySet()) { if (!map.containsKey(entry.getKey())) { return false; } V 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() { int i = 0; for (Map.Entry entry : entrySet()) { i += zzf(entry.getValue()) ^ zzf(entry.getKey()); } return i; } @Override // java.util.HashMap, java.util.AbstractMap, java.util.Map public final V put(K k, V v) { zzg(); zzkf.zze(k); zzkf.zze(v); return (V) super.put(k, v); } @Override // java.util.HashMap, java.util.AbstractMap, java.util.Map public final void putAll(Map map) { zzg(); for (K k : map.keySet()) { zzkf.zze(k); zzkf.zze(map.get(k)); } super.putAll(map); } @Override // java.util.HashMap, java.util.AbstractMap, java.util.Map public final V remove(Object obj) { zzg(); return (V) super.remove(obj); } public final zzkw zzb() { return isEmpty() ? new zzkw<>() : new zzkw<>(this); } public final void zzd(zzkw zzkwVar) { zzg(); if (zzkwVar.isEmpty()) { return; } putAll(zzkwVar); } private zzkw(Map map) { super(map); this.zzb = true; } public final boolean zze() { return this.zzb; } public final void zzc() { this.zzb = false; } public static zzkw zza() { return zza; } }