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 o.C13415fZr; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.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; transient Set> entrySet; final Equivalence keyEquivalence; transient Set keySet; final transient int segmentMask; final transient int segmentShift; final transient Segment[] segments; transient Collection values; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public interface InternalEntry> { int getHash(); K getKey(); E getNext(); V getValue(); } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public interface InternalEntryHelper, S extends Segment> { E copy(S s, E e, E e2); Strength keyStrength(); E newEntry(S s, K k, int i, 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: classes2.dex */ public enum Strength { STRONG { // from class: com.google.common.collect.MapMakerInternalMap.Strength.1 @Override // com.google.common.collect.MapMakerInternalMap.Strength final Equivalence defaultEquivalence() { return Equivalence.equals(); } }, WEAK { // from class: com.google.common.collect.MapMakerInternalMap.Strength.2 @Override // com.google.common.collect.MapMakerInternalMap.Strength final Equivalence defaultEquivalence() { return Equivalence.identity(); } }; /* JADX INFO: Access modifiers changed from: package-private */ public abstract Equivalence defaultEquivalence(); } /* loaded from: classes2.dex */ interface StrongValueEntry> extends InternalEntry { } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public interface WeakValueEntry> extends InternalEntry { void clearValue(); WeakValueReference getValueReference(); } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public interface WeakValueReference> { void clear(); WeakValueReference copyFor(ReferenceQueue referenceQueue, E e); 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); } 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: classes2.dex */ public static abstract class AbstractStrongKeyEntry> implements InternalEntry { final int hash; final K key; final E next; AbstractStrongKeyEntry(K k, int i, E e) { this.key = k; this.hash = i; this.next = e; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public E getNext() { return this.next; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public K getKey() { return this.key; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public int getHash() { return this.hash; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static final class StrongKeyStrongValueEntry extends AbstractStrongKeyEntry> implements StrongValueEntry> { private volatile V value; StrongKeyStrongValueEntry(K k, int i, StrongKeyStrongValueEntry strongKeyStrongValueEntry) { super(k, i, strongKeyStrongValueEntry); this.value = null; } final 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: classes2.dex */ public static final class Helper implements InternalEntryHelper, StrongKeyStrongValueSegment> { private static final Helper INSTANCE = new Helper<>(); Helper() { } /* JADX WARN: Multi-variable type inference failed */ @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final /* bridge */ /* synthetic */ InternalEntry newEntry(Segment segment, Object obj, int i, 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 final /* 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 final Strength keyStrength() { return Strength.STRONG; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final Strength valueStrength() { return Strength.STRONG; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final StrongKeyStrongValueSegment newSegment(MapMakerInternalMap, StrongKeyStrongValueSegment> mapMakerInternalMap, int i, int i2) { return new StrongKeyStrongValueSegment<>(mapMakerInternalMap, i, i2); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final StrongKeyStrongValueEntry copy(StrongKeyStrongValueSegment strongKeyStrongValueSegment, StrongKeyStrongValueEntry strongKeyStrongValueEntry, StrongKeyStrongValueEntry strongKeyStrongValueEntry2) { return strongKeyStrongValueEntry.copy(strongKeyStrongValueEntry2); } public final void setValue(StrongKeyStrongValueSegment strongKeyStrongValueSegment, StrongKeyStrongValueEntry strongKeyStrongValueEntry, V v) { strongKeyStrongValueEntry.setValue(v); } public final StrongKeyStrongValueEntry newEntry(StrongKeyStrongValueSegment strongKeyStrongValueSegment, K k, int i, StrongKeyStrongValueEntry strongKeyStrongValueEntry) { return new StrongKeyStrongValueEntry<>(k, i, strongKeyStrongValueEntry); } static Helper instance() { return (Helper) INSTANCE; } } final void setValue(V v) { this.value = v; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public final V getValue() { return this.value; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static final class StrongKeyWeakValueEntry extends AbstractStrongKeyEntry> implements WeakValueEntry> { private volatile WeakValueReference> valueReference; StrongKeyWeakValueEntry(K k, int i, StrongKeyWeakValueEntry strongKeyWeakValueEntry) { super(k, i, strongKeyWeakValueEntry); this.valueReference = MapMakerInternalMap.unsetWeakValueReference(); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public final V getValue() { return this.valueReference.get(); } @Override // com.google.common.collect.MapMakerInternalMap.WeakValueEntry public final void clearValue() { this.valueReference.clear(); } final void setValue(V v, ReferenceQueue referenceQueue) { WeakValueReference> weakValueReference = this.valueReference; this.valueReference = new WeakValueReferenceImpl(referenceQueue, v, this); weakValueReference.clear(); } final 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: classes2.dex */ public static final class Helper implements InternalEntryHelper, StrongKeyWeakValueSegment> { private static final Helper INSTANCE = new Helper<>(); Helper() { } /* JADX WARN: Multi-variable type inference failed */ @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final /* bridge */ /* synthetic */ InternalEntry newEntry(Segment segment, Object obj, int i, 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 final /* 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 final Strength keyStrength() { return Strength.STRONG; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final Strength valueStrength() { return Strength.WEAK; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final StrongKeyWeakValueSegment newSegment(MapMakerInternalMap, StrongKeyWeakValueSegment> mapMakerInternalMap, int i, int i2) { return new StrongKeyWeakValueSegment<>(mapMakerInternalMap, i, i2); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final StrongKeyWeakValueEntry copy(StrongKeyWeakValueSegment strongKeyWeakValueSegment, StrongKeyWeakValueEntry strongKeyWeakValueEntry, StrongKeyWeakValueEntry strongKeyWeakValueEntry2) { if (Segment.isCollected(strongKeyWeakValueEntry)) { return null; } return strongKeyWeakValueEntry.copy(((StrongKeyWeakValueSegment) strongKeyWeakValueSegment).queueForValues, strongKeyWeakValueEntry2); } public final void setValue(StrongKeyWeakValueSegment strongKeyWeakValueSegment, StrongKeyWeakValueEntry strongKeyWeakValueEntry, V v) { strongKeyWeakValueEntry.setValue(v, ((StrongKeyWeakValueSegment) strongKeyWeakValueSegment).queueForValues); } public final StrongKeyWeakValueEntry newEntry(StrongKeyWeakValueSegment strongKeyWeakValueSegment, K k, int i, StrongKeyWeakValueEntry strongKeyWeakValueEntry) { return new StrongKeyWeakValueEntry<>(k, i, strongKeyWeakValueEntry); } static Helper instance() { return (Helper) INSTANCE; } } @Override // com.google.common.collect.MapMakerInternalMap.WeakValueEntry public final WeakValueReference> getValueReference() { return this.valueReference; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static final class StrongKeyDummyValueEntry extends AbstractStrongKeyEntry> implements StrongValueEntry> { final void setValue(MapMaker.Dummy dummy) { } StrongKeyDummyValueEntry(K k, int i, StrongKeyDummyValueEntry strongKeyDummyValueEntry) { super(k, i, strongKeyDummyValueEntry); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public final MapMaker.Dummy getValue() { return MapMaker.Dummy.VALUE; } final StrongKeyDummyValueEntry copy(StrongKeyDummyValueEntry strongKeyDummyValueEntry) { return new StrongKeyDummyValueEntry<>(this.key, this.hash, strongKeyDummyValueEntry); } /* loaded from: classes2.dex */ static final class Helper implements InternalEntryHelper, StrongKeyDummyValueSegment> { private static final Helper INSTANCE = new Helper<>(); @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final 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 final /* bridge */ /* synthetic */ InternalEntry newEntry(Segment segment, Object obj, int i, InternalEntry internalEntry) { return newEntry((StrongKeyDummyValueSegment>) segment, (StrongKeyDummyValueSegment) obj, i, (StrongKeyDummyValueEntry>) internalEntry); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final Strength keyStrength() { return Strength.STRONG; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final Strength valueStrength() { return Strength.STRONG; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final StrongKeyDummyValueSegment newSegment(MapMakerInternalMap, StrongKeyDummyValueSegment> mapMakerInternalMap, int i, int i2) { return new StrongKeyDummyValueSegment<>(mapMakerInternalMap, i, i2); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final StrongKeyDummyValueEntry copy(StrongKeyDummyValueSegment strongKeyDummyValueSegment, StrongKeyDummyValueEntry strongKeyDummyValueEntry, StrongKeyDummyValueEntry strongKeyDummyValueEntry2) { return strongKeyDummyValueEntry.copy(strongKeyDummyValueEntry2); } public final StrongKeyDummyValueEntry newEntry(StrongKeyDummyValueSegment strongKeyDummyValueSegment, K k, int i, StrongKeyDummyValueEntry strongKeyDummyValueEntry) { return new StrongKeyDummyValueEntry<>(k, i, strongKeyDummyValueEntry); } static Helper instance() { return (Helper) INSTANCE; } } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static abstract class AbstractWeakKeyEntry> extends WeakReference implements InternalEntry { final int hash; final E next; AbstractWeakKeyEntry(ReferenceQueue referenceQueue, K k, int i, E e) { super(k, referenceQueue); this.hash = i; this.next = e; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public K getKey() { return get(); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public E getNext() { return this.next; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public int getHash() { return this.hash; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static final class WeakKeyDummyValueEntry extends AbstractWeakKeyEntry> implements StrongValueEntry> { final void setValue(MapMaker.Dummy dummy) { } WeakKeyDummyValueEntry(ReferenceQueue referenceQueue, K k, int i, WeakKeyDummyValueEntry weakKeyDummyValueEntry) { super(referenceQueue, k, i, weakKeyDummyValueEntry); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public final MapMaker.Dummy getValue() { return MapMaker.Dummy.VALUE; } final WeakKeyDummyValueEntry copy(ReferenceQueue referenceQueue, WeakKeyDummyValueEntry weakKeyDummyValueEntry) { return new WeakKeyDummyValueEntry<>(referenceQueue, getKey(), this.hash, weakKeyDummyValueEntry); } /* loaded from: classes2.dex */ static final class Helper implements InternalEntryHelper, WeakKeyDummyValueSegment> { private static final Helper INSTANCE = new Helper<>(); @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final 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 final /* bridge */ /* synthetic */ InternalEntry newEntry(Segment segment, Object obj, int i, InternalEntry internalEntry) { return newEntry((WeakKeyDummyValueSegment>) segment, (WeakKeyDummyValueSegment) obj, i, (WeakKeyDummyValueEntry>) internalEntry); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final Strength keyStrength() { return Strength.WEAK; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final Strength valueStrength() { return Strength.STRONG; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final WeakKeyDummyValueSegment newSegment(MapMakerInternalMap, WeakKeyDummyValueSegment> mapMakerInternalMap, int i, int i2) { return new WeakKeyDummyValueSegment<>(mapMakerInternalMap, i, i2); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final WeakKeyDummyValueEntry copy(WeakKeyDummyValueSegment weakKeyDummyValueSegment, WeakKeyDummyValueEntry weakKeyDummyValueEntry, WeakKeyDummyValueEntry weakKeyDummyValueEntry2) { if (weakKeyDummyValueEntry.getKey() == null) { return null; } return weakKeyDummyValueEntry.copy(((WeakKeyDummyValueSegment) weakKeyDummyValueSegment).queueForKeys, weakKeyDummyValueEntry2); } public final WeakKeyDummyValueEntry newEntry(WeakKeyDummyValueSegment weakKeyDummyValueSegment, K k, int i, WeakKeyDummyValueEntry weakKeyDummyValueEntry) { return new WeakKeyDummyValueEntry<>(((WeakKeyDummyValueSegment) weakKeyDummyValueSegment).queueForKeys, k, i, weakKeyDummyValueEntry); } static Helper instance() { return (Helper) INSTANCE; } } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static final class WeakKeyStrongValueEntry extends AbstractWeakKeyEntry> implements StrongValueEntry> { private volatile V value; WeakKeyStrongValueEntry(ReferenceQueue referenceQueue, K k, int i, WeakKeyStrongValueEntry weakKeyStrongValueEntry) { super(referenceQueue, k, i, weakKeyStrongValueEntry); this.value = null; } final 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: classes2.dex */ public static final class Helper implements InternalEntryHelper, WeakKeyStrongValueSegment> { private static final Helper INSTANCE = new Helper<>(); Helper() { } /* JADX WARN: Multi-variable type inference failed */ @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final /* bridge */ /* synthetic */ InternalEntry newEntry(Segment segment, Object obj, int i, 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 final /* 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 final Strength keyStrength() { return Strength.WEAK; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final Strength valueStrength() { return Strength.STRONG; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final WeakKeyStrongValueSegment newSegment(MapMakerInternalMap, WeakKeyStrongValueSegment> mapMakerInternalMap, int i, int i2) { return new WeakKeyStrongValueSegment<>(mapMakerInternalMap, i, i2); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final WeakKeyStrongValueEntry copy(WeakKeyStrongValueSegment weakKeyStrongValueSegment, WeakKeyStrongValueEntry weakKeyStrongValueEntry, WeakKeyStrongValueEntry weakKeyStrongValueEntry2) { if (weakKeyStrongValueEntry.getKey() == null) { return null; } return weakKeyStrongValueEntry.copy(((WeakKeyStrongValueSegment) weakKeyStrongValueSegment).queueForKeys, weakKeyStrongValueEntry2); } public final void setValue(WeakKeyStrongValueSegment weakKeyStrongValueSegment, WeakKeyStrongValueEntry weakKeyStrongValueEntry, V v) { weakKeyStrongValueEntry.setValue(v); } public final WeakKeyStrongValueEntry newEntry(WeakKeyStrongValueSegment weakKeyStrongValueSegment, K k, int i, WeakKeyStrongValueEntry weakKeyStrongValueEntry) { return new WeakKeyStrongValueEntry<>(((WeakKeyStrongValueSegment) weakKeyStrongValueSegment).queueForKeys, k, i, weakKeyStrongValueEntry); } static Helper instance() { return (Helper) INSTANCE; } } final void setValue(V v) { this.value = v; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public final V getValue() { return this.value; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static final class WeakKeyWeakValueEntry extends AbstractWeakKeyEntry> implements WeakValueEntry> { private volatile WeakValueReference> valueReference; WeakKeyWeakValueEntry(ReferenceQueue referenceQueue, K k, int i, WeakKeyWeakValueEntry weakKeyWeakValueEntry) { super(referenceQueue, k, i, weakKeyWeakValueEntry); this.valueReference = MapMakerInternalMap.unsetWeakValueReference(); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public final V getValue() { return this.valueReference.get(); } final 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 final void clearValue() { this.valueReference.clear(); } final 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: classes2.dex */ public static final class Helper implements InternalEntryHelper, WeakKeyWeakValueSegment> { private static final Helper INSTANCE = new Helper<>(); Helper() { } /* JADX WARN: Multi-variable type inference failed */ @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final /* bridge */ /* synthetic */ InternalEntry newEntry(Segment segment, Object obj, int i, 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 final /* 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 final Strength keyStrength() { return Strength.WEAK; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final Strength valueStrength() { return Strength.WEAK; } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final WeakKeyWeakValueSegment newSegment(MapMakerInternalMap, WeakKeyWeakValueSegment> mapMakerInternalMap, int i, int i2) { return new WeakKeyWeakValueSegment<>(mapMakerInternalMap, i, i2); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper public final WeakKeyWeakValueEntry copy(WeakKeyWeakValueSegment weakKeyWeakValueSegment, WeakKeyWeakValueEntry weakKeyWeakValueEntry, WeakKeyWeakValueEntry weakKeyWeakValueEntry2) { if (weakKeyWeakValueEntry.getKey() == null || Segment.isCollected(weakKeyWeakValueEntry)) { return null; } return weakKeyWeakValueEntry.copy(((WeakKeyWeakValueSegment) weakKeyWeakValueSegment).queueForKeys, ((WeakKeyWeakValueSegment) weakKeyWeakValueSegment).queueForValues, weakKeyWeakValueEntry2); } public final void setValue(WeakKeyWeakValueSegment weakKeyWeakValueSegment, WeakKeyWeakValueEntry weakKeyWeakValueEntry, V v) { weakKeyWeakValueEntry.setValue(v, ((WeakKeyWeakValueSegment) weakKeyWeakValueSegment).queueForValues); } public final WeakKeyWeakValueEntry newEntry(WeakKeyWeakValueSegment weakKeyWeakValueSegment, K k, int i, WeakKeyWeakValueEntry weakKeyWeakValueEntry) { return new WeakKeyWeakValueEntry<>(((WeakKeyWeakValueSegment) weakKeyWeakValueSegment).queueForKeys, k, i, weakKeyWeakValueEntry); } static Helper instance() { return (Helper) INSTANCE; } } @Override // com.google.common.collect.MapMakerInternalMap.WeakValueEntry public final WeakValueReference> getValueReference() { return this.valueReference; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.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 final DummyInternalEntry getNext() { throw new AssertionError(); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public final int getHash() { throw new AssertionError(); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public final Object getKey() { throw new AssertionError(); } @Override // com.google.common.collect.MapMakerInternalMap.InternalEntry public final Object getValue() { throw new AssertionError(); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static final class WeakValueReferenceImpl> extends WeakReference implements WeakValueReference { final E entry; WeakValueReferenceImpl(ReferenceQueue referenceQueue, V v, E e) { super(v, referenceQueue); this.entry = e; } @Override // com.google.common.collect.MapMakerInternalMap.WeakValueReference public final WeakValueReference copyFor(ReferenceQueue referenceQueue, E e) { return new WeakValueReferenceImpl(referenceQueue, get(), e); } @Override // com.google.common.collect.MapMakerInternalMap.WeakValueReference public final E getEntry() { return this.entry; } } 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[(i >>> this.segmentShift) & this.segmentMask]; } 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: classes2.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(); 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, 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, 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)); } 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 & (r0.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; C13415fZr c13415fZr = (AtomicReferenceArray) newEntryArray(length << 1); this.threshold = (c13415fZr.length() * 3) / 4; int length2 = c13415fZr.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) { c13415fZr.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(); } c13415fZr.set(hash, internalEntry); while (e != internalEntry) { int hash3 = e.getHash() & length2; InternalEntry copyEntry = copyEntry(e, (InternalEntry) c13415fZr.get(hash3)); if (copyEntry != null) { c13415fZr.set(hash3, copyEntry); } else { i--; } e = e.getNext(); } } } } this.table = c13415fZr; 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; atomicReferenceArray.set(length, removeFromChain); this.count = i2 - 1; } 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; atomicReferenceArray.set(length, removeFromChain); this.count = i2 - 1; } 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; atomicReferenceArray.set(length, removeFromChain); this.count = i2 - 1; 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; r0.set(r1, r9); r8.count = r10 - 1; */ /* 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 r0.set(r1, r9) // Catch: java.lang.Throwable -> L69 int r10 = r10 - r2 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; atomicReferenceArray.set(length, removeFromChain); this.count = i2 - 1; 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; atomicReferenceArray.set(length, removeFromChain); this.count = i2 - 1; 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; atomicReferenceArray.set(length, removeFromChain); this.count = i - 1; return true; } } return false; } static > boolean isCollected(E e) { return e.getValue() == null; } 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: classes2.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 final StrongKeyStrongValueSegment self() { return this; } StrongKeyStrongValueSegment(MapMakerInternalMap, StrongKeyStrongValueSegment> mapMakerInternalMap, int i, int i2) { super(mapMakerInternalMap, i, i2); } @Override // com.google.common.collect.MapMakerInternalMap.Segment public final StrongKeyStrongValueEntry castForTesting(InternalEntry internalEntry) { return (StrongKeyStrongValueEntry) internalEntry; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static final class StrongKeyWeakValueSegment extends Segment, StrongKeyWeakValueSegment> { private final ReferenceQueue queueForValues; /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.common.collect.MapMakerInternalMap.Segment public final 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 final StrongKeyWeakValueEntry castForTesting(InternalEntry internalEntry) { return (StrongKeyWeakValueEntry) internalEntry; } @Override // com.google.common.collect.MapMakerInternalMap.Segment public final WeakValueReference> getWeakValueReferenceForTesting(InternalEntry internalEntry) { return castForTesting((InternalEntry) internalEntry).getValueReference(); } @Override // com.google.common.collect.MapMakerInternalMap.Segment public final WeakValueReference> newWeakValueReferenceForTesting(InternalEntry internalEntry, V v) { return new WeakValueReferenceImpl(this.queueForValues, v, castForTesting((InternalEntry) internalEntry)); } @Override // com.google.common.collect.MapMakerInternalMap.Segment public final 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 final void maybeDrainReferenceQueues() { drainValueReferenceQueue(this.queueForValues); } @Override // com.google.common.collect.MapMakerInternalMap.Segment final void maybeClearReferenceQueues() { clearReferenceQueue(this.queueForValues); } @Override // com.google.common.collect.MapMakerInternalMap.Segment final ReferenceQueue getValueReferenceQueueForTesting() { return this.queueForValues; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.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 final StrongKeyDummyValueSegment self() { return this; } StrongKeyDummyValueSegment(MapMakerInternalMap, StrongKeyDummyValueSegment> mapMakerInternalMap, int i, int i2) { super(mapMakerInternalMap, i, i2); } @Override // com.google.common.collect.MapMakerInternalMap.Segment public final StrongKeyDummyValueEntry castForTesting(InternalEntry internalEntry) { return (StrongKeyDummyValueEntry) internalEntry; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static final class WeakKeyStrongValueSegment extends Segment, WeakKeyStrongValueSegment> { private final ReferenceQueue queueForKeys; /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.common.collect.MapMakerInternalMap.Segment public final 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 final WeakKeyStrongValueEntry castForTesting(InternalEntry internalEntry) { return (WeakKeyStrongValueEntry) internalEntry; } @Override // com.google.common.collect.MapMakerInternalMap.Segment final void maybeDrainReferenceQueues() { drainKeyReferenceQueue(this.queueForKeys); } @Override // com.google.common.collect.MapMakerInternalMap.Segment final void maybeClearReferenceQueues() { clearReferenceQueue(this.queueForKeys); } @Override // com.google.common.collect.MapMakerInternalMap.Segment final ReferenceQueue getKeyReferenceQueueForTesting() { return this.queueForKeys; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static final class WeakKeyWeakValueSegment extends Segment, WeakKeyWeakValueSegment> { private final ReferenceQueue queueForKeys; private final ReferenceQueue queueForValues; /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.common.collect.MapMakerInternalMap.Segment public final 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 final WeakKeyWeakValueEntry castForTesting(InternalEntry internalEntry) { return (WeakKeyWeakValueEntry) internalEntry; } @Override // com.google.common.collect.MapMakerInternalMap.Segment public final WeakValueReference> getWeakValueReferenceForTesting(InternalEntry internalEntry) { return castForTesting((InternalEntry) internalEntry).getValueReference(); } @Override // com.google.common.collect.MapMakerInternalMap.Segment public final WeakValueReference> newWeakValueReferenceForTesting(InternalEntry internalEntry, V v) { return new WeakValueReferenceImpl(this.queueForValues, v, castForTesting((InternalEntry) internalEntry)); } @Override // com.google.common.collect.MapMakerInternalMap.Segment public final 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 final void maybeDrainReferenceQueues() { drainKeyReferenceQueue(this.queueForKeys); drainValueReferenceQueue(this.queueForValues); } @Override // com.google.common.collect.MapMakerInternalMap.Segment final void maybeClearReferenceQueues() { clearReferenceQueue(this.queueForKeys); } @Override // com.google.common.collect.MapMakerInternalMap.Segment final ReferenceQueue getValueReferenceQueueForTesting() { return this.queueForValues; } @Override // com.google.common.collect.MapMakerInternalMap.Segment final ReferenceQueue getKeyReferenceQueueForTesting() { return this.queueForKeys; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static final class WeakKeyDummyValueSegment extends Segment, WeakKeyDummyValueSegment> { private final ReferenceQueue queueForKeys; /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.common.collect.MapMakerInternalMap.Segment public final 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 final WeakKeyDummyValueEntry castForTesting(InternalEntry internalEntry) { return (WeakKeyDummyValueEntry) internalEntry; } @Override // com.google.common.collect.MapMakerInternalMap.Segment final void maybeDrainReferenceQueues() { drainKeyReferenceQueue(this.queueForKeys); } @Override // com.google.common.collect.MapMakerInternalMap.Segment final void maybeClearReferenceQueues() { clearReferenceQueue(this.queueForKeys); } @Override // com.google.common.collect.MapMakerInternalMap.Segment final ReferenceQueue getKeyReferenceQueueForTesting() { return this.queueForKeys; } } /* loaded from: classes2.dex */ static final class CleanupMapTask implements Runnable { final WeakReference> mapReference; public CleanupMapTask(MapMakerInternalMap mapMakerInternalMap) { this.mapReference = new WeakReference<>(mapMakerInternalMap); } @Override // java.lang.Runnable public final 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 += r0[i].count; } return Ints.saturatedCast(j); } @Override // java.util.AbstractMap, java.util.Map public V get(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(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(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(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(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(Object obj, 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, 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); 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); 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); this.entrySet = entrySet; return entrySet; } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public abstract class HashIterator implements Iterator { Segment currentSegment; AtomicReferenceArray currentTable; MapMakerInternalMap.WriteThroughEntry lastReturned; E nextEntry; MapMakerInternalMap.WriteThroughEntry nextExternal; int nextSegmentIndex; int nextTableIndex = -1; final MapMakerInternalMap this$0; @Override // java.util.Iterator public abstract T next(); HashIterator(MapMakerInternalMap mapMakerInternalMap) { this.this$0 = mapMakerInternalMap; this.nextSegmentIndex = mapMakerInternalMap.segments.length - 1; advance(); } final void advance() { this.nextExternal = null; if (nextInChain() || nextInTable()) { return; } while (this.nextSegmentIndex >= 0) { Segment[] segmentArr = this.this$0.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) { E e2 = (E) e.getNext(); this.nextEntry = e2; 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 = this.this$0.getLiveValue(e); if (liveValue == null) { this.currentSegment.postReadCleanup(); return false; } this.nextExternal = new WriteThroughEntry(this.this$0, 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); this.this$0.remove(this.lastReturned.getKey()); this.lastReturned = null; } @Override // java.util.Iterator public boolean hasNext() { return this.nextExternal != null; } } /* loaded from: classes2.dex */ final class KeyIterator extends HashIterator { KeyIterator(MapMakerInternalMap mapMakerInternalMap) { super(mapMakerInternalMap); } @Override // com.google.common.collect.MapMakerInternalMap.HashIterator, java.util.Iterator public final K next() { return nextEntry().getKey(); } } /* loaded from: classes2.dex */ final class ValueIterator extends HashIterator { ValueIterator(MapMakerInternalMap mapMakerInternalMap) { super(mapMakerInternalMap); } @Override // com.google.common.collect.MapMakerInternalMap.HashIterator, java.util.Iterator public final V next() { return nextEntry().getValue(); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public final class WriteThroughEntry extends AbstractMapEntry { final K key; final MapMakerInternalMap this$0; V value; WriteThroughEntry(MapMakerInternalMap mapMakerInternalMap, K k, V v) { this.this$0 = mapMakerInternalMap; this.key = k; this.value = v; } @Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry public final boolean equals(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 final int hashCode() { return this.key.hashCode() ^ this.value.hashCode(); } @Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry public final V setValue(V v) { V put = this.this$0.put(this.key, v); this.value = v; return put; } @Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry public final V getValue() { return this.value; } @Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry public final K getKey() { return this.key; } } /* loaded from: classes2.dex */ final class EntryIterator extends HashIterator { EntryIterator(MapMakerInternalMap mapMakerInternalMap) { super(mapMakerInternalMap); } @Override // com.google.common.collect.MapMakerInternalMap.HashIterator, java.util.Iterator public final Map.Entry next() { return nextEntry(); } } /* loaded from: classes2.dex */ final class KeySet extends SafeToArraySet { final MapMakerInternalMap this$0; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ KeySet(MapMakerInternalMap mapMakerInternalMap) { super(); this.this$0 = mapMakerInternalMap; } @Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set public final Iterator iterator() { return new KeyIterator(this.this$0); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public final int size() { return this.this$0.size(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public final boolean isEmpty() { return this.this$0.isEmpty(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public final boolean contains(Object obj) { return this.this$0.containsKey(obj); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public final boolean remove(Object obj) { return this.this$0.remove(obj) != null; } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public final void clear() { this.this$0.clear(); } } /* loaded from: classes2.dex */ final class Values extends AbstractCollection { final MapMakerInternalMap this$0; Values(MapMakerInternalMap mapMakerInternalMap) { this.this$0 = mapMakerInternalMap; } @Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable public final Iterator iterator() { return new ValueIterator(this.this$0); } @Override // java.util.AbstractCollection, java.util.Collection public final int size() { return this.this$0.size(); } @Override // java.util.AbstractCollection, java.util.Collection public final boolean isEmpty() { return this.this$0.isEmpty(); } @Override // java.util.AbstractCollection, java.util.Collection public final boolean contains(Object obj) { return this.this$0.containsValue(obj); } @Override // java.util.AbstractCollection, java.util.Collection public final void clear() { this.this$0.clear(); } @Override // java.util.AbstractCollection, java.util.Collection public final Object[] toArray() { return MapMakerInternalMap.toArrayList(this).toArray(); } @Override // java.util.AbstractCollection, java.util.Collection public final T[] toArray(T[] tArr) { return (T[]) MapMakerInternalMap.toArrayList(this).toArray(tArr); } } /* loaded from: classes2.dex */ final class EntrySet extends SafeToArraySet> { final MapMakerInternalMap this$0; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ EntrySet(MapMakerInternalMap mapMakerInternalMap) { super(); this.this$0 = mapMakerInternalMap; } @Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set public final Iterator> iterator() { return new EntryIterator(this.this$0); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public final boolean contains(Object obj) { Map.Entry entry; Object key; V v; return (obj instanceof Map.Entry) && (key = (entry = (Map.Entry) obj).getKey()) != null && (v = this.this$0.get(key)) != null && this.this$0.valueEquivalence().equivalent(entry.getValue(), v); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public final boolean remove(Object obj) { Map.Entry entry; Object key; return (obj instanceof Map.Entry) && (key = (entry = (Map.Entry) obj).getKey()) != null && this.this$0.remove(key, entry.getValue()); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public final int size() { return this.this$0.size(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public final boolean isEmpty() { return this.this$0.isEmpty(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public final void clear() { this.this$0.clear(); } } /* loaded from: classes2.dex */ 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: classes2.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; 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()); } } /* 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; } } /* loaded from: classes2.dex */ 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; } } static > WeakValueReference unsetWeakValueReference() { return (WeakValueReference) UNSET_WEAK_VALUE_REFERENCE; } }