package com.google.common.collect; import com.google.common.base.Equivalence; import com.google.common.base.Preconditions; import com.google.common.collect.MapMaker; import com.google.common.collect.MapMakerInternalMap.InternalEntry; import com.google.common.collect.MapMakerInternalMap.Segment; import com.google.common.primitives.Ints; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; import java.util.AbstractCollection; import java.util.AbstractMap; import java.util.AbstractSet; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.Map; import java.util.NoSuchElementException; import java.util.Set; import java.util.concurrent.CancellationException; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReferenceArray; import java.util.concurrent.locks.ReentrantLock; import javax.annotation.CheckForNull; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public class MapMakerInternalMap, S extends Segment> extends AbstractMap implements ConcurrentMap, Serializable { static final long CLEANUP_EXECUTOR_DELAY_SECS = 60; static final int CONTAINS_VALUE_RETRIES = 3; static final int DRAIN_MAX = 16; static final int DRAIN_THRESHOLD = 63; static final int MAXIMUM_CAPACITY = 1073741824; static final int MAX_SEGMENTS = 65536; static final WeakValueReference UNSET_WEAK_VALUE_REFERENCE = new WeakValueReference() { // from class: com.google.common.collect.MapMakerInternalMap.1 @Override // com.google.common.collect.MapMakerInternalMap.WeakValueReference public void clear() { } @Override // com.google.common.collect.MapMakerInternalMap.WeakValueReference public WeakValueReference copyFor(ReferenceQueue referenceQueue, DummyInternalEntry dummyInternalEntry) { return this; } @Override // com.google.common.collect.MapMakerInternalMap.WeakValueReference public Object get() { return null; } /* JADX WARN: Can't rename method to resolve collision */ @Override // com.google.common.collect.MapMakerInternalMap.WeakValueReference public DummyInternalEntry getEntry() { return null; } }; private static final long serialVersionUID = 5; final int concurrencyLevel; final transient InternalEntryHelper entryHelper; @CheckForNull transient Set> entrySet; final Equivalence keyEquivalence; @CheckForNull transient Set keySet; final transient int segmentMask; final transient int segmentShift; final transient Segment[] segments; @CheckForNull transient Collection values; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public interface InternalEntry> { int getHash(); K getKey(); E getNext(); V getValue(); } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public interface InternalEntryHelper, S extends Segment> { E copy(S s, E e, @CheckForNull E e2); Strength keyStrength(); E newEntry(S s, K k, int i, @CheckForNull E e); S newSegment(MapMakerInternalMap mapMakerInternalMap, int i, int i2); void setValue(S s, E e, V v); Strength valueStrength(); } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public enum Strength { STRONG { // from class: com.google.common.collect.MapMakerInternalMap.Strength.1 @Override // com.google.common.collect.MapMakerInternalMap.Strength Equivalence defaultEquivalence() { return Equivalence.equals(); } }, WEAK { // from class: com.google.common.collect.MapMakerInternalMap.Strength.2 @Override // com.google.common.collect.MapMakerInternalMap.Strength Equivalence defaultEquivalence() { return Equivalence.identity(); } }; /* JADX INFO: Access modifiers changed from: package-private */ public abstract Equivalence defaultEquivalence(); } /* loaded from: classes3.dex */ interface StrongValueEntry> extends InternalEntry { } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public interface WeakValueEntry> extends InternalEntry { void clearValue(); WeakValueReference getValueReference(); } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public interface WeakValueReference> { void clear(); WeakValueReference copyFor(ReferenceQueue referenceQueue, E e); @CheckForNull V get(); E getEntry(); } static int rehash(int i) { int i2 = i + ((i << 15) ^ (-12931)); int i3 = i2 ^ (i2 >>> 10); int i4 = i3 + (i3 << 3); int i5 = i4 ^ (i4 >>> 6); int i6 = i5 + (i5 << 2) + (i5 << 14); return i6 ^ (i6 >>> 16); } static > WeakValueReference unsetWeakValueReference() { return (WeakValueReference) UNSET_WEAK_VALUE_REFERENCE; } private MapMakerInternalMap(MapMaker mapMaker, InternalEntryHelper internalEntryHelper) { this.concurrencyLevel = Math.min(mapMaker.getConcurrencyLevel(), 65536); this.keyEquivalence = mapMaker.getKeyEquivalence(); this.entryHelper = internalEntryHelper; int min = Math.min(mapMaker.getInitialCapacity(), 1073741824); int i = 0; int i2 = 1; int i3 = 0; int i4 = 1; while (i4 < this.concurrencyLevel) { i3++; i4 <<= 1; } this.segmentShift = 32 - i3; this.segmentMask = i4 - 1; this.segments = newSegmentArray(i4); int i5 = min / i4; while (i2 < (i4 * i5 < min ? i5 + 1 : i5)) { i2 <<= 1; } while (true) { Segment[] segmentArr = this.segments; if (i >= segmentArr.length) { return; } segmentArr[i] = createSegment(i2, -1); i++; } } /* JADX INFO: Access modifiers changed from: package-private */ public static MapMakerInternalMap, ?> create(MapMaker mapMaker) { if (mapMaker.getKeyStrength() == Strength.STRONG && mapMaker.getValueStrength() == Strength.STRONG) { return new MapMakerInternalMap<>(mapMaker, StrongKeyStrongValueEntry.Helper.instance()); } if (mapMaker.getKeyStrength() == Strength.STRONG && mapMaker.getValueStrength() == Strength.WEAK) { return new MapMakerInternalMap<>(mapMaker, StrongKeyWeakValueEntry.Helper.instance()); } if (mapMaker.getKeyStrength() == Strength.WEAK && mapMaker.getValueStrength() == Strength.STRONG) { return new MapMakerInternalMap<>(mapMaker, WeakKeyStrongValueEntry.Helper.instance()); } if (mapMaker.getKeyStrength() == Strength.WEAK && mapMaker.getValueStrength() == Strength.WEAK) { return new MapMakerInternalMap<>(mapMaker, WeakKeyWeakValueEntry.Helper.instance()); } throw new AssertionError(); } /* JADX INFO: Access modifiers changed from: package-private */ public static MapMakerInternalMap, ?> createWithDummyValues(MapMaker mapMaker) { if (mapMaker.getKeyStrength() == Strength.STRONG && mapMaker.getValueStrength() == Strength.STRONG) { return new MapMakerInternalMap<>(mapMaker, StrongKeyDummyValueEntry.Helper.instance()); } if (mapMaker.getKeyStrength() == Strength.WEAK && mapMaker.getValueStrength() == Strength.STRONG) { return new MapMakerInternalMap<>(mapMaker, WeakKeyDummyValueEntry.Helper.instance()); } if (mapMaker.getValueStrength() == Strength.WEAK) { throw new IllegalArgumentException("Map cannot have both weak and dummy values"); } throw new AssertionError(); } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static abstract class AbstractStrongKeyEntry> implements InternalEntry { final int hash; final K key; @CheckForNull final E next; @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public int getHash() { return this.hash; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public K getKey() { return this.key; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public E getNext() { return this.next; } AbstractStrongKeyEntry(K k, int i, @CheckForNull E e) { this.key = k; this.hash = i; this.next = e; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static final class StrongKeyStrongValueEntry extends AbstractStrongKeyEntry> implements StrongValueEntry> { @CheckForNull private volatile V value; @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry @CheckForNull public V getValue() { return this.value; } void setValue(V v) { this.value = v; } StrongKeyStrongValueEntry(K k, int i, @CheckForNull StrongKeyStrongValueEntry strongKeyStrongValueEntry) { super(k, i, strongKeyStrongValueEntry); this.value = null; } StrongKeyStrongValueEntry copy(StrongKeyStrongValueEntry strongKeyStrongValueEntry) { StrongKeyStrongValueEntry strongKeyStrongValueEntry2 = new StrongKeyStrongValueEntry<>(this.key, this.hash, strongKeyStrongValueEntry); strongKeyStrongValueEntry2.value = this.value; return strongKeyStrongValueEntry2; } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static final class Helper implements InternalEntryHelper, StrongKeyStrongValueSegment> { private static final Helper INSTANCE = new Helper<>(); static Helper instance() { return (Helper) INSTANCE; } Helper() { } /* JADX WARN: Multi-variable type inference failed */ @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public /* bridge */ /* synthetic */ InternalEntry newEntry(Segment segment, Object obj, int i, @CheckForNull InternalEntry internalEntry) { return newEntry((StrongKeyStrongValueSegment, V>) segment, (StrongKeyStrongValueSegment) obj, i, (StrongKeyStrongValueEntry, V>) internalEntry); } /* JADX WARN: Multi-variable type inference failed */ @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public /* bridge */ /* synthetic */ void setValue(Segment segment, InternalEntry internalEntry, Object obj) { setValue((StrongKeyStrongValueSegment>) segment, (StrongKeyStrongValueEntry>) internalEntry, (StrongKeyStrongValueEntry) obj); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public Strength keyStrength() { return Strength.STRONG; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public Strength valueStrength() { return Strength.STRONG; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public StrongKeyStrongValueSegment newSegment(MapMakerInternalMap, StrongKeyStrongValueSegment> mapMakerInternalMap, int i, int i2) { return new StrongKeyStrongValueSegment<>(mapMakerInternalMap, i, i2); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public StrongKeyStrongValueEntry copy(StrongKeyStrongValueSegment strongKeyStrongValueSegment, StrongKeyStrongValueEntry strongKeyStrongValueEntry, @CheckForNull StrongKeyStrongValueEntry strongKeyStrongValueEntry2) { return strongKeyStrongValueEntry.copy(strongKeyStrongValueEntry2); } public void setValue(StrongKeyStrongValueSegment strongKeyStrongValueSegment, StrongKeyStrongValueEntry strongKeyStrongValueEntry, V v) { strongKeyStrongValueEntry.setValue(v); } public StrongKeyStrongValueEntry newEntry(StrongKeyStrongValueSegment strongKeyStrongValueSegment, K k, int i, @CheckForNull StrongKeyStrongValueEntry strongKeyStrongValueEntry) { return new StrongKeyStrongValueEntry<>(k, i, strongKeyStrongValueEntry); } } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static final class StrongKeyWeakValueEntry extends AbstractStrongKeyEntry> implements WeakValueEntry> { private volatile WeakValueReference> valueReference; @Override // com.google.common.collect.MapMakerInternalMap.WeakValueEntry public WeakValueReference> getValueReference() { return this.valueReference; } StrongKeyWeakValueEntry(K k, int i, @CheckForNull StrongKeyWeakValueEntry strongKeyWeakValueEntry) { super(k, i, strongKeyWeakValueEntry); this.valueReference = MapMakerInternalMap.unsetWeakValueReference(); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public V getValue() { return this.valueReference.get(); } @Override // com.google.common.collect.MapMakerInternalMap.WeakValueEntry public void clearValue() { this.valueReference.clear(); } void setValue(V v, ReferenceQueue referenceQueue) { WeakValueReference> weakValueReference = this.valueReference; this.valueReference = new WeakValueReferenceImpl(referenceQueue, v, this); weakValueReference.clear(); } StrongKeyWeakValueEntry copy(ReferenceQueue referenceQueue, StrongKeyWeakValueEntry strongKeyWeakValueEntry) { StrongKeyWeakValueEntry strongKeyWeakValueEntry2 = new StrongKeyWeakValueEntry<>(this.key, this.hash, strongKeyWeakValueEntry); strongKeyWeakValueEntry2.valueReference = this.valueReference.copyFor(referenceQueue, strongKeyWeakValueEntry2); return strongKeyWeakValueEntry2; } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static final class Helper implements InternalEntryHelper, StrongKeyWeakValueSegment> { private static final Helper INSTANCE = new Helper<>(); static Helper instance() { return (Helper) INSTANCE; } Helper() { } /* JADX WARN: Multi-variable type inference failed */ @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public /* bridge */ /* synthetic */ InternalEntry newEntry(Segment segment, Object obj, int i, @CheckForNull InternalEntry internalEntry) { return newEntry((StrongKeyWeakValueSegment, V>) segment, (StrongKeyWeakValueSegment) obj, i, (StrongKeyWeakValueEntry, V>) internalEntry); } /* JADX WARN: Multi-variable type inference failed */ @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public /* bridge */ /* synthetic */ void setValue(Segment segment, InternalEntry internalEntry, Object obj) { setValue((StrongKeyWeakValueSegment>) segment, (StrongKeyWeakValueEntry>) internalEntry, (StrongKeyWeakValueEntry) obj); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public Strength keyStrength() { return Strength.STRONG; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public Strength valueStrength() { return Strength.WEAK; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public StrongKeyWeakValueSegment newSegment(MapMakerInternalMap, StrongKeyWeakValueSegment> mapMakerInternalMap, int i, int i2) { return new StrongKeyWeakValueSegment<>(mapMakerInternalMap, i, i2); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public StrongKeyWeakValueEntry copy(StrongKeyWeakValueSegment strongKeyWeakValueSegment, StrongKeyWeakValueEntry strongKeyWeakValueEntry, @CheckForNull StrongKeyWeakValueEntry strongKeyWeakValueEntry2) { if (Segment.isCollected(strongKeyWeakValueEntry)) { return null; } return strongKeyWeakValueEntry.copy(((StrongKeyWeakValueSegment) strongKeyWeakValueSegment).queueForValues, strongKeyWeakValueEntry2); } public void setValue(StrongKeyWeakValueSegment strongKeyWeakValueSegment, StrongKeyWeakValueEntry strongKeyWeakValueEntry, V v) { strongKeyWeakValueEntry.setValue(v, ((StrongKeyWeakValueSegment) strongKeyWeakValueSegment).queueForValues); } public StrongKeyWeakValueEntry newEntry(StrongKeyWeakValueSegment strongKeyWeakValueSegment, K k, int i, @CheckForNull StrongKeyWeakValueEntry strongKeyWeakValueEntry) { return new StrongKeyWeakValueEntry<>(k, i, strongKeyWeakValueEntry); } } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static final class StrongKeyDummyValueEntry extends AbstractStrongKeyEntry> implements StrongValueEntry> { void setValue(MapMaker.Dummy dummy) { } StrongKeyDummyValueEntry(K k, int i, @CheckForNull StrongKeyDummyValueEntry strongKeyDummyValueEntry) { super(k, i, strongKeyDummyValueEntry); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public MapMaker.Dummy getValue() { return MapMaker.Dummy.VALUE; } StrongKeyDummyValueEntry copy(StrongKeyDummyValueEntry strongKeyDummyValueEntry) { return new StrongKeyDummyValueEntry<>(this.key, this.hash, strongKeyDummyValueEntry); } /* loaded from: classes3.dex */ static final class Helper implements InternalEntryHelper, StrongKeyDummyValueSegment> { private static final Helper INSTANCE = new Helper<>(); static Helper instance() { return (Helper) INSTANCE; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public void setValue(StrongKeyDummyValueSegment strongKeyDummyValueSegment, StrongKeyDummyValueEntry strongKeyDummyValueEntry, MapMaker.Dummy dummy) { } Helper() { } /* JADX WARN: Multi-variable type inference failed */ @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public /* bridge */ /* synthetic */ InternalEntry newEntry(Segment segment, Object obj, int i, @CheckForNull InternalEntry internalEntry) { return newEntry((StrongKeyDummyValueSegment>) segment, (StrongKeyDummyValueSegment) obj, i, (StrongKeyDummyValueEntry>) internalEntry); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public Strength keyStrength() { return Strength.STRONG; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public Strength valueStrength() { return Strength.STRONG; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public StrongKeyDummyValueSegment newSegment(MapMakerInternalMap, StrongKeyDummyValueSegment> mapMakerInternalMap, int i, int i2) { return new StrongKeyDummyValueSegment<>(mapMakerInternalMap, i, i2); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public StrongKeyDummyValueEntry copy(StrongKeyDummyValueSegment strongKeyDummyValueSegment, StrongKeyDummyValueEntry strongKeyDummyValueEntry, @CheckForNull StrongKeyDummyValueEntry strongKeyDummyValueEntry2) { return strongKeyDummyValueEntry.copy(strongKeyDummyValueEntry2); } public StrongKeyDummyValueEntry newEntry(StrongKeyDummyValueSegment strongKeyDummyValueSegment, K k, int i, @CheckForNull StrongKeyDummyValueEntry strongKeyDummyValueEntry) { return new StrongKeyDummyValueEntry<>(k, i, strongKeyDummyValueEntry); } } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static abstract class AbstractWeakKeyEntry> extends WeakReference implements InternalEntry { final int hash; @CheckForNull final E next; @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public int getHash() { return this.hash; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public E getNext() { return this.next; } AbstractWeakKeyEntry(ReferenceQueue referenceQueue, K k, int i, @CheckForNull E e) { super(k, referenceQueue); this.hash = i; this.next = e; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public K getKey() { return (K) get(); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static final class WeakKeyDummyValueEntry extends AbstractWeakKeyEntry> implements StrongValueEntry> { void setValue(MapMaker.Dummy dummy) { } WeakKeyDummyValueEntry(ReferenceQueue referenceQueue, K k, int i, @CheckForNull WeakKeyDummyValueEntry weakKeyDummyValueEntry) { super(referenceQueue, k, i, weakKeyDummyValueEntry); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public MapMaker.Dummy getValue() { return MapMaker.Dummy.VALUE; } WeakKeyDummyValueEntry copy(ReferenceQueue referenceQueue, WeakKeyDummyValueEntry weakKeyDummyValueEntry) { return new WeakKeyDummyValueEntry<>(referenceQueue, getKey(), this.hash, weakKeyDummyValueEntry); } /* loaded from: classes3.dex */ static final class Helper implements InternalEntryHelper, WeakKeyDummyValueSegment> { private static final Helper INSTANCE = new Helper<>(); static Helper instance() { return (Helper) INSTANCE; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public void setValue(WeakKeyDummyValueSegment weakKeyDummyValueSegment, WeakKeyDummyValueEntry weakKeyDummyValueEntry, MapMaker.Dummy dummy) { } Helper() { } /* JADX WARN: Multi-variable type inference failed */ @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public /* bridge */ /* synthetic */ InternalEntry newEntry(Segment segment, Object obj, int i, @CheckForNull InternalEntry internalEntry) { return newEntry((WeakKeyDummyValueSegment>) segment, (WeakKeyDummyValueSegment) obj, i, (WeakKeyDummyValueEntry>) internalEntry); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public Strength keyStrength() { return Strength.WEAK; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public Strength valueStrength() { return Strength.STRONG; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public WeakKeyDummyValueSegment newSegment(MapMakerInternalMap, WeakKeyDummyValueSegment> mapMakerInternalMap, int i, int i2) { return new WeakKeyDummyValueSegment<>(mapMakerInternalMap, i, i2); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public WeakKeyDummyValueEntry copy(WeakKeyDummyValueSegment weakKeyDummyValueSegment, WeakKeyDummyValueEntry weakKeyDummyValueEntry, @CheckForNull WeakKeyDummyValueEntry weakKeyDummyValueEntry2) { if (weakKeyDummyValueEntry.getKey() == null) { return null; } return weakKeyDummyValueEntry.copy(((WeakKeyDummyValueSegment) weakKeyDummyValueSegment).queueForKeys, weakKeyDummyValueEntry2); } public WeakKeyDummyValueEntry newEntry(WeakKeyDummyValueSegment weakKeyDummyValueSegment, K k, int i, @CheckForNull WeakKeyDummyValueEntry weakKeyDummyValueEntry) { return new WeakKeyDummyValueEntry<>(((WeakKeyDummyValueSegment) weakKeyDummyValueSegment).queueForKeys, k, i, weakKeyDummyValueEntry); } } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static final class WeakKeyStrongValueEntry extends AbstractWeakKeyEntry> implements StrongValueEntry> { @CheckForNull private volatile V value; @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry @CheckForNull public V getValue() { return this.value; } void setValue(V v) { this.value = v; } WeakKeyStrongValueEntry(ReferenceQueue referenceQueue, K k, int i, @CheckForNull WeakKeyStrongValueEntry weakKeyStrongValueEntry) { super(referenceQueue, k, i, weakKeyStrongValueEntry); this.value = null; } WeakKeyStrongValueEntry copy(ReferenceQueue referenceQueue, WeakKeyStrongValueEntry weakKeyStrongValueEntry) { WeakKeyStrongValueEntry weakKeyStrongValueEntry2 = new WeakKeyStrongValueEntry<>(referenceQueue, getKey(), this.hash, weakKeyStrongValueEntry); weakKeyStrongValueEntry2.setValue(this.value); return weakKeyStrongValueEntry2; } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static final class Helper implements InternalEntryHelper, WeakKeyStrongValueSegment> { private static final Helper INSTANCE = new Helper<>(); static Helper instance() { return (Helper) INSTANCE; } Helper() { } /* JADX WARN: Multi-variable type inference failed */ @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public /* bridge */ /* synthetic */ InternalEntry newEntry(Segment segment, Object obj, int i, @CheckForNull InternalEntry internalEntry) { return newEntry((WeakKeyStrongValueSegment, V>) segment, (WeakKeyStrongValueSegment) obj, i, (WeakKeyStrongValueEntry, V>) internalEntry); } /* JADX WARN: Multi-variable type inference failed */ @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public /* bridge */ /* synthetic */ void setValue(Segment segment, InternalEntry internalEntry, Object obj) { setValue((WeakKeyStrongValueSegment>) segment, (WeakKeyStrongValueEntry>) internalEntry, (WeakKeyStrongValueEntry) obj); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public Strength keyStrength() { return Strength.WEAK; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public Strength valueStrength() { return Strength.STRONG; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public WeakKeyStrongValueSegment newSegment(MapMakerInternalMap, WeakKeyStrongValueSegment> mapMakerInternalMap, int i, int i2) { return new WeakKeyStrongValueSegment<>(mapMakerInternalMap, i, i2); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public WeakKeyStrongValueEntry copy(WeakKeyStrongValueSegment weakKeyStrongValueSegment, WeakKeyStrongValueEntry weakKeyStrongValueEntry, @CheckForNull WeakKeyStrongValueEntry weakKeyStrongValueEntry2) { if (weakKeyStrongValueEntry.getKey() == null) { return null; } return weakKeyStrongValueEntry.copy(((WeakKeyStrongValueSegment) weakKeyStrongValueSegment).queueForKeys, weakKeyStrongValueEntry2); } public void setValue(WeakKeyStrongValueSegment weakKeyStrongValueSegment, WeakKeyStrongValueEntry weakKeyStrongValueEntry, V v) { weakKeyStrongValueEntry.setValue(v); } public WeakKeyStrongValueEntry newEntry(WeakKeyStrongValueSegment weakKeyStrongValueSegment, K k, int i, @CheckForNull WeakKeyStrongValueEntry weakKeyStrongValueEntry) { return new WeakKeyStrongValueEntry<>(((WeakKeyStrongValueSegment) weakKeyStrongValueSegment).queueForKeys, k, i, weakKeyStrongValueEntry); } } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static final class WeakKeyWeakValueEntry extends AbstractWeakKeyEntry> implements WeakValueEntry> { private volatile WeakValueReference> valueReference; @Override // com.google.common.collect.MapMakerInternalMap.WeakValueEntry public WeakValueReference> getValueReference() { return this.valueReference; } WeakKeyWeakValueEntry(ReferenceQueue referenceQueue, K k, int i, @CheckForNull WeakKeyWeakValueEntry weakKeyWeakValueEntry) { super(referenceQueue, k, i, weakKeyWeakValueEntry); this.valueReference = MapMakerInternalMap.unsetWeakValueReference(); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public V getValue() { return this.valueReference.get(); } WeakKeyWeakValueEntry copy(ReferenceQueue referenceQueue, ReferenceQueue referenceQueue2, WeakKeyWeakValueEntry weakKeyWeakValueEntry) { WeakKeyWeakValueEntry weakKeyWeakValueEntry2 = new WeakKeyWeakValueEntry<>(referenceQueue, getKey(), this.hash, weakKeyWeakValueEntry); weakKeyWeakValueEntry2.valueReference = this.valueReference.copyFor(referenceQueue2, weakKeyWeakValueEntry2); return weakKeyWeakValueEntry2; } @Override // com.google.common.collect.MapMakerInternalMap.WeakValueEntry public void clearValue() { this.valueReference.clear(); } void setValue(V v, ReferenceQueue referenceQueue) { WeakValueReference> weakValueReference = this.valueReference; this.valueReference = new WeakValueReferenceImpl(referenceQueue, v, this); weakValueReference.clear(); } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static final class Helper implements InternalEntryHelper, WeakKeyWeakValueSegment> { private static final Helper INSTANCE = new Helper<>(); static Helper instance() { return (Helper) INSTANCE; } Helper() { } /* JADX WARN: Multi-variable type inference failed */ @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public /* bridge */ /* synthetic */ InternalEntry newEntry(Segment segment, Object obj, int i, @CheckForNull InternalEntry internalEntry) { return newEntry((WeakKeyWeakValueSegment, V>) segment, (WeakKeyWeakValueSegment) obj, i, (WeakKeyWeakValueEntry, V>) internalEntry); } /* JADX WARN: Multi-variable type inference failed */ @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public /* bridge */ /* synthetic */ void setValue(Segment segment, InternalEntry internalEntry, Object obj) { setValue((WeakKeyWeakValueSegment>) segment, (WeakKeyWeakValueEntry>) internalEntry, (WeakKeyWeakValueEntry) obj); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public Strength keyStrength() { return Strength.WEAK; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public Strength valueStrength() { return Strength.WEAK; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public WeakKeyWeakValueSegment newSegment(MapMakerInternalMap, WeakKeyWeakValueSegment> mapMakerInternalMap, int i, int i2) { return new WeakKeyWeakValueSegment<>(mapMakerInternalMap, i, i2); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public WeakKeyWeakValueEntry copy(WeakKeyWeakValueSegment weakKeyWeakValueSegment, WeakKeyWeakValueEntry weakKeyWeakValueEntry, @CheckForNull WeakKeyWeakValueEntry weakKeyWeakValueEntry2) { if (weakKeyWeakValueEntry.getKey() == null || Segment.isCollected(weakKeyWeakValueEntry)) { return null; } return weakKeyWeakValueEntry.copy(((WeakKeyWeakValueSegment) weakKeyWeakValueSegment).queueForKeys, ((WeakKeyWeakValueSegment) weakKeyWeakValueSegment).queueForValues, weakKeyWeakValueEntry2); } public void setValue(WeakKeyWeakValueSegment weakKeyWeakValueSegment, WeakKeyWeakValueEntry weakKeyWeakValueEntry, V v) { weakKeyWeakValueEntry.setValue(v, ((WeakKeyWeakValueSegment) weakKeyWeakValueSegment).queueForValues); } public WeakKeyWeakValueEntry newEntry(WeakKeyWeakValueSegment weakKeyWeakValueSegment, K k, int i, @CheckForNull WeakKeyWeakValueEntry weakKeyWeakValueEntry) { return new WeakKeyWeakValueEntry<>(((WeakKeyWeakValueSegment) weakKeyWeakValueSegment).queueForKeys, k, i, weakKeyWeakValueEntry); } } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static final class DummyInternalEntry implements InternalEntry { private DummyInternalEntry() { throw new AssertionError(); } /* JADX WARN: Can't rename method to resolve collision */ @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public DummyInternalEntry getNext() { throw new AssertionError(); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public int getHash() { throw new AssertionError(); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public Object getKey() { throw new AssertionError(); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public Object getValue() { throw new AssertionError(); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static final class WeakValueReferenceImpl> extends WeakReference implements WeakValueReference { final E entry; @Override // com.google.common.collect.MapMakerInternalMap.WeakValueReference public E getEntry() { return this.entry; } WeakValueReferenceImpl(ReferenceQueue referenceQueue, V v, E e) { super(v, referenceQueue); this.entry = e; } @Override // com.google.common.collect.MapMakerInternalMap.WeakValueReference public WeakValueReference copyFor(ReferenceQueue referenceQueue, E e) { return new WeakValueReferenceImpl(referenceQueue, get(), e); } } E copyEntry(E e, E e2) { return segmentFor(e.getHash()).copyEntry(e, e2); } int hash(Object obj) { return rehash(this.keyEquivalence.hash(obj)); } /* JADX WARN: Multi-variable type inference failed */ void reclaimValue(WeakValueReference weakValueReference) { E entry = weakValueReference.getEntry(); int hash = entry.getHash(); segmentFor(hash).reclaimValue(entry.getKey(), hash, weakValueReference); } void reclaimKey(E e) { int hash = e.getHash(); segmentFor(hash).reclaimKey(e, hash); } boolean isLiveForTesting(InternalEntry internalEntry) { return segmentFor(internalEntry.getHash()).getLiveValueForTesting(internalEntry) != null; } Segment segmentFor(int i) { return this.segments[this.segmentMask & (i >>> this.segmentShift)]; } Segment createSegment(int i, int i2) { return this.entryHelper.newSegment(this, i, i2); } V getLiveValue(E e) { if (e.getKey() == null) { return null; } return (V) e.getValue(); } final Segment[] newSegmentArray(int i) { return new Segment[i]; } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static abstract class Segment, S extends Segment> extends ReentrantLock { volatile int count; final MapMakerInternalMap map; final int maxSegmentSize; int modCount; final AtomicInteger readCount = new AtomicInteger(); @CheckForNull volatile AtomicReferenceArray table; int threshold; abstract E castForTesting(InternalEntry internalEntry); void maybeClearReferenceQueues() { } void maybeDrainReferenceQueues() { } abstract S self(); Segment(MapMakerInternalMap mapMakerInternalMap, int i, int i2) { this.map = mapMakerInternalMap; this.maxSegmentSize = i2; initTable(newEntryArray(i)); } void setValue(E e, V v) { this.map.entryHelper.setValue(self(), e, v); } E copyEntry(E e, E e2) { return this.map.entryHelper.copy(self(), e, e2); } AtomicReferenceArray newEntryArray(int i) { return new AtomicReferenceArray<>(i); } void initTable(AtomicReferenceArray atomicReferenceArray) { int length = (atomicReferenceArray.length() * 3) / 4; this.threshold = length; if (length == this.maxSegmentSize) { this.threshold = length + 1; } this.table = atomicReferenceArray; } ReferenceQueue getKeyReferenceQueueForTesting() { throw new AssertionError(); } ReferenceQueue getValueReferenceQueueForTesting() { throw new AssertionError(); } WeakValueReference getWeakValueReferenceForTesting(InternalEntry internalEntry) { throw new AssertionError(); } WeakValueReference newWeakValueReferenceForTesting(InternalEntry internalEntry, V v) { throw new AssertionError(); } void setWeakValueReferenceForTesting(InternalEntry internalEntry, WeakValueReference> weakValueReference) { throw new AssertionError(); } void setTableEntryForTesting(int i, InternalEntry internalEntry) { this.table.set(i, castForTesting(internalEntry)); } E copyForTesting(InternalEntry internalEntry, @CheckForNull InternalEntry internalEntry2) { return this.map.entryHelper.copy(self(), castForTesting(internalEntry), castForTesting(internalEntry2)); } void setValueForTesting(InternalEntry internalEntry, V v) { this.map.entryHelper.setValue(self(), castForTesting(internalEntry), v); } E newEntryForTesting(K k, int i, @CheckForNull InternalEntry internalEntry) { return this.map.entryHelper.newEntry(self(), k, i, castForTesting(internalEntry)); } boolean removeTableEntryForTesting(InternalEntry internalEntry) { return removeEntryForTesting(castForTesting(internalEntry)); } E removeFromChainForTesting(InternalEntry internalEntry, InternalEntry internalEntry2) { return removeFromChain(castForTesting(internalEntry), castForTesting(internalEntry2)); } @CheckForNull V getLiveValueForTesting(InternalEntry internalEntry) { return getLiveValue(castForTesting(internalEntry)); } void tryDrainReferenceQueues() { if (tryLock()) { try { maybeDrainReferenceQueues(); } finally { unlock(); } } } /* JADX WARN: Multi-variable type inference failed */ void drainKeyReferenceQueue(ReferenceQueue referenceQueue) { int i = 0; do { Reference poll = referenceQueue.poll(); if (poll == null) { return; } this.map.reclaimKey((InternalEntry) poll); i++; } while (i != 16); } void drainValueReferenceQueue(ReferenceQueue referenceQueue) { int i = 0; do { Reference poll = referenceQueue.poll(); if (poll == null) { return; } this.map.reclaimValue((WeakValueReference) poll); i++; } while (i != 16); } void clearReferenceQueue(ReferenceQueue referenceQueue) { do { } while (referenceQueue.poll() != null); } E getFirst(int i) { return this.table.get(i & (r1.length() - 1)); } E getEntry(Object obj, int i) { if (this.count == 0) { return null; } for (E first = getFirst(i); first != null; first = (E) first.getNext()) { if (first.getHash() == i) { Object key = first.getKey(); if (key == null) { tryDrainReferenceQueues(); } else if (this.map.keyEquivalence.equivalent(obj, key)) { return first; } } } return null; } E getLiveEntry(Object obj, int i) { return getEntry(obj, i); } V get(Object obj, int i) { try { E liveEntry = getLiveEntry(obj, i); if (liveEntry != null) { V v = (V) liveEntry.getValue(); if (v == null) { tryDrainReferenceQueues(); } return v; } postReadCleanup(); return null; } finally { postReadCleanup(); } } boolean containsKey(Object obj, int i) { try { boolean z = false; if (this.count == 0) { return false; } E liveEntry = getLiveEntry(obj, i); if (liveEntry != null) { if (liveEntry.getValue() != null) { z = true; } } return z; } finally { postReadCleanup(); } } /* JADX WARN: Multi-variable type inference failed */ boolean containsValue(Object obj) { try { if (this.count != 0) { AtomicReferenceArray atomicReferenceArray = this.table; int length = atomicReferenceArray.length(); for (int i = 0; i < length; i++) { for (E e = atomicReferenceArray.get(i); e != null; e = e.getNext()) { Object liveValue = getLiveValue(e); if (liveValue != null && this.map.valueEquivalence().equivalent(obj, liveValue)) { postReadCleanup(); return true; } } } } return false; } finally { postReadCleanup(); } } /* JADX WARN: Multi-variable type inference failed */ V put(K k, int i, V v, boolean z) { lock(); try { preWriteCleanup(); int i2 = this.count + 1; if (i2 > this.threshold) { expand(); i2 = this.count + 1; } AtomicReferenceArray atomicReferenceArray = this.table; int length = (atomicReferenceArray.length() - 1) & i; InternalEntry internalEntry = (InternalEntry) atomicReferenceArray.get(length); for (InternalEntry internalEntry2 = internalEntry; internalEntry2 != null; internalEntry2 = internalEntry2.getNext()) { Object key = internalEntry2.getKey(); if (internalEntry2.getHash() == i && key != null && this.map.keyEquivalence.equivalent(k, key)) { V v2 = (V) internalEntry2.getValue(); if (v2 == null) { this.modCount++; setValue(internalEntry2, v); this.count = this.count; return null; } if (z) { return v2; } this.modCount++; setValue(internalEntry2, v); return v2; } } this.modCount++; InternalEntry newEntry = this.map.entryHelper.newEntry(self(), k, i, internalEntry); setValue(newEntry, v); atomicReferenceArray.set(length, newEntry); this.count = i2; return null; } finally { unlock(); } } /* JADX WARN: Multi-variable type inference failed */ void expand() { AtomicReferenceArray atomicReferenceArray = this.table; int length = atomicReferenceArray.length(); if (length >= 1073741824) { return; } int i = this.count; AtomicReferenceArray atomicReferenceArray2 = (AtomicReferenceArray) newEntryArray(length << 1); this.threshold = (atomicReferenceArray2.length() * 3) / 4; int length2 = atomicReferenceArray2.length() - 1; for (int i2 = 0; i2 < length; i2++) { E e = atomicReferenceArray.get(i2); if (e != null) { InternalEntry next = e.getNext(); int hash = e.getHash() & length2; if (next == null) { atomicReferenceArray2.set(hash, e); } else { InternalEntry internalEntry = e; while (next != null) { int hash2 = next.getHash() & length2; if (hash2 != hash) { internalEntry = next; hash = hash2; } next = next.getNext(); } atomicReferenceArray2.set(hash, internalEntry); while (e != internalEntry) { int hash3 = e.getHash() & length2; InternalEntry copyEntry = copyEntry(e, (InternalEntry) atomicReferenceArray2.get(hash3)); if (copyEntry != null) { atomicReferenceArray2.set(hash3, copyEntry); } else { i--; } e = e.getNext(); } } } } this.table = atomicReferenceArray2; this.count = i; } /* JADX WARN: Multi-variable type inference failed */ boolean replace(K k, int i, V v, V v2) { lock(); try { preWriteCleanup(); AtomicReferenceArray atomicReferenceArray = this.table; int length = (atomicReferenceArray.length() - 1) & i; InternalEntry internalEntry = (InternalEntry) atomicReferenceArray.get(length); for (InternalEntry internalEntry2 = internalEntry; internalEntry2 != null; internalEntry2 = internalEntry2.getNext()) { Object key = internalEntry2.getKey(); if (internalEntry2.getHash() == i && key != null && this.map.keyEquivalence.equivalent(k, key)) { Object value = internalEntry2.getValue(); if (value == null) { if (isCollected(internalEntry2)) { this.modCount++; InternalEntry removeFromChain = removeFromChain(internalEntry, internalEntry2); int i2 = this.count - 1; atomicReferenceArray.set(length, removeFromChain); this.count = i2; } return false; } if (!this.map.valueEquivalence().equivalent(v, value)) { return false; } this.modCount++; setValue(internalEntry2, v2); return true; } } return false; } finally { unlock(); } } /* JADX WARN: Multi-variable type inference failed */ V replace(K k, int i, V v) { lock(); try { preWriteCleanup(); AtomicReferenceArray atomicReferenceArray = this.table; int length = (atomicReferenceArray.length() - 1) & i; InternalEntry internalEntry = (InternalEntry) atomicReferenceArray.get(length); for (InternalEntry internalEntry2 = internalEntry; internalEntry2 != null; internalEntry2 = internalEntry2.getNext()) { Object key = internalEntry2.getKey(); if (internalEntry2.getHash() == i && key != null && this.map.keyEquivalence.equivalent(k, key)) { V v2 = (V) internalEntry2.getValue(); if (v2 == null) { if (isCollected(internalEntry2)) { this.modCount++; InternalEntry removeFromChain = removeFromChain(internalEntry, internalEntry2); int i2 = this.count - 1; atomicReferenceArray.set(length, removeFromChain); this.count = i2; } return null; } this.modCount++; setValue(internalEntry2, v); return v2; } } return null; } finally { unlock(); } } /* JADX WARN: Multi-variable type inference failed */ V remove(Object obj, int i) { lock(); try { preWriteCleanup(); AtomicReferenceArray atomicReferenceArray = this.table; int length = (atomicReferenceArray.length() - 1) & i; InternalEntry internalEntry = (InternalEntry) atomicReferenceArray.get(length); for (InternalEntry internalEntry2 = internalEntry; internalEntry2 != null; internalEntry2 = internalEntry2.getNext()) { Object key = internalEntry2.getKey(); if (internalEntry2.getHash() == i && key != null && this.map.keyEquivalence.equivalent(obj, key)) { V v = (V) internalEntry2.getValue(); if (v == null && !isCollected(internalEntry2)) { return null; } this.modCount++; InternalEntry removeFromChain = removeFromChain(internalEntry, internalEntry2); int i2 = this.count - 1; atomicReferenceArray.set(length, removeFromChain); this.count = i2; return v; } } return null; } finally { unlock(); } } /* JADX WARN: Code restructure failed: missing block: B:13:0x003d, code lost: if (r8.map.valueEquivalence().equivalent(r11, r4.getValue()) == false) goto L14; */ /* JADX WARN: Code restructure failed: missing block: B:14:0x003f, code lost: r5 = true; */ /* JADX WARN: Code restructure failed: missing block: B:15:0x0047, code lost: r8.modCount++; r9 = removeFromChain(r3, r4); r10 = r8.count - 1; r0.set(r1, r9); r8.count = r10; */ /* JADX WARN: Code restructure failed: missing block: B:17:0x005b, code lost: return r5; */ /* JADX WARN: Code restructure failed: missing block: B:21:0x0045, code lost: if (isCollected(r4) == false) goto L19; */ /* JADX WARN: Code restructure failed: missing block: B:23:0x005f, code lost: return false; */ /* JADX WARN: Multi-variable type inference failed */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ boolean remove(java.lang.Object r9, int r10, java.lang.Object r11) { /* r8 = this; r8.lock() r8.preWriteCleanup() // Catch: java.lang.Throwable -> L69 java.util.concurrent.atomic.AtomicReferenceArray> r0 = r8.table // Catch: java.lang.Throwable -> L69 int r1 = r0.length() // Catch: java.lang.Throwable -> L69 r2 = 1 int r1 = r1 - r2 r1 = r1 & r10 java.lang.Object r3 = r0.get(r1) // Catch: java.lang.Throwable -> L69 com.google.common.collect.MapMakerInternalMap$InternalEntry r3 = (com.google.common.collect.MapMakerInternalMap.InternalEntry) r3 // Catch: java.lang.Throwable -> L69 r4 = r3 L16: r5 = 0 if (r4 == 0) goto L65 java.lang.Object r6 = r4.getKey() // Catch: java.lang.Throwable -> L69 int r7 = r4.getHash() // Catch: java.lang.Throwable -> L69 if (r7 != r10) goto L60 if (r6 == 0) goto L60 com.google.common.collect.MapMakerInternalMap, S extends com.google.common.collect.MapMakerInternalMap$Segment> r7 = r8.map // Catch: java.lang.Throwable -> L69 com.google.common.base.Equivalence r7 = r7.keyEquivalence // Catch: java.lang.Throwable -> L69 boolean r6 = r7.equivalent(r9, r6) // Catch: java.lang.Throwable -> L69 if (r6 == 0) goto L60 java.lang.Object r9 = r4.getValue() // Catch: java.lang.Throwable -> L69 com.google.common.collect.MapMakerInternalMap, S extends com.google.common.collect.MapMakerInternalMap$Segment> r10 = r8.map // Catch: java.lang.Throwable -> L69 com.google.common.base.Equivalence r10 = r10.valueEquivalence() // Catch: java.lang.Throwable -> L69 boolean r9 = r10.equivalent(r11, r9) // Catch: java.lang.Throwable -> L69 if (r9 == 0) goto L41 r5 = r2 goto L47 L41: boolean r9 = isCollected(r4) // Catch: java.lang.Throwable -> L69 if (r9 == 0) goto L5c L47: int r9 = r8.modCount // Catch: java.lang.Throwable -> L69 int r9 = r9 + r2 r8.modCount = r9 // Catch: java.lang.Throwable -> L69 com.google.common.collect.MapMakerInternalMap$InternalEntry r9 = r8.removeFromChain(r3, r4) // Catch: java.lang.Throwable -> L69 int r10 = r8.count // Catch: java.lang.Throwable -> L69 int r10 = r10 - r2 r0.set(r1, r9) // Catch: java.lang.Throwable -> L69 r8.count = r10 // Catch: java.lang.Throwable -> L69 r8.unlock() return r5 L5c: r8.unlock() return r5 L60: com.google.common.collect.MapMakerInternalMap$InternalEntry r4 = r4.getNext() // Catch: java.lang.Throwable -> L69 goto L16 L65: r8.unlock() return r5 L69: r9 = move-exception r8.unlock() throw r9 */ throw new UnsupportedOperationException("Method not decompiled: com.google.common.collect.MapMakerInternalMap.Segment.remove(java.lang.Object, int, java.lang.Object):boolean"); } void clear() { if (this.count != 0) { lock(); try { AtomicReferenceArray atomicReferenceArray = this.table; for (int i = 0; i < atomicReferenceArray.length(); i++) { atomicReferenceArray.set(i, null); } maybeClearReferenceQueues(); this.readCount.set(0); this.modCount++; this.count = 0; } finally { unlock(); } } } E removeFromChain(E e, E e2) { int i = this.count; E e3 = (E) e2.getNext(); while (e != e2) { E copyEntry = copyEntry(e, e3); if (copyEntry != null) { e3 = copyEntry; } else { i--; } e = (E) e.getNext(); } this.count = i; return e3; } /* JADX WARN: Multi-variable type inference failed */ boolean reclaimKey(E e, int i) { lock(); try { AtomicReferenceArray atomicReferenceArray = this.table; int length = i & (atomicReferenceArray.length() - 1); InternalEntry internalEntry = (InternalEntry) atomicReferenceArray.get(length); for (InternalEntry internalEntry2 = internalEntry; internalEntry2 != null; internalEntry2 = internalEntry2.getNext()) { if (internalEntry2 == e) { this.modCount++; InternalEntry removeFromChain = removeFromChain(internalEntry, internalEntry2); int i2 = this.count - 1; atomicReferenceArray.set(length, removeFromChain); this.count = i2; return true; } } unlock(); return false; } finally { unlock(); } } /* JADX WARN: Multi-variable type inference failed */ boolean reclaimValue(K k, int i, WeakValueReference weakValueReference) { lock(); try { AtomicReferenceArray atomicReferenceArray = this.table; int length = (atomicReferenceArray.length() - 1) & i; InternalEntry internalEntry = (InternalEntry) atomicReferenceArray.get(length); for (InternalEntry internalEntry2 = internalEntry; internalEntry2 != null; internalEntry2 = internalEntry2.getNext()) { Object key = internalEntry2.getKey(); if (internalEntry2.getHash() == i && key != null && this.map.keyEquivalence.equivalent(k, key)) { if (((WeakValueEntry) internalEntry2).getValueReference() != weakValueReference) { return false; } this.modCount++; InternalEntry removeFromChain = removeFromChain(internalEntry, internalEntry2); int i2 = this.count - 1; atomicReferenceArray.set(length, removeFromChain); this.count = i2; return true; } } return false; } finally { unlock(); } } /* JADX WARN: Multi-variable type inference failed */ boolean clearValueForTesting(K k, int i, WeakValueReference> weakValueReference) { lock(); try { AtomicReferenceArray atomicReferenceArray = this.table; int length = (atomicReferenceArray.length() - 1) & i; InternalEntry internalEntry = (InternalEntry) atomicReferenceArray.get(length); for (InternalEntry internalEntry2 = internalEntry; internalEntry2 != null; internalEntry2 = internalEntry2.getNext()) { Object key = internalEntry2.getKey(); if (internalEntry2.getHash() == i && key != null && this.map.keyEquivalence.equivalent(k, key)) { if (((WeakValueEntry) internalEntry2).getValueReference() != weakValueReference) { return false; } atomicReferenceArray.set(length, removeFromChain(internalEntry, internalEntry2)); return true; } } return false; } finally { unlock(); } } /* JADX WARN: Multi-variable type inference failed */ boolean removeEntryForTesting(E e) { int hash = e.getHash(); AtomicReferenceArray atomicReferenceArray = this.table; int length = hash & (atomicReferenceArray.length() - 1); InternalEntry internalEntry = (InternalEntry) atomicReferenceArray.get(length); for (InternalEntry internalEntry2 = internalEntry; internalEntry2 != null; internalEntry2 = internalEntry2.getNext()) { if (internalEntry2 == e) { this.modCount++; InternalEntry removeFromChain = removeFromChain(internalEntry, internalEntry2); int i = this.count - 1; atomicReferenceArray.set(length, removeFromChain); this.count = i; return true; } } return false; } static > boolean isCollected(E e) { return e.getValue() == null; } @CheckForNull V getLiveValue(E e) { if (e.getKey() == null) { tryDrainReferenceQueues(); return null; } V v = (V) e.getValue(); if (v != null) { return v; } tryDrainReferenceQueues(); return null; } void postReadCleanup() { if ((this.readCount.incrementAndGet() & 63) == 0) { runCleanup(); } } void preWriteCleanup() { runLockedCleanup(); } void runCleanup() { runLockedCleanup(); } void runLockedCleanup() { if (tryLock()) { try { maybeDrainReferenceQueues(); this.readCount.set(0); } finally { unlock(); } } } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static final class StrongKeyStrongValueSegment extends Segment, StrongKeyStrongValueSegment> { /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.common.collect.MapMakerInternalMap.Segment public StrongKeyStrongValueSegment self() { return this; } StrongKeyStrongValueSegment(MapMakerInternalMap, StrongKeyStrongValueSegment> mapMakerInternalMap, int i, int i2) { super(mapMakerInternalMap, i, i2); } @Override // com.google.common.collect.MapMakerInternalMap.Segment public StrongKeyStrongValueEntry castForTesting(InternalEntry internalEntry) { return (StrongKeyStrongValueEntry) internalEntry; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static final class StrongKeyWeakValueSegment extends Segment, StrongKeyWeakValueSegment> { private final ReferenceQueue queueForValues; @Override // com.google.common.collect.MapMakerInternalMap.Segment ReferenceQueue getValueReferenceQueueForTesting() { return this.queueForValues; } /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.common.collect.MapMakerInternalMap.Segment public StrongKeyWeakValueSegment self() { return this; } StrongKeyWeakValueSegment(MapMakerInternalMap, StrongKeyWeakValueSegment> mapMakerInternalMap, int i, int i2) { super(mapMakerInternalMap, i, i2); this.queueForValues = new ReferenceQueue<>(); } @Override // com.google.common.collect.MapMakerInternalMap.Segment public StrongKeyWeakValueEntry castForTesting(InternalEntry internalEntry) { return (StrongKeyWeakValueEntry) internalEntry; } @Override // com.google.common.collect.MapMakerInternalMap.Segment public WeakValueReference> getWeakValueReferenceForTesting(InternalEntry internalEntry) { return castForTesting((InternalEntry) internalEntry).getValueReference(); } @Override // com.google.common.collect.MapMakerInternalMap.Segment public WeakValueReference> newWeakValueReferenceForTesting(InternalEntry internalEntry, V v) { return new WeakValueReferenceImpl(this.queueForValues, v, castForTesting((InternalEntry) internalEntry)); } @Override // com.google.common.collect.MapMakerInternalMap.Segment public void setWeakValueReferenceForTesting(InternalEntry internalEntry, WeakValueReference> weakValueReference) { StrongKeyWeakValueEntry castForTesting = castForTesting((InternalEntry) internalEntry); WeakValueReference weakValueReference2 = ((StrongKeyWeakValueEntry) castForTesting).valueReference; ((StrongKeyWeakValueEntry) castForTesting).valueReference = weakValueReference; weakValueReference2.clear(); } @Override // com.google.common.collect.MapMakerInternalMap.Segment void maybeDrainReferenceQueues() { drainValueReferenceQueue(this.queueForValues); } @Override // com.google.common.collect.MapMakerInternalMap.Segment void maybeClearReferenceQueues() { clearReferenceQueue(this.queueForValues); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static final class StrongKeyDummyValueSegment extends Segment, StrongKeyDummyValueSegment> { /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.common.collect.MapMakerInternalMap.Segment public StrongKeyDummyValueSegment self() { return this; } StrongKeyDummyValueSegment(MapMakerInternalMap, StrongKeyDummyValueSegment> mapMakerInternalMap, int i, int i2) { super(mapMakerInternalMap, i, i2); } @Override // com.google.common.collect.MapMakerInternalMap.Segment public StrongKeyDummyValueEntry castForTesting(InternalEntry internalEntry) { return (StrongKeyDummyValueEntry) internalEntry; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static final class WeakKeyStrongValueSegment extends Segment, WeakKeyStrongValueSegment> { private final ReferenceQueue queueForKeys; @Override // com.google.common.collect.MapMakerInternalMap.Segment ReferenceQueue getKeyReferenceQueueForTesting() { return this.queueForKeys; } /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.common.collect.MapMakerInternalMap.Segment public WeakKeyStrongValueSegment self() { return this; } WeakKeyStrongValueSegment(MapMakerInternalMap, WeakKeyStrongValueSegment> mapMakerInternalMap, int i, int i2) { super(mapMakerInternalMap, i, i2); this.queueForKeys = new ReferenceQueue<>(); } @Override // com.google.common.collect.MapMakerInternalMap.Segment public WeakKeyStrongValueEntry castForTesting(InternalEntry internalEntry) { return (WeakKeyStrongValueEntry) internalEntry; } @Override // com.google.common.collect.MapMakerInternalMap.Segment void maybeDrainReferenceQueues() { drainKeyReferenceQueue(this.queueForKeys); } @Override // com.google.common.collect.MapMakerInternalMap.Segment void maybeClearReferenceQueues() { clearReferenceQueue(this.queueForKeys); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static final class WeakKeyWeakValueSegment extends Segment, WeakKeyWeakValueSegment> { private final ReferenceQueue queueForKeys; private final ReferenceQueue queueForValues; @Override // com.google.common.collect.MapMakerInternalMap.Segment ReferenceQueue getKeyReferenceQueueForTesting() { return this.queueForKeys; } @Override // com.google.common.collect.MapMakerInternalMap.Segment ReferenceQueue getValueReferenceQueueForTesting() { return this.queueForValues; } /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.common.collect.MapMakerInternalMap.Segment public WeakKeyWeakValueSegment self() { return this; } WeakKeyWeakValueSegment(MapMakerInternalMap, WeakKeyWeakValueSegment> mapMakerInternalMap, int i, int i2) { super(mapMakerInternalMap, i, i2); this.queueForKeys = new ReferenceQueue<>(); this.queueForValues = new ReferenceQueue<>(); } @Override // com.google.common.collect.MapMakerInternalMap.Segment public WeakKeyWeakValueEntry castForTesting(InternalEntry internalEntry) { return (WeakKeyWeakValueEntry) internalEntry; } @Override // com.google.common.collect.MapMakerInternalMap.Segment public WeakValueReference> getWeakValueReferenceForTesting(InternalEntry internalEntry) { return castForTesting((InternalEntry) internalEntry).getValueReference(); } @Override // com.google.common.collect.MapMakerInternalMap.Segment public WeakValueReference> newWeakValueReferenceForTesting(InternalEntry internalEntry, V v) { return new WeakValueReferenceImpl(this.queueForValues, v, castForTesting((InternalEntry) internalEntry)); } @Override // com.google.common.collect.MapMakerInternalMap.Segment public void setWeakValueReferenceForTesting(InternalEntry internalEntry, WeakValueReference> weakValueReference) { WeakKeyWeakValueEntry castForTesting = castForTesting((InternalEntry) internalEntry); WeakValueReference weakValueReference2 = ((WeakKeyWeakValueEntry) castForTesting).valueReference; ((WeakKeyWeakValueEntry) castForTesting).valueReference = weakValueReference; weakValueReference2.clear(); } @Override // com.google.common.collect.MapMakerInternalMap.Segment void maybeDrainReferenceQueues() { drainKeyReferenceQueue(this.queueForKeys); drainValueReferenceQueue(this.queueForValues); } @Override // com.google.common.collect.MapMakerInternalMap.Segment void maybeClearReferenceQueues() { clearReferenceQueue(this.queueForKeys); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public static final class WeakKeyDummyValueSegment extends Segment, WeakKeyDummyValueSegment> { private final ReferenceQueue queueForKeys; @Override // com.google.common.collect.MapMakerInternalMap.Segment ReferenceQueue getKeyReferenceQueueForTesting() { return this.queueForKeys; } /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.common.collect.MapMakerInternalMap.Segment public WeakKeyDummyValueSegment self() { return this; } WeakKeyDummyValueSegment(MapMakerInternalMap, WeakKeyDummyValueSegment> mapMakerInternalMap, int i, int i2) { super(mapMakerInternalMap, i, i2); this.queueForKeys = new ReferenceQueue<>(); } @Override // com.google.common.collect.MapMakerInternalMap.Segment public WeakKeyDummyValueEntry castForTesting(InternalEntry internalEntry) { return (WeakKeyDummyValueEntry) internalEntry; } @Override // com.google.common.collect.MapMakerInternalMap.Segment void maybeDrainReferenceQueues() { drainKeyReferenceQueue(this.queueForKeys); } @Override // com.google.common.collect.MapMakerInternalMap.Segment void maybeClearReferenceQueues() { clearReferenceQueue(this.queueForKeys); } } /* loaded from: classes3.dex */ static final class CleanupMapTask implements Runnable { final WeakReference> mapReference; public CleanupMapTask(MapMakerInternalMap mapMakerInternalMap) { this.mapReference = new WeakReference<>(mapMakerInternalMap); } @Override // java.lang.Runnable public void run() { MapMakerInternalMap mapMakerInternalMap = this.mapReference.get(); if (mapMakerInternalMap == null) { throw new CancellationException(); } for (Segment segment : mapMakerInternalMap.segments) { segment.runCleanup(); } } } Strength keyStrength() { return this.entryHelper.keyStrength(); } Strength valueStrength() { return this.entryHelper.valueStrength(); } Equivalence valueEquivalence() { return this.entryHelper.valueStrength().defaultEquivalence(); } @Override // java.util.AbstractMap, java.util.Map public boolean isEmpty() { Segment[] segmentArr = this.segments; long j = 0; for (int i = 0; i < segmentArr.length; i++) { if (segmentArr[i].count != 0) { return false; } j += segmentArr[i].modCount; } if (j == 0) { return true; } for (int i2 = 0; i2 < segmentArr.length; i2++) { if (segmentArr[i2].count != 0) { return false; } j -= segmentArr[i2].modCount; } return j == 0; } @Override // java.util.AbstractMap, java.util.Map public int size() { long j = 0; for (int i = 0; i < this.segments.length; i++) { j += r5[i].count; } return Ints.saturatedCast(j); } @Override // java.util.AbstractMap, java.util.Map public V get(@CheckForNull Object obj) { if (obj == null) { return null; } int hash = hash(obj); return segmentFor(hash).get(obj, hash); } /* JADX INFO: Access modifiers changed from: package-private */ public E getEntry(@CheckForNull Object obj) { if (obj == null) { return null; } int hash = hash(obj); return segmentFor(hash).getEntry(obj, hash); } @Override // java.util.AbstractMap, java.util.Map public boolean containsKey(@CheckForNull Object obj) { if (obj == null) { return false; } int hash = hash(obj); return segmentFor(hash).containsKey(obj, hash); } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r10v0 */ /* JADX WARN: Type inference failed for: r10v1, types: [int] */ /* JADX WARN: Type inference failed for: r10v3 */ /* JADX WARN: Type inference failed for: r11v0, types: [com.google.common.collect.MapMakerInternalMap$Segment] */ /* JADX WARN: Type inference failed for: r13v0 */ /* JADX WARN: Type inference failed for: r13v1, types: [int] */ /* JADX WARN: Type inference failed for: r13v3 */ /* JADX WARN: Type inference failed for: r3v0, types: [com.google.common.collect.MapMakerInternalMap$Segment, S extends com.google.common.collect.MapMakerInternalMap$Segment>[]] */ @Override // java.util.AbstractMap, java.util.Map public boolean containsValue(@CheckForNull Object obj) { boolean z = false; if (obj == null) { return false; } Segment[] segmentArr = this.segments; long j = -1; int i = 0; while (i < 3) { int length = segmentArr.length; long j2 = 0; for (?? r10 = z; r10 < length; r10++) { ?? r11 = segmentArr[r10]; int i2 = r11.count; AtomicReferenceArray atomicReferenceArray = r11.table; for (?? r13 = z; r13 < atomicReferenceArray.length(); r13++) { for (E e = atomicReferenceArray.get(r13); e != null; e = e.getNext()) { Object liveValue = r11.getLiveValue(e); if (liveValue != null && valueEquivalence().equivalent(obj, liveValue)) { return true; } } } j2 += r11.modCount; z = false; } if (j2 == j) { return false; } i++; j = j2; z = false; } return z; } @Override // java.util.AbstractMap, java.util.Map public V put(K k, V v) { Preconditions.checkNotNull(k); Preconditions.checkNotNull(v); int hash = hash(k); return segmentFor(hash).put(k, hash, v, false); } @Override // java.util.Map, java.util.concurrent.ConcurrentMap public V putIfAbsent(K k, V v) { Preconditions.checkNotNull(k); Preconditions.checkNotNull(v); int hash = hash(k); return segmentFor(hash).put(k, hash, v, true); } @Override // java.util.AbstractMap, java.util.Map public void putAll(Map map) { for (Map.Entry entry : map.entrySet()) { put(entry.getKey(), entry.getValue()); } } @Override // java.util.AbstractMap, java.util.Map public V remove(@CheckForNull Object obj) { if (obj == null) { return null; } int hash = hash(obj); return segmentFor(hash).remove(obj, hash); } @Override // java.util.Map, java.util.concurrent.ConcurrentMap public boolean remove(@CheckForNull Object obj, @CheckForNull Object obj2) { if (obj == null || obj2 == null) { return false; } int hash = hash(obj); return segmentFor(hash).remove(obj, hash, obj2); } @Override // java.util.Map, java.util.concurrent.ConcurrentMap public boolean replace(K k, @CheckForNull V v, V v2) { Preconditions.checkNotNull(k); Preconditions.checkNotNull(v2); if (v == null) { return false; } int hash = hash(k); return segmentFor(hash).replace(k, hash, v, v2); } @Override // java.util.Map, java.util.concurrent.ConcurrentMap public V replace(K k, V v) { Preconditions.checkNotNull(k); Preconditions.checkNotNull(v); int hash = hash(k); return segmentFor(hash).replace(k, hash, v); } @Override // java.util.AbstractMap, java.util.Map public void clear() { for (Segment segment : this.segments) { segment.clear(); } } @Override // java.util.AbstractMap, java.util.Map public Set keySet() { Set set = this.keySet; if (set != null) { return set; } KeySet keySet = new KeySet(); this.keySet = keySet; return keySet; } @Override // java.util.AbstractMap, java.util.Map public Collection values() { Collection collection = this.values; if (collection != null) { return collection; } Values values = new Values(); this.values = values; return values; } @Override // java.util.AbstractMap, java.util.Map public Set> entrySet() { Set> set = this.entrySet; if (set != null) { return set; } EntrySet entrySet = new EntrySet(); this.entrySet = entrySet; return entrySet; } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public abstract class HashIterator implements Iterator { @CheckForNull Segment currentSegment; @CheckForNull AtomicReferenceArray currentTable; @CheckForNull MapMakerInternalMap.WriteThroughEntry lastReturned; @CheckForNull E nextEntry; @CheckForNull MapMakerInternalMap.WriteThroughEntry nextExternal; int nextSegmentIndex; int nextTableIndex = -1; @Override // java.util.Iterator public boolean hasNext() { return this.nextExternal != null; } @Override // java.util.Iterator public abstract T next(); HashIterator() { this.nextSegmentIndex = MapMakerInternalMap.this.segments.length - 1; advance(); } final void advance() { this.nextExternal = null; if (nextInChain() || nextInTable()) { return; } while (this.nextSegmentIndex >= 0) { Segment[] segmentArr = MapMakerInternalMap.this.segments; int i = this.nextSegmentIndex; this.nextSegmentIndex = i - 1; Segment segment = segmentArr[i]; this.currentSegment = segment; if (segment.count != 0) { this.currentTable = this.currentSegment.table; this.nextTableIndex = r0.length() - 1; if (nextInTable()) { return; } } } } boolean nextInChain() { E e = this.nextEntry; if (e == null) { return false; } while (true) { this.nextEntry = (E) e.getNext(); E e2 = this.nextEntry; if (e2 == null) { return false; } if (advanceTo(e2)) { return true; } e = this.nextEntry; } } boolean nextInTable() { while (true) { int i = this.nextTableIndex; if (i < 0) { return false; } AtomicReferenceArray atomicReferenceArray = this.currentTable; this.nextTableIndex = i - 1; E e = atomicReferenceArray.get(i); this.nextEntry = e; if (e != null && (advanceTo(e) || nextInChain())) { return true; } } } boolean advanceTo(E e) { try { Object key = e.getKey(); Object liveValue = MapMakerInternalMap.this.getLiveValue(e); if (liveValue == null) { this.currentSegment.postReadCleanup(); return false; } this.nextExternal = new WriteThroughEntry(key, liveValue); this.currentSegment.postReadCleanup(); return true; } catch (Throwable th) { this.currentSegment.postReadCleanup(); throw th; } } MapMakerInternalMap.WriteThroughEntry nextEntry() { MapMakerInternalMap.WriteThroughEntry writeThroughEntry = this.nextExternal; if (writeThroughEntry == null) { throw new NoSuchElementException(); } this.lastReturned = writeThroughEntry; advance(); return this.lastReturned; } @Override // java.util.Iterator public void remove() { CollectPreconditions.checkRemove(this.lastReturned != null); MapMakerInternalMap.this.remove(this.lastReturned.getKey()); this.lastReturned = null; } } /* loaded from: classes3.dex */ final class KeyIterator extends MapMakerInternalMap.HashIterator { KeyIterator(MapMakerInternalMap mapMakerInternalMap) { super(); } @Override // com.google.common.collect.MapMakerInternalMap.HashIterator, java.util.Iterator public K next() { return nextEntry().getKey(); } } /* loaded from: classes3.dex */ final class ValueIterator extends MapMakerInternalMap.HashIterator { ValueIterator(MapMakerInternalMap mapMakerInternalMap) { super(); } @Override // com.google.common.collect.MapMakerInternalMap.HashIterator, java.util.Iterator public V next() { return nextEntry().getValue(); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public final class WriteThroughEntry extends AbstractMapEntry { final K key; V value; @Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry public K getKey() { return this.key; } @Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry public V getValue() { return this.value; } WriteThroughEntry(K k, V v) { this.key = k; this.value = v; } @Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry public boolean equals(@CheckForNull Object obj) { if (!(obj instanceof Map.Entry)) { return false; } Map.Entry entry = (Map.Entry) obj; return this.key.equals(entry.getKey()) && this.value.equals(entry.getValue()); } @Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry public int hashCode() { return this.value.hashCode() ^ this.key.hashCode(); } @Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry public V setValue(V v) { V v2 = (V) MapMakerInternalMap.this.put(this.key, v); this.value = v; return v2; } } /* loaded from: classes3.dex */ final class EntryIterator extends MapMakerInternalMap.HashIterator> { EntryIterator(MapMakerInternalMap mapMakerInternalMap) { super(); } @Override // com.google.common.collect.MapMakerInternalMap.HashIterator, java.util.Iterator public Map.Entry next() { return nextEntry(); } } /* loaded from: classes3.dex */ final class KeySet extends SafeToArraySet { KeySet() { super(); } @Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set public Iterator iterator() { return new KeyIterator(MapMakerInternalMap.this); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public int size() { return MapMakerInternalMap.this.size(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public boolean isEmpty() { return MapMakerInternalMap.this.isEmpty(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public boolean contains(Object obj) { return MapMakerInternalMap.this.containsKey(obj); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public boolean remove(Object obj) { return MapMakerInternalMap.this.remove(obj) != null; } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public void clear() { MapMakerInternalMap.this.clear(); } } /* loaded from: classes3.dex */ final class Values extends AbstractCollection { Values() { } @Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable public Iterator iterator() { return new ValueIterator(MapMakerInternalMap.this); } @Override // java.util.AbstractCollection, java.util.Collection public int size() { return MapMakerInternalMap.this.size(); } @Override // java.util.AbstractCollection, java.util.Collection public boolean isEmpty() { return MapMakerInternalMap.this.isEmpty(); } @Override // java.util.AbstractCollection, java.util.Collection public boolean contains(Object obj) { return MapMakerInternalMap.this.containsValue(obj); } @Override // java.util.AbstractCollection, java.util.Collection public void clear() { MapMakerInternalMap.this.clear(); } @Override // java.util.AbstractCollection, java.util.Collection public Object[] toArray() { return MapMakerInternalMap.toArrayList(this).toArray(); } @Override // java.util.AbstractCollection, java.util.Collection public T[] toArray(T[] tArr) { return (T[]) MapMakerInternalMap.toArrayList(this).toArray(tArr); } } /* loaded from: classes3.dex */ final class EntrySet extends SafeToArraySet> { EntrySet() { super(); } @Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set public Iterator> iterator() { return new EntryIterator(MapMakerInternalMap.this); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public boolean contains(Object obj) { Map.Entry entry; Object key; Object obj2; return (obj instanceof Map.Entry) && (key = (entry = (Map.Entry) obj).getKey()) != null && (obj2 = MapMakerInternalMap.this.get(key)) != null && MapMakerInternalMap.this.valueEquivalence().equivalent(entry.getValue(), obj2); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public boolean remove(Object obj) { Map.Entry entry; Object key; return (obj instanceof Map.Entry) && (key = (entry = (Map.Entry) obj).getKey()) != null && MapMakerInternalMap.this.remove(key, entry.getValue()); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public int size() { return MapMakerInternalMap.this.size(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public boolean isEmpty() { return MapMakerInternalMap.this.isEmpty(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public void clear() { MapMakerInternalMap.this.clear(); } } /* loaded from: classes3.dex */ private static abstract class SafeToArraySet extends AbstractSet { private SafeToArraySet() { } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public Object[] toArray() { return MapMakerInternalMap.toArrayList(this).toArray(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public T[] toArray(T[] tArr) { return (T[]) MapMakerInternalMap.toArrayList(this).toArray(tArr); } } /* JADX INFO: Access modifiers changed from: private */ public static ArrayList toArrayList(Collection collection) { ArrayList arrayList = new ArrayList<>(collection.size()); Iterators.addAll(arrayList, collection.iterator()); return arrayList; } Object writeReplace() { return new SerializationProxy(this.entryHelper.keyStrength(), this.entryHelper.valueStrength(), this.keyEquivalence, this.entryHelper.valueStrength().defaultEquivalence(), this.concurrencyLevel, this); } /* loaded from: classes3.dex */ static abstract class AbstractSerializationProxy extends ForwardingConcurrentMap implements Serializable { private static final long serialVersionUID = 3; final int concurrencyLevel; transient ConcurrentMap delegate; final Equivalence keyEquivalence; final Strength keyStrength; final Equivalence valueEquivalence; final Strength valueStrength; /* JADX INFO: Access modifiers changed from: protected */ @Override // com.google.common.collect.ForwardingConcurrentMap, com.google.common.collect.ForwardingMap, com.google.common.collect.ForwardingObject public ConcurrentMap delegate() { return this.delegate; } AbstractSerializationProxy(Strength strength, Strength strength2, Equivalence equivalence, Equivalence equivalence2, int i, ConcurrentMap concurrentMap) { this.keyStrength = strength; this.valueStrength = strength2; this.keyEquivalence = equivalence; this.valueEquivalence = equivalence2; this.concurrencyLevel = i; this.delegate = concurrentMap; } void writeMapTo(ObjectOutputStream objectOutputStream) throws IOException { objectOutputStream.writeInt(this.delegate.size()); for (Map.Entry entry : this.delegate.entrySet()) { objectOutputStream.writeObject(entry.getKey()); objectOutputStream.writeObject(entry.getValue()); } objectOutputStream.writeObject(null); } MapMaker readMapMaker(ObjectInputStream objectInputStream) throws IOException { return new MapMaker().initialCapacity(objectInputStream.readInt()).setKeyStrength(this.keyStrength).setValueStrength(this.valueStrength).keyEquivalence(this.keyEquivalence).concurrencyLevel(this.concurrencyLevel); } /* JADX WARN: Multi-variable type inference failed */ void readEntries(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException { while (true) { Object readObject = objectInputStream.readObject(); if (readObject == null) { return; } this.delegate.put(readObject, objectInputStream.readObject()); } } } /* loaded from: classes3.dex */ private static final class SerializationProxy extends AbstractSerializationProxy { private static final long serialVersionUID = 3; SerializationProxy(Strength strength, Strength strength2, Equivalence equivalence, Equivalence equivalence2, int i, ConcurrentMap concurrentMap) { super(strength, strength2, equivalence, equivalence2, i, concurrentMap); } private void writeObject(ObjectOutputStream objectOutputStream) throws IOException { objectOutputStream.defaultWriteObject(); writeMapTo(objectOutputStream); } private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException { objectInputStream.defaultReadObject(); this.delegate = readMapMaker(objectInputStream).makeMap(); readEntries(objectInputStream); } private Object readResolve() { return this.delegate; } } }