144 lines
3.7 KiB
Java
144 lines
3.7 KiB
Java
package com.google.android.gms.internal.vision;
|
|
|
|
import java.util.Arrays;
|
|
import java.util.Collections;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class zzgz<K, V> extends LinkedHashMap<K, V> {
|
|
private static final zzgz zzyy;
|
|
private boolean zzrl;
|
|
|
|
private zzgz() {
|
|
this.zzrl = true;
|
|
}
|
|
|
|
private zzgz(Map<K, V> map) {
|
|
super(map);
|
|
this.zzrl = true;
|
|
}
|
|
|
|
public final void zza(zzgz<K, V> zzgzVar) {
|
|
zzga();
|
|
if (zzgzVar.isEmpty()) {
|
|
return;
|
|
}
|
|
putAll(zzgzVar);
|
|
}
|
|
|
|
@Override // java.util.LinkedHashMap, java.util.HashMap, java.util.AbstractMap, java.util.Map
|
|
public final Set<Map.Entry<K, V>> entrySet() {
|
|
return isEmpty() ? Collections.emptySet() : super.entrySet();
|
|
}
|
|
|
|
@Override // java.util.LinkedHashMap, java.util.HashMap, java.util.AbstractMap, java.util.Map
|
|
public final void clear() {
|
|
zzga();
|
|
super.clear();
|
|
}
|
|
|
|
@Override // java.util.HashMap, java.util.AbstractMap, java.util.Map
|
|
public final V put(K k, V v) {
|
|
zzga();
|
|
zzga.checkNotNull(k);
|
|
zzga.checkNotNull(v);
|
|
return (V) super.put(k, v);
|
|
}
|
|
|
|
@Override // java.util.HashMap, java.util.AbstractMap, java.util.Map
|
|
public final void putAll(Map<? extends K, ? extends V> map) {
|
|
zzga();
|
|
for (K k : map.keySet()) {
|
|
zzga.checkNotNull(k);
|
|
zzga.checkNotNull(map.get(k));
|
|
}
|
|
super.putAll(map);
|
|
}
|
|
|
|
@Override // java.util.HashMap, java.util.AbstractMap, java.util.Map
|
|
public final V remove(Object obj) {
|
|
zzga();
|
|
return (V) super.remove(obj);
|
|
}
|
|
|
|
@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<K, V> 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 = Arrays.equals((byte[]) value, (byte[]) obj2);
|
|
} else {
|
|
equals = value.equals(obj2);
|
|
}
|
|
if (!equals) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
private static int zzi(Object obj) {
|
|
if (obj instanceof byte[]) {
|
|
return zzga.hashCode((byte[]) obj);
|
|
}
|
|
if (obj instanceof zzgb) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
return obj.hashCode();
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public final int hashCode() {
|
|
int i = 0;
|
|
for (Map.Entry<K, V> entry : entrySet()) {
|
|
i += zzi(entry.getValue()) ^ zzi(entry.getKey());
|
|
}
|
|
return i;
|
|
}
|
|
|
|
public final zzgz<K, V> zzfz() {
|
|
return isEmpty() ? new zzgz<>() : new zzgz<>(this);
|
|
}
|
|
|
|
private final void zzga() {
|
|
if (!this.zzrl) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
}
|
|
|
|
static {
|
|
zzgz zzgzVar = new zzgz();
|
|
zzyy = zzgzVar;
|
|
zzgzVar.zzrl = false;
|
|
}
|
|
|
|
public final void zzci() {
|
|
this.zzrl = false;
|
|
}
|
|
|
|
public final boolean isMutable() {
|
|
return this.zzrl;
|
|
}
|
|
|
|
public static <K, V> zzgz<K, V> zzfy() {
|
|
return zzyy;
|
|
}
|
|
}
|