what-the-bank/sources/com/google/common/collect/RegularImmutableBiMap.java

78 lines
3.0 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.google.common.collect;
import com.google.common.collect.RegularImmutableMap;
import java.util.Map;
/* loaded from: classes2.dex */
final class RegularImmutableBiMap<K, V> extends ImmutableBiMap<K, V> {
static final RegularImmutableBiMap<Object, Object> EMPTY = new RegularImmutableBiMap<>();
final transient Object[] alternatingKeysAndValues;
private final transient RegularImmutableBiMap<V, K> inverse;
private final transient Object keyHashTable;
private final transient int keyOffset;
private final transient int size;
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableMap
public final boolean isPartialView() {
return false;
}
@Override // com.google.common.collect.ImmutableBiMap, com.google.common.collect.BiMap
public final /* bridge */ /* synthetic */ BiMap inverse() {
return inverse();
}
/* JADX WARN: Multi-variable type inference failed */
private RegularImmutableBiMap() {
this.keyHashTable = null;
this.alternatingKeysAndValues = new Object[0];
this.keyOffset = 0;
this.size = 0;
this.inverse = this;
}
/* JADX INFO: Access modifiers changed from: package-private */
public RegularImmutableBiMap(Object[] objArr, int i) {
this.alternatingKeysAndValues = objArr;
this.size = i;
this.keyOffset = 0;
int chooseTableSize = i >= 2 ? ImmutableSet.chooseTableSize(i) : 0;
this.keyHashTable = RegularImmutableMap.createHashTable(objArr, i, chooseTableSize, 0);
this.inverse = new RegularImmutableBiMap<>(RegularImmutableMap.createHashTable(objArr, i, chooseTableSize, 1), objArr, i, this);
}
private RegularImmutableBiMap(Object obj, Object[] objArr, int i, RegularImmutableBiMap<V, K> regularImmutableBiMap) {
this.keyHashTable = obj;
this.alternatingKeysAndValues = objArr;
this.keyOffset = 1;
this.size = i;
this.inverse = regularImmutableBiMap;
}
@Override // com.google.common.collect.ImmutableMap, java.util.Map
public final V get(Object obj) {
return (V) RegularImmutableMap.get(this.keyHashTable, this.alternatingKeysAndValues, this.size, this.keyOffset, obj);
}
@Override // com.google.common.collect.ImmutableMap
final ImmutableSet<Map.Entry<K, V>> createEntrySet() {
return new RegularImmutableMap.EntrySet(this, this.alternatingKeysAndValues, this.keyOffset, this.size);
}
@Override // com.google.common.collect.ImmutableMap
final ImmutableSet<K> createKeySet() {
return new RegularImmutableMap.KeySet(this, new RegularImmutableMap.KeysOrValuesAsList(this.alternatingKeysAndValues, this.keyOffset, this.size));
}
@Override // java.util.Map
public final int size() {
return this.size;
}
@Override // com.google.common.collect.ImmutableBiMap, com.google.common.collect.BiMap
public final ImmutableBiMap<V, K> inverse() {
return this.inverse;
}
}