144 lines
3.7 KiB
Java
144 lines
3.7 KiB
Java
package com.google.android.gms.internal.firebase_ml;
|
|
|
|
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 zzvi<K, V> extends LinkedHashMap<K, V> {
|
|
private static final zzvi zzbqs;
|
|
private boolean zzbkd;
|
|
|
|
private zzvi() {
|
|
this.zzbkd = true;
|
|
}
|
|
|
|
private zzvi(Map<K, V> map) {
|
|
super(map);
|
|
this.zzbkd = true;
|
|
}
|
|
|
|
public final void zza(zzvi<K, V> zzviVar) {
|
|
zzsd();
|
|
if (zzviVar.isEmpty()) {
|
|
return;
|
|
}
|
|
putAll(zzviVar);
|
|
}
|
|
|
|
@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() {
|
|
zzsd();
|
|
super.clear();
|
|
}
|
|
|
|
@Override // java.util.HashMap, java.util.AbstractMap, java.util.Map
|
|
public final V put(K k, V v) {
|
|
zzsd();
|
|
zzug.checkNotNull(k);
|
|
zzug.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) {
|
|
zzsd();
|
|
for (K k : map.keySet()) {
|
|
zzug.checkNotNull(k);
|
|
zzug.checkNotNull(map.get(k));
|
|
}
|
|
super.putAll(map);
|
|
}
|
|
|
|
@Override // java.util.HashMap, java.util.AbstractMap, java.util.Map
|
|
public final V remove(Object obj) {
|
|
zzsd();
|
|
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 zzt(Object obj) {
|
|
if (obj instanceof byte[]) {
|
|
return zzug.hashCode((byte[]) obj);
|
|
}
|
|
if (obj instanceof zzuh) {
|
|
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 += zzt(entry.getValue()) ^ zzt(entry.getKey());
|
|
}
|
|
return i;
|
|
}
|
|
|
|
public final zzvi<K, V> zzsc() {
|
|
return isEmpty() ? new zzvi<>() : new zzvi<>(this);
|
|
}
|
|
|
|
private final void zzsd() {
|
|
if (!this.zzbkd) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
}
|
|
|
|
static {
|
|
zzvi zzviVar = new zzvi();
|
|
zzbqs = zzviVar;
|
|
zzviVar.zzbkd = false;
|
|
}
|
|
|
|
public final void zzpt() {
|
|
this.zzbkd = false;
|
|
}
|
|
|
|
public final boolean isMutable() {
|
|
return this.zzbkd;
|
|
}
|
|
|
|
public static <K, V> zzvi<K, V> zzsb() {
|
|
return zzbqs;
|
|
}
|
|
}
|