116 lines
4.5 KiB
Java
116 lines
4.5 KiB
Java
package com.google.common.collect;
|
|
|
|
import com.google.common.base.Preconditions;
|
|
import java.io.IOException;
|
|
import java.io.ObjectInputStream;
|
|
import java.io.ObjectOutputStream;
|
|
import java.lang.Enum;
|
|
import java.util.EnumMap;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class EnumHashBiMap<K extends Enum<K>, V> extends AbstractBiMap<K, V> {
|
|
private static final long serialVersionUID = 0;
|
|
private transient Class<K> keyType;
|
|
|
|
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.ForwardingMap, java.util.Map
|
|
public final /* bridge */ /* synthetic */ void clear() {
|
|
super.clear();
|
|
}
|
|
|
|
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.ForwardingMap, java.util.Map
|
|
public final /* bridge */ /* synthetic */ boolean containsValue(Object obj) {
|
|
return super.containsValue(obj);
|
|
}
|
|
|
|
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.ForwardingMap, java.util.Map
|
|
public final /* bridge */ /* synthetic */ Set entrySet() {
|
|
return super.entrySet();
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.BiMap
|
|
public final /* bridge */ /* synthetic */ Object forcePut(Object obj, Object obj2) {
|
|
return forcePut((EnumHashBiMap<K, V>) obj, (Enum) obj2);
|
|
}
|
|
|
|
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.BiMap
|
|
public final /* bridge */ /* synthetic */ BiMap inverse() {
|
|
return super.inverse();
|
|
}
|
|
|
|
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.ForwardingMap, java.util.Map
|
|
public final /* bridge */ /* synthetic */ Set keySet() {
|
|
return super.keySet();
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.ForwardingMap, java.util.Map, com.google.common.collect.BiMap
|
|
public final /* bridge */ /* synthetic */ Object put(Object obj, Object obj2) {
|
|
return put((EnumHashBiMap<K, V>) obj, (Enum) obj2);
|
|
}
|
|
|
|
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.ForwardingMap, java.util.Map, com.google.common.collect.BiMap
|
|
public final /* bridge */ /* synthetic */ void putAll(Map map) {
|
|
super.putAll(map);
|
|
}
|
|
|
|
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.ForwardingMap, java.util.Map
|
|
public final /* bridge */ /* synthetic */ Object remove(Object obj) {
|
|
return super.remove(obj);
|
|
}
|
|
|
|
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.ForwardingMap, java.util.Map
|
|
public final /* bridge */ /* synthetic */ Set values() {
|
|
return super.values();
|
|
}
|
|
|
|
public static <K extends Enum<K>, V> EnumHashBiMap<K, V> create(Class<K> cls) {
|
|
return new EnumHashBiMap<>(cls);
|
|
}
|
|
|
|
public static <K extends Enum<K>, V> EnumHashBiMap<K, V> create(Map<K, ? extends V> map) {
|
|
EnumHashBiMap<K, V> create = create(EnumBiMap.inferKeyType(map));
|
|
create.putAll(map);
|
|
return create;
|
|
}
|
|
|
|
private EnumHashBiMap(Class<K> cls) {
|
|
super(new EnumMap(cls), Maps.newHashMapWithExpectedSize(cls.getEnumConstants().length));
|
|
this.keyType = cls;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
@Override // com.google.common.collect.AbstractBiMap
|
|
public final K checkKey(K k) {
|
|
return (K) Preconditions.checkNotNull(k);
|
|
}
|
|
|
|
public final V put(K k, V v) {
|
|
return (V) super.put((EnumHashBiMap<K, V>) k, (K) v);
|
|
}
|
|
|
|
public final V forcePut(K k, V v) {
|
|
return (V) super.forcePut((EnumHashBiMap<K, V>) k, (K) v);
|
|
}
|
|
|
|
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
|
|
objectOutputStream.defaultWriteObject();
|
|
objectOutputStream.writeObject(this.keyType);
|
|
Serialization.writeMap(this, objectOutputStream);
|
|
}
|
|
|
|
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
|
|
objectInputStream.defaultReadObject();
|
|
this.keyType = (Class) objectInputStream.readObject();
|
|
setDelegates(new EnumMap(this.keyType), new HashMap((this.keyType.getEnumConstants().length * 3) / 2));
|
|
Serialization.populateMap(this, objectInputStream);
|
|
}
|
|
|
|
public final Class<K> keyType() {
|
|
return this.keyType;
|
|
}
|
|
}
|