Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,405 @@
package com.google.common.collect;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
abstract class AbstractBiMap<K, V> extends ForwardingMap<K, V> implements BiMap<K, V>, Serializable {
private static final long serialVersionUID = 0;
private transient Map<K, V> delegate;
private transient Set<Map.Entry<K, V>> entrySet;
transient AbstractBiMap<V, K> inverse;
private transient Set<K> keySet;
private transient Set<V> valueSet;
class BiMapEntry extends ForwardingMapEntry<K, V> {
private final Map.Entry<K, V> a;
BiMapEntry(Map.Entry<K, V> entry) {
this.a = entry;
}
@Override // com.google.common.collect.ForwardingMapEntry, java.util.Map.Entry
public V setValue(V v) {
Preconditions.b(AbstractBiMap.this.entrySet().contains(this), "entry no longer in map");
if (Objects.a(v, getValue())) {
return v;
}
Preconditions.a(!AbstractBiMap.this.containsValue(v), "value already present: %s", v);
V value = this.a.setValue(v);
Preconditions.b(Objects.a(v, AbstractBiMap.this.get(getKey())), "entry no longer in map");
AbstractBiMap.this.updateInverseMap(getKey(), true, value, v);
return value;
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.ForwardingObject
public Map.Entry<K, V> delegate() {
return this.a;
}
}
private class EntrySet extends ForwardingSet<Map.Entry<K, V>> {
final Set<Map.Entry<K, V>> a;
private EntrySet() {
this.a = AbstractBiMap.this.delegate.entrySet();
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public void clear() {
AbstractBiMap.this.clear();
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return Maps.a((Collection) delegate(), obj);
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public boolean containsAll(Collection<?> collection) {
return standardContainsAll(collection);
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<Map.Entry<K, V>> iterator() {
return AbstractBiMap.this.entrySetIterator();
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
if (!this.a.contains(obj)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
((AbstractBiMap) AbstractBiMap.this.inverse).delegate.remove(entry.getValue());
this.a.remove(entry);
return true;
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public boolean removeAll(Collection<?> collection) {
return standardRemoveAll(collection);
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public boolean retainAll(Collection<?> collection) {
return standardRetainAll(collection);
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public Object[] toArray() {
return standardToArray();
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public <T> T[] toArray(T[] tArr) {
return (T[]) standardToArray(tArr);
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.ForwardingSet, com.google.common.collect.ForwardingCollection, com.google.common.collect.ForwardingObject
public Set<Map.Entry<K, V>> delegate() {
return this.a;
}
}
static class Inverse<K, V> extends AbstractBiMap<K, V> {
Inverse(Map<K, V> map, AbstractBiMap<V, K> abstractBiMap) {
super(map, abstractBiMap);
}
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
objectInputStream.defaultReadObject();
setInverse((AbstractBiMap) objectInputStream.readObject());
}
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
objectOutputStream.defaultWriteObject();
objectOutputStream.writeObject(inverse());
}
@Override // com.google.common.collect.AbstractBiMap
K checkKey(K k) {
return this.inverse.checkValue(k);
}
@Override // com.google.common.collect.AbstractBiMap
V checkValue(V v) {
return this.inverse.checkKey(v);
}
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.ForwardingMap, com.google.common.collect.ForwardingObject
protected /* bridge */ /* synthetic */ Object delegate() {
return super.delegate();
}
Object readResolve() {
return inverse().inverse();
}
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.ForwardingMap, java.util.Map
public /* bridge */ /* synthetic */ Collection values() {
return super.values();
}
}
private class ValueSet extends ForwardingSet<V> {
final Set<V> a;
private ValueSet() {
this.a = AbstractBiMap.this.inverse.keySet();
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<V> iterator() {
return Maps.b(AbstractBiMap.this.entrySet().iterator());
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public Object[] toArray() {
return standardToArray();
}
@Override // com.google.common.collect.ForwardingObject
public String toString() {
return standardToString();
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public <T> T[] toArray(T[] tArr) {
return (T[]) standardToArray(tArr);
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.ForwardingSet, com.google.common.collect.ForwardingCollection, com.google.common.collect.ForwardingObject
public Set<V> delegate() {
return this.a;
}
}
private V putInBothMaps(K k, V v, boolean z) {
checkKey(k);
checkValue(v);
boolean containsKey = containsKey(k);
if (containsKey && Objects.a(v, get(k))) {
return v;
}
if (z) {
inverse().remove(v);
} else {
Preconditions.a(!containsValue(v), "value already present: %s", v);
}
V put = this.delegate.put(k, v);
updateInverseMap(k, containsKey, put, v);
return put;
}
/* JADX INFO: Access modifiers changed from: private */
public V removeFromBothMaps(Object obj) {
V remove = this.delegate.remove(obj);
removeFromInverseMap(remove);
return remove;
}
/* JADX INFO: Access modifiers changed from: private */
public void removeFromInverseMap(V v) {
this.inverse.delegate.remove(v);
}
/* JADX INFO: Access modifiers changed from: private */
public void updateInverseMap(K k, boolean z, V v, V v2) {
if (z) {
removeFromInverseMap(v);
}
this.inverse.delegate.put(v2, k);
}
K checkKey(K k) {
return k;
}
V checkValue(V v) {
return v;
}
@Override // com.google.common.collect.ForwardingMap, java.util.Map
public void clear() {
this.delegate.clear();
this.inverse.delegate.clear();
}
@Override // com.google.common.collect.ForwardingMap, java.util.Map
public boolean containsValue(Object obj) {
return this.inverse.containsKey(obj);
}
@Override // com.google.common.collect.ForwardingMap, java.util.Map
public Set<Map.Entry<K, V>> entrySet() {
Set<Map.Entry<K, V>> set = this.entrySet;
if (set != null) {
return set;
}
EntrySet entrySet = new EntrySet();
this.entrySet = entrySet;
return entrySet;
}
Iterator<Map.Entry<K, V>> entrySetIterator() {
final Iterator<Map.Entry<K, V>> it = this.delegate.entrySet().iterator();
return new Iterator<Map.Entry<K, V>>() { // from class: com.google.common.collect.AbstractBiMap.1
Map.Entry<K, V> a;
@Override // java.util.Iterator
public boolean hasNext() {
return it.hasNext();
}
@Override // java.util.Iterator
public void remove() {
CollectPreconditions.a(this.a != null);
V value = this.a.getValue();
it.remove();
AbstractBiMap.this.removeFromInverseMap(value);
}
@Override // java.util.Iterator
public Map.Entry<K, V> next() {
this.a = (Map.Entry) it.next();
return new BiMapEntry(this.a);
}
};
}
public V forcePut(K k, V v) {
return putInBothMaps(k, v, true);
}
@Override // com.google.common.collect.BiMap
public BiMap<V, K> inverse() {
return this.inverse;
}
@Override // com.google.common.collect.ForwardingMap, java.util.Map
public Set<K> keySet() {
Set<K> set = this.keySet;
if (set != null) {
return set;
}
KeySet keySet = new KeySet();
this.keySet = keySet;
return keySet;
}
AbstractBiMap<V, K> makeInverse(Map<V, K> map) {
return new Inverse(map, this);
}
@Override // com.google.common.collect.ForwardingMap, java.util.Map
public V put(K k, V v) {
return putInBothMaps(k, v, false);
}
@Override // com.google.common.collect.ForwardingMap, java.util.Map
public void putAll(Map<? extends K, ? extends V> map) {
for (Map.Entry<? extends K, ? extends V> entry : map.entrySet()) {
put(entry.getKey(), entry.getValue());
}
}
@Override // com.google.common.collect.ForwardingMap, java.util.Map
public V remove(Object obj) {
if (containsKey(obj)) {
return removeFromBothMaps(obj);
}
return null;
}
void setDelegates(Map<K, V> map, Map<V, K> map2) {
Preconditions.b(this.delegate == null);
Preconditions.b(this.inverse == null);
Preconditions.a(map.isEmpty());
Preconditions.a(map2.isEmpty());
Preconditions.a(map != map2);
this.delegate = map;
this.inverse = makeInverse(map2);
}
void setInverse(AbstractBiMap<V, K> abstractBiMap) {
this.inverse = abstractBiMap;
}
private class KeySet extends ForwardingSet<K> {
private KeySet() {
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public void clear() {
AbstractBiMap.this.clear();
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<K> iterator() {
return Maps.a(AbstractBiMap.this.entrySet().iterator());
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
if (!contains(obj)) {
return false;
}
AbstractBiMap.this.removeFromBothMaps(obj);
return true;
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public boolean removeAll(Collection<?> collection) {
return standardRemoveAll(collection);
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public boolean retainAll(Collection<?> collection) {
return standardRetainAll(collection);
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.ForwardingSet, com.google.common.collect.ForwardingCollection, com.google.common.collect.ForwardingObject
public Set<K> delegate() {
return AbstractBiMap.this.delegate.keySet();
}
}
AbstractBiMap(Map<K, V> map, Map<V, K> map2) {
setDelegates(map, map2);
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.ForwardingMap, com.google.common.collect.ForwardingObject
public Map<K, V> delegate() {
return this.delegate;
}
@Override // com.google.common.collect.ForwardingMap, java.util.Map
public Set<V> values() {
Set<V> set = this.valueSet;
if (set != null) {
return set;
}
ValueSet valueSet = new ValueSet();
this.valueSet = valueSet;
return valueSet;
}
private AbstractBiMap(Map<K, V> map, AbstractBiMap<V, K> abstractBiMap) {
this.delegate = map;
this.inverse = abstractBiMap;
}
}

View File

@@ -0,0 +1,62 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import java.util.NoSuchElementException;
/* loaded from: classes.dex */
abstract class AbstractIndexedListIterator<E> extends UnmodifiableListIterator<E> {
private final int a;
private int b;
protected AbstractIndexedListIterator(int i) {
this(i, 0);
}
protected abstract E a(int i);
@Override // java.util.Iterator, java.util.ListIterator
public final boolean hasNext() {
return this.b < this.a;
}
@Override // java.util.ListIterator
public final boolean hasPrevious() {
return this.b > 0;
}
@Override // java.util.Iterator, java.util.ListIterator
public final E next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
int i = this.b;
this.b = i + 1;
return a(i);
}
@Override // java.util.ListIterator
public final int nextIndex() {
return this.b;
}
@Override // java.util.ListIterator
public final E previous() {
if (!hasPrevious()) {
throw new NoSuchElementException();
}
int i = this.b - 1;
this.b = i;
return a(i);
}
@Override // java.util.ListIterator
public final int previousIndex() {
return this.b - 1;
}
protected AbstractIndexedListIterator(int i, int i2) {
Preconditions.b(i2, i);
this.a = i;
this.b = i2;
}
}

View File

@@ -0,0 +1,77 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import java.util.NoSuchElementException;
/* loaded from: classes.dex */
public abstract class AbstractIterator<T> extends UnmodifiableIterator<T> {
private State a = State.NOT_READY;
private T b;
/* renamed from: com.google.common.collect.AbstractIterator$1, reason: invalid class name */
static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] a = new int[State.values().length];
static {
try {
a[State.DONE.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[State.READY.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
}
}
private enum State {
READY,
NOT_READY,
DONE,
FAILED
}
protected AbstractIterator() {
}
private boolean c() {
this.a = State.FAILED;
this.b = a();
if (this.a == State.DONE) {
return false;
}
this.a = State.READY;
return true;
}
protected abstract T a();
protected final T b() {
this.a = State.DONE;
return null;
}
@Override // java.util.Iterator
public final boolean hasNext() {
Preconditions.b(this.a != State.FAILED);
int i = AnonymousClass1.a[this.a.ordinal()];
if (i == 1) {
return false;
}
if (i != 2) {
return c();
}
return true;
}
@Override // java.util.Iterator
public final T next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
this.a = State.NOT_READY;
T t = this.b;
this.b = null;
return t;
}
}

View File

@@ -0,0 +1,68 @@
package com.google.common.collect;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
abstract class AbstractListMultimap<K, V> extends AbstractMapBasedMultimap<K, V> implements ListMultimap<K, V> {
private static final long serialVersionUID = 6588350623831699109L;
protected AbstractListMultimap(Map<K, Collection<V>> map) {
super(map);
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public Map<K, Collection<V>> asMap() {
return super.asMap();
}
@Override // com.google.common.collect.AbstractMapBasedMultimap
abstract /* bridge */ /* synthetic */ Collection createCollection();
@Override // com.google.common.collect.AbstractMapBasedMultimap
abstract List<V> createCollection();
@Override // com.google.common.collect.AbstractMultimap
public boolean equals(Object obj) {
return super.equals(obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Collection get(Object obj) {
return get((AbstractListMultimap<K, V>) obj);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public boolean put(K k, V v) {
return super.put(k, v);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ Collection replaceValues(Object obj, Iterable iterable) {
return replaceValues((AbstractListMultimap<K, V>) obj, iterable);
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractMapBasedMultimap
public List<V> createUnmodifiableEmptyCollection() {
return ImmutableList.of();
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public List<V> get(K k) {
return (List) super.get((AbstractListMultimap<K, V>) k);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public List<V> removeAll(Object obj) {
return (List) super.removeAll(obj);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap
public List<V> replaceValues(K k, Iterable<? extends V> iterable) {
return (List) super.replaceValues((AbstractListMultimap<K, V>) k, (Iterable) iterable);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,191 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import com.google.common.collect.AbstractMultiset;
import com.google.common.collect.AbstractObjectCountMap;
import com.google.common.collect.Multiset;
import com.google.common.primitives.Ints;
import java.io.InvalidObjectException;
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.Set;
/* loaded from: classes.dex */
abstract class AbstractMapBasedMultiset<E> extends AbstractMultiset<E> implements Serializable {
private static final long serialVersionUID = -2250766705698539974L;
transient AbstractObjectCountMap<E> backingMap;
private transient long size;
private class MapBasedMultisetIterator implements Iterator<E> {
final Iterator<Multiset.Entry<E>> a;
Multiset.Entry<E> b;
int c = 0;
boolean d = false;
MapBasedMultisetIterator() {
this.a = AbstractMapBasedMultiset.this.backingMap.d().iterator();
}
@Override // java.util.Iterator
public boolean hasNext() {
return this.c > 0 || this.a.hasNext();
}
@Override // java.util.Iterator
public E next() {
if (this.c == 0) {
this.b = this.a.next();
this.c = this.b.getCount();
}
this.c--;
this.d = true;
return this.b.a();
}
@Override // java.util.Iterator
public void remove() {
CollectPreconditions.a(this.d);
int count = this.b.getCount();
if (count <= 0) {
throw new ConcurrentModificationException();
}
if (count == 1) {
this.a.remove();
} else {
((AbstractObjectCountMap.MapEntry) this.b).a(count - 1);
}
AbstractMapBasedMultiset.access$010(AbstractMapBasedMultiset.this);
this.d = false;
}
}
protected AbstractMapBasedMultiset(AbstractObjectCountMap<E> abstractObjectCountMap) {
Preconditions.a(abstractObjectCountMap);
this.backingMap = abstractObjectCountMap;
this.size = super.size();
}
static /* synthetic */ long access$010(AbstractMapBasedMultiset abstractMapBasedMultiset) {
long j = abstractMapBasedMultiset.size;
abstractMapBasedMultiset.size = j - 1;
return j;
}
private void readObjectNoData() throws ObjectStreamException {
throw new InvalidObjectException("Stream data required");
}
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public int add(E e, int i) {
if (i == 0) {
return count(e);
}
Preconditions.a(i > 0, "occurrences cannot be negative: %s", i);
int a = this.backingMap.a(e);
long j = i;
long j2 = a + j;
Preconditions.a(j2 <= 2147483647L, "too many occurrences: %s", j2);
this.backingMap.a(e, (int) j2);
this.size += j;
return a;
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public void clear() {
this.backingMap.a();
this.size = 0L;
}
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public int count(Object obj) {
return this.backingMap.a(obj);
}
@Override // com.google.common.collect.AbstractMultiset
Set<E> createElementSet() {
return this.backingMap.g();
}
@Override // com.google.common.collect.AbstractMultiset
public Set<Multiset.Entry<E>> createEntrySet() {
return new AbstractMultiset.EntrySet();
}
@Override // com.google.common.collect.AbstractMultiset
int distinctElements() {
return this.backingMap.h();
}
@Override // com.google.common.collect.AbstractMultiset
Iterator<Multiset.Entry<E>> entryIterator() {
final Iterator<Multiset.Entry<E>> it = this.backingMap.d().iterator();
return new Iterator<Multiset.Entry<E>>() { // from class: com.google.common.collect.AbstractMapBasedMultiset.1
Multiset.Entry<E> a;
boolean b;
@Override // java.util.Iterator
public boolean hasNext() {
return it.hasNext();
}
@Override // java.util.Iterator
public void remove() {
CollectPreconditions.a(this.b);
AbstractMapBasedMultiset.this.size -= this.a.getCount();
it.remove();
this.b = false;
this.a = null;
}
@Override // java.util.Iterator
public Multiset.Entry<E> next() {
Multiset.Entry<E> entry = (Multiset.Entry) it.next();
this.a = entry;
this.b = true;
return entry;
}
};
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public Iterator<E> iterator() {
return new MapBasedMultisetIterator();
}
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public int remove(Object obj, int i) {
if (i == 0) {
return count(obj);
}
Preconditions.a(i > 0, "occurrences cannot be negative: %s", i);
int a = this.backingMap.a(obj);
if (a > i) {
this.backingMap.a(obj, a - i);
} else {
this.backingMap.c(obj);
i = a;
}
this.size -= i;
return a;
}
void setBackingMap(AbstractObjectCountMap<E> abstractObjectCountMap) {
this.backingMap = abstractObjectCountMap;
}
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public int setCount(E e, int i) {
CollectPreconditions.a(i, "count");
AbstractObjectCountMap<E> abstractObjectCountMap = this.backingMap;
int c = i == 0 ? abstractObjectCountMap.c(e) : abstractObjectCountMap.a(e, i);
this.size += i - c;
return c;
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public int size() {
return Ints.b(this.size);
}
}

View File

@@ -0,0 +1,41 @@
package com.google.common.collect;
import com.google.common.base.Objects;
import java.util.Map;
/* loaded from: classes.dex */
abstract class AbstractMapEntry<K, V> implements Map.Entry<K, V> {
AbstractMapEntry() {
}
@Override // java.util.Map.Entry
public boolean equals(Object obj) {
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
return Objects.a(getKey(), entry.getKey()) && Objects.a(getValue(), entry.getValue());
}
@Override // java.util.Map.Entry
public abstract K getKey();
@Override // java.util.Map.Entry
public abstract V getValue();
@Override // java.util.Map.Entry
public int hashCode() {
K key = getKey();
V value = getValue();
return (key == null ? 0 : key.hashCode()) ^ (value != null ? value.hashCode() : 0);
}
@Override // java.util.Map.Entry
public V setValue(V v) {
throw new UnsupportedOperationException();
}
public String toString() {
return getKey() + "=" + getValue();
}
}

View File

@@ -0,0 +1,218 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimaps;
import java.util.AbstractCollection;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
abstract class AbstractMultimap<K, V> implements Multimap<K, V> {
private transient Map<K, Collection<V>> asMap;
private transient Collection<Map.Entry<K, V>> entries;
private transient Set<K> keySet;
private transient Multiset<K> keys;
private transient Collection<V> values;
private class Entries extends Multimaps.Entries<K, V> {
private Entries() {
}
@Override // com.google.common.collect.Multimaps.Entries
Multimap<K, V> a() {
return AbstractMultimap.this;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public Iterator<Map.Entry<K, V>> iterator() {
return AbstractMultimap.this.entryIterator();
}
}
private class EntrySet extends AbstractMultimap<K, V>.Entries implements Set<Map.Entry<K, V>> {
private EntrySet(AbstractMultimap abstractMultimap) {
super();
}
@Override // java.util.Collection, java.util.Set
public boolean equals(Object obj) {
return Sets.a(this, obj);
}
@Override // java.util.Collection, java.util.Set
public int hashCode() {
return Sets.a(this);
}
}
class Values extends AbstractCollection<V> {
Values() {
}
@Override // java.util.AbstractCollection, java.util.Collection
public void clear() {
AbstractMultimap.this.clear();
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean contains(Object obj) {
return AbstractMultimap.this.containsValue(obj);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public Iterator<V> iterator() {
return AbstractMultimap.this.valueIterator();
}
@Override // java.util.AbstractCollection, java.util.Collection
public int size() {
return AbstractMultimap.this.size();
}
}
AbstractMultimap() {
}
@Override // com.google.common.collect.Multimap
public Map<K, Collection<V>> asMap() {
Map<K, Collection<V>> map = this.asMap;
if (map != null) {
return map;
}
Map<K, Collection<V>> createAsMap = createAsMap();
this.asMap = createAsMap;
return createAsMap;
}
@Override // com.google.common.collect.Multimap
public boolean containsEntry(Object obj, Object obj2) {
Collection<V> collection = asMap().get(obj);
return collection != null && collection.contains(obj2);
}
public boolean containsValue(Object obj) {
Iterator<Collection<V>> it = asMap().values().iterator();
while (it.hasNext()) {
if (it.next().contains(obj)) {
return true;
}
}
return false;
}
abstract Map<K, Collection<V>> createAsMap();
Collection<Map.Entry<K, V>> createEntries() {
return this instanceof SetMultimap ? new EntrySet() : new Entries();
}
Set<K> createKeySet() {
return new Maps.KeySet(asMap());
}
Multiset<K> createKeys() {
return new Multimaps.Keys(this);
}
Collection<V> createValues() {
return new Values();
}
@Override // com.google.common.collect.Multimap
public Collection<Map.Entry<K, V>> entries() {
Collection<Map.Entry<K, V>> collection = this.entries;
if (collection != null) {
return collection;
}
Collection<Map.Entry<K, V>> createEntries = createEntries();
this.entries = createEntries;
return createEntries;
}
abstract Iterator<Map.Entry<K, V>> entryIterator();
public boolean equals(Object obj) {
return Multimaps.a(this, obj);
}
public int hashCode() {
return asMap().hashCode();
}
@Override // com.google.common.collect.Multimap
public boolean isEmpty() {
return size() == 0;
}
@Override // com.google.common.collect.Multimap
public Set<K> keySet() {
Set<K> set = this.keySet;
if (set != null) {
return set;
}
Set<K> createKeySet = createKeySet();
this.keySet = createKeySet;
return createKeySet;
}
public Multiset<K> keys() {
Multiset<K> multiset = this.keys;
if (multiset != null) {
return multiset;
}
Multiset<K> createKeys = createKeys();
this.keys = createKeys;
return createKeys;
}
@Override // com.google.common.collect.Multimap
public abstract boolean put(K k, V v);
@Override // com.google.common.collect.Multimap
public boolean putAll(K k, Iterable<? extends V> iterable) {
Preconditions.a(iterable);
if (iterable instanceof Collection) {
Collection<? extends V> collection = (Collection) iterable;
return !collection.isEmpty() && get(k).addAll(collection);
}
Iterator<? extends V> it = iterable.iterator();
return it.hasNext() && Iterators.a(get(k), it);
}
@Override // com.google.common.collect.Multimap
public boolean remove(Object obj, Object obj2) {
Collection<V> collection = asMap().get(obj);
return collection != null && collection.remove(obj2);
}
public abstract Collection<V> replaceValues(K k, Iterable<? extends V> iterable);
public String toString() {
return asMap().toString();
}
Iterator<V> valueIterator() {
return Maps.b(entries().iterator());
}
public Collection<V> values() {
Collection<V> collection = this.values;
if (collection != null) {
return collection;
}
Collection<V> createValues = createValues();
this.values = createValues;
return createValues;
}
public boolean putAll(Multimap<? extends K, ? extends V> multimap) {
boolean z = false;
for (Map.Entry<? extends K, ? extends V> entry : multimap.entries()) {
z |= put(entry.getKey(), entry.getValue());
}
return z;
}
}

View File

@@ -0,0 +1,174 @@
package com.google.common.collect;
import com.google.common.base.Objects;
import com.google.common.collect.Multiset;
import com.google.common.collect.Multisets;
import java.util.AbstractCollection;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
/* loaded from: classes.dex */
abstract class AbstractMultiset<E> extends AbstractCollection<E> implements Multiset<E> {
private transient Set<E> elementSet;
private transient Set<Multiset.Entry<E>> entrySet;
class ElementSet extends Multisets.ElementSet<E> {
ElementSet() {
}
@Override // com.google.common.collect.Multisets.ElementSet
Multiset<E> c() {
return AbstractMultiset.this;
}
}
class EntrySet extends Multisets.EntrySet<E> {
EntrySet() {
}
@Override // com.google.common.collect.Multisets.EntrySet
Multiset<E> c() {
return AbstractMultiset.this;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<Multiset.Entry<E>> iterator() {
return AbstractMultiset.this.entryIterator();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return AbstractMultiset.this.distinctElements();
}
}
AbstractMultiset() {
}
@Override // java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public boolean add(E e) {
add(e, 1);
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean addAll(Collection<? extends E> collection) {
return Multisets.a((Multiset) this, (Collection) collection);
}
@Override // java.util.AbstractCollection, java.util.Collection
public void clear() {
Iterators.b(entryIterator());
}
@Override // java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public boolean contains(Object obj) {
return count(obj) > 0;
}
public int count(Object obj) {
for (Multiset.Entry<E> entry : entrySet()) {
if (Objects.a(entry.a(), obj)) {
return entry.getCount();
}
}
return 0;
}
Set<E> createElementSet() {
return new ElementSet();
}
Set<Multiset.Entry<E>> createEntrySet() {
return new EntrySet();
}
abstract int distinctElements();
@Override // com.google.common.collect.Multiset
public Set<E> elementSet() {
Set<E> set = this.elementSet;
if (set != null) {
return set;
}
Set<E> createElementSet = createElementSet();
this.elementSet = createElementSet;
return createElementSet;
}
abstract Iterator<Multiset.Entry<E>> entryIterator();
@Override // com.google.common.collect.Multiset
public Set<Multiset.Entry<E>> entrySet() {
Set<Multiset.Entry<E>> set = this.entrySet;
if (set != null) {
return set;
}
Set<Multiset.Entry<E>> createEntrySet = createEntrySet();
this.entrySet = createEntrySet;
return createEntrySet;
}
@Override // java.util.Collection, com.google.common.collect.Multiset
public boolean equals(Object obj) {
return Multisets.a(this, obj);
}
@Override // java.util.Collection, com.google.common.collect.Multiset
public int hashCode() {
return entrySet().hashCode();
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean isEmpty() {
return entrySet().isEmpty();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public Iterator<E> iterator() {
return Multisets.a((Multiset) this);
}
@Override // java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public boolean remove(Object obj) {
return remove(obj, 1) > 0;
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean removeAll(Collection<?> collection) {
return Multisets.b(this, collection);
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean retainAll(Collection<?> collection) {
return Multisets.c(this, collection);
}
public int setCount(E e, int i) {
return Multisets.a(this, e, i);
}
@Override // java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public int size() {
return Multisets.b((Multiset<?>) this);
}
@Override // java.util.AbstractCollection
public String toString() {
return entrySet().toString();
}
public int add(E e, int i) {
throw new UnsupportedOperationException();
}
public int remove(Object obj, int i) {
throw new UnsupportedOperationException();
}
@Override // com.google.common.collect.Multiset
public boolean setCount(E e, int i, int i2) {
return Multisets.a(this, e, i, i2);
}
}

View File

@@ -0,0 +1,147 @@
package com.google.common.collect;
import com.google.common.collect.Maps;
import java.util.Iterator;
import java.util.Map;
import java.util.NavigableMap;
import java.util.NavigableSet;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.SortedMap;
/* loaded from: classes.dex */
abstract class AbstractNavigableMap<K, V> extends Maps.IteratorBasedAbstractMap<K, V> implements NavigableMap<K, V> {
private final class DescendingMap extends Maps.DescendingMap<K, V> {
private DescendingMap() {
}
@Override // com.google.common.collect.Maps.DescendingMap
Iterator<Map.Entry<K, V>> b() {
return AbstractNavigableMap.this.a();
}
@Override // com.google.common.collect.Maps.DescendingMap
NavigableMap<K, V> c() {
return AbstractNavigableMap.this;
}
}
AbstractNavigableMap() {
}
abstract Iterator<Map.Entry<K, V>> a();
@Override // java.util.NavigableMap
public Map.Entry<K, V> ceilingEntry(K k) {
return tailMap(k, true).firstEntry();
}
@Override // java.util.NavigableMap
public K ceilingKey(K k) {
return (K) Maps.a(ceilingEntry(k));
}
@Override // java.util.NavigableMap
public NavigableSet<K> descendingKeySet() {
return descendingMap().navigableKeySet();
}
@Override // java.util.NavigableMap
public NavigableMap<K, V> descendingMap() {
return new DescendingMap();
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> firstEntry() {
return (Map.Entry) Iterators.b(entryIterator(), (Object) null);
}
@Override // java.util.SortedMap
public K firstKey() {
Map.Entry<K, V> firstEntry = firstEntry();
if (firstEntry != null) {
return firstEntry.getKey();
}
throw new NoSuchElementException();
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> floorEntry(K k) {
return headMap(k, true).lastEntry();
}
@Override // java.util.NavigableMap
public K floorKey(K k) {
return (K) Maps.a(floorEntry(k));
}
@Override // java.util.NavigableMap, java.util.SortedMap
public SortedMap<K, V> headMap(K k) {
return headMap(k, false);
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> higherEntry(K k) {
return tailMap(k, false).firstEntry();
}
@Override // java.util.NavigableMap
public K higherKey(K k) {
return (K) Maps.a(higherEntry(k));
}
@Override // java.util.AbstractMap, java.util.Map, java.util.SortedMap
public Set<K> keySet() {
return navigableKeySet();
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> lastEntry() {
return (Map.Entry) Iterators.b(a(), (Object) null);
}
@Override // java.util.SortedMap
public K lastKey() {
Map.Entry<K, V> lastEntry = lastEntry();
if (lastEntry != null) {
return lastEntry.getKey();
}
throw new NoSuchElementException();
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> lowerEntry(K k) {
return headMap(k, false).lastEntry();
}
@Override // java.util.NavigableMap
public K lowerKey(K k) {
return (K) Maps.a(lowerEntry(k));
}
@Override // java.util.NavigableMap
public NavigableSet<K> navigableKeySet() {
return new Maps.NavigableKeySet(this);
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> pollFirstEntry() {
return (Map.Entry) Iterators.g(entryIterator());
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> pollLastEntry() {
return (Map.Entry) Iterators.g(a());
}
@Override // java.util.NavigableMap, java.util.SortedMap
public SortedMap<K, V> subMap(K k, K k2) {
return subMap(k, true, k2, false);
}
@Override // java.util.NavigableMap, java.util.SortedMap
public SortedMap<K, V> tailMap(K k) {
return tailMap(k, true);
}
}

View File

@@ -0,0 +1,257 @@
package com.google.common.collect;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.common.collect.Multiset;
import com.google.common.collect.Multisets;
import com.google.common.collect.Sets;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Set;
/* loaded from: classes.dex */
abstract class AbstractObjectCountMap<K> {
transient Object[] a;
transient int[] b;
transient int c;
transient int d;
private transient Set<K> e;
private transient Set<Multiset.Entry<K>> f;
abstract class EntrySetView extends Sets.ImprovedAbstractSet<Multiset.Entry<K>> {
EntrySetView() {
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
if (!(obj instanceof Multiset.Entry)) {
return false;
}
Multiset.Entry entry = (Multiset.Entry) obj;
int b = AbstractObjectCountMap.this.b(entry.a());
return b != -1 && AbstractObjectCountMap.this.b[b] == entry.getCount();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
if (!(obj instanceof Multiset.Entry)) {
return false;
}
Multiset.Entry entry = (Multiset.Entry) obj;
int b = AbstractObjectCountMap.this.b(entry.a());
if (b == -1 || AbstractObjectCountMap.this.b[b] != entry.getCount()) {
return false;
}
AbstractObjectCountMap.this.e(b);
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return AbstractObjectCountMap.this.c;
}
}
abstract class Itr<T> implements Iterator<T> {
int a;
boolean b = false;
int c = 0;
Itr() {
this.a = AbstractObjectCountMap.this.d;
}
abstract T a(int i);
void a() {
if (AbstractObjectCountMap.this.d != this.a) {
throw new ConcurrentModificationException();
}
}
@Override // java.util.Iterator
public boolean hasNext() {
return this.c < AbstractObjectCountMap.this.c;
}
@Override // java.util.Iterator
public T next() {
a();
if (!hasNext()) {
throw new NoSuchElementException();
}
this.b = true;
int i = this.c;
this.c = i + 1;
return a(i);
}
@Override // java.util.Iterator
public void remove() {
a();
CollectPreconditions.a(this.b);
this.a++;
this.c--;
AbstractObjectCountMap.this.e(this.c);
this.b = false;
}
}
class KeySetView extends Sets.ImprovedAbstractSet<K> {
KeySetView() {
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<K> iterator() {
return new AbstractObjectCountMap<K>.Itr<K>() { // from class: com.google.common.collect.AbstractObjectCountMap.KeySetView.1
{
AbstractObjectCountMap abstractObjectCountMap = AbstractObjectCountMap.this;
}
@Override // com.google.common.collect.AbstractObjectCountMap.Itr
K a(int i) {
return (K) AbstractObjectCountMap.this.a[i];
}
};
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return AbstractObjectCountMap.this.c;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public Object[] toArray() {
AbstractObjectCountMap abstractObjectCountMap = AbstractObjectCountMap.this;
return ObjectArrays.a(abstractObjectCountMap.a, 0, abstractObjectCountMap.c);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public <T> T[] toArray(T[] tArr) {
AbstractObjectCountMap abstractObjectCountMap = AbstractObjectCountMap.this;
return (T[]) ObjectArrays.a(abstractObjectCountMap.a, 0, abstractObjectCountMap.c, tArr);
}
}
class MapEntry extends Multisets.AbstractEntry<K> {
final K a;
int b;
MapEntry(int i) {
this.a = (K) AbstractObjectCountMap.this.a[i];
this.b = i;
}
@Override // com.google.common.collect.Multiset.Entry
public K a() {
return this.a;
}
void b() {
int i = this.b;
if (i == -1 || i >= AbstractObjectCountMap.this.h() || !Objects.a(this.a, AbstractObjectCountMap.this.a[this.b])) {
this.b = AbstractObjectCountMap.this.b(this.a);
}
}
@Override // com.google.common.collect.Multiset.Entry
public int getCount() {
b();
int i = this.b;
if (i == -1) {
return 0;
}
return AbstractObjectCountMap.this.b[i];
}
public int a(int i) {
b();
int i2 = this.b;
if (i2 == -1) {
AbstractObjectCountMap.this.a(this.a, i);
return 0;
}
int[] iArr = AbstractObjectCountMap.this.b;
int i3 = iArr[i2];
iArr[i2] = i;
return i3;
}
}
AbstractObjectCountMap() {
}
abstract int a(Object obj);
abstract int a(K k, int i);
Multiset.Entry<K> a(int i) {
Preconditions.a(i, this.c);
return new MapEntry(i);
}
abstract void a();
abstract int b(Object obj);
K b(int i) {
Preconditions.a(i, this.c);
return (K) this.a[i];
}
abstract Set<Multiset.Entry<K>> b();
abstract int c(Object obj);
Set<K> c() {
return new KeySetView();
}
int d(int i) {
int i2 = i + 1;
if (i2 < this.c) {
return i2;
}
return -1;
}
int e() {
return 0;
}
abstract int e(int i);
boolean f() {
return this.c == 0;
}
Set<K> g() {
Set<K> set = this.e;
if (set != null) {
return set;
}
Set<K> c = c();
this.e = c;
return c;
}
int h() {
return this.c;
}
int c(int i) {
Preconditions.a(i, this.c);
return this.b[i];
}
Set<Multiset.Entry<K>> d() {
Set<Multiset.Entry<K>> set = this.f;
if (set != null) {
return set;
}
Set<Multiset.Entry<K>> b = b();
this.f = b;
return b;
}
}

View File

@@ -0,0 +1,89 @@
package com.google.common.collect;
import java.lang.Comparable;
import java.util.Iterator;
/* loaded from: classes.dex */
abstract class AbstractRangeSet<C extends Comparable> implements RangeSet<C> {
AbstractRangeSet() {
}
public abstract void add(Range<C> range);
public void addAll(RangeSet<C> rangeSet) {
addAll(rangeSet.asRanges());
}
public void clear() {
remove(Range.all());
}
public boolean contains(C c) {
return rangeContaining(c) != null;
}
@Override // com.google.common.collect.RangeSet
public abstract boolean encloses(Range<C> range);
public boolean enclosesAll(RangeSet<C> rangeSet) {
return enclosesAll(rangeSet.asRanges());
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof RangeSet) {
return asRanges().equals(((RangeSet) obj).asRanges());
}
return false;
}
public final int hashCode() {
return asRanges().hashCode();
}
public abstract boolean intersects(Range<C> range);
@Override // com.google.common.collect.RangeSet
public boolean isEmpty() {
return asRanges().isEmpty();
}
public abstract Range<C> rangeContaining(C c);
public abstract void remove(Range<C> range);
@Override // com.google.common.collect.RangeSet
public void removeAll(RangeSet<C> rangeSet) {
removeAll(rangeSet.asRanges());
}
public final String toString() {
return asRanges().toString();
}
public void addAll(Iterable<Range<C>> iterable) {
Iterator<Range<C>> it = iterable.iterator();
while (it.hasNext()) {
add(it.next());
}
}
public boolean enclosesAll(Iterable<Range<C>> iterable) {
Iterator<Range<C>> it = iterable.iterator();
while (it.hasNext()) {
if (!encloses(it.next())) {
return false;
}
}
return true;
}
public void removeAll(Iterable<Range<C>> iterable) {
Iterator<Range<C>> it = iterable.iterator();
while (it.hasNext()) {
remove(it.next());
}
}
}

View File

@@ -0,0 +1,31 @@
package com.google.common.collect;
import java.util.NoSuchElementException;
/* loaded from: classes.dex */
public abstract class AbstractSequentialIterator<T> extends UnmodifiableIterator<T> {
private T a;
protected AbstractSequentialIterator(T t) {
this.a = t;
}
protected abstract T a(T t);
@Override // java.util.Iterator
public final boolean hasNext() {
return this.a != null;
}
@Override // java.util.Iterator
public final T next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
try {
return this.a;
} finally {
this.a = a(this.a);
}
}
}

View File

@@ -0,0 +1,73 @@
package com.google.common.collect;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
abstract class AbstractSetMultimap<K, V> extends AbstractMapBasedMultimap<K, V> implements SetMultimap<K, V> {
private static final long serialVersionUID = 7431625294878419160L;
protected AbstractSetMultimap(Map<K, Collection<V>> map) {
super(map);
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public Map<K, Collection<V>> asMap() {
return super.asMap();
}
@Override // com.google.common.collect.AbstractMapBasedMultimap
abstract /* bridge */ /* synthetic */ Collection createCollection();
@Override // com.google.common.collect.AbstractMapBasedMultimap
abstract Set<V> createCollection();
@Override // com.google.common.collect.AbstractMultimap
public boolean equals(Object obj) {
return super.equals(obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Collection get(Object obj) {
return get((AbstractSetMultimap<K, V>) obj);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public boolean put(K k, V v) {
return super.put(k, v);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ Collection replaceValues(Object obj, Iterable iterable) {
return replaceValues((AbstractSetMultimap<K, V>) obj, iterable);
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractMapBasedMultimap
public Set<V> createUnmodifiableEmptyCollection() {
return ImmutableSet.of();
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public Set<Map.Entry<K, V>> entries() {
return (Set) super.entries();
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public Set<V> get(K k) {
return (Set) super.get((AbstractSetMultimap<K, V>) k);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public Set<V> removeAll(Object obj) {
return (Set) super.removeAll(obj);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap
public Set<V> replaceValues(K k, Iterable<? extends V> iterable) {
return (Set) super.replaceValues((AbstractSetMultimap<K, V>) k, (Iterable) iterable);
}
}

View File

@@ -0,0 +1,36 @@
package com.google.common.collect;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import java.util.SortedSet;
/* loaded from: classes.dex */
abstract class AbstractSortedKeySortedSetMultimap<K, V> extends AbstractSortedSetMultimap<K, V> {
AbstractSortedKeySortedSetMultimap(SortedMap<K, Collection<V>> sortedMap) {
super(sortedMap);
}
@Override // com.google.common.collect.AbstractSortedSetMultimap, com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public abstract /* bridge */ /* synthetic */ Map asMap();
@Override // com.google.common.collect.AbstractSortedSetMultimap, com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public SortedMap<K, Collection<V>> asMap() {
return (SortedMap) super.asMap();
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public abstract /* bridge */ /* synthetic */ Set keySet();
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public SortedSet<K> keySet() {
return (SortedSet) super.keySet();
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractMapBasedMultimap
public SortedMap<K, Collection<V>> backingMap() {
return (SortedMap) super.backingMap();
}
}

View File

@@ -0,0 +1,124 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import com.google.common.collect.Multiset;
import com.google.common.collect.SortedMultisets;
import java.util.Comparator;
import java.util.Iterator;
import java.util.NavigableSet;
/* loaded from: classes.dex */
abstract class AbstractSortedMultiset<E> extends AbstractMultiset<E> implements SortedMultiset<E> {
final Comparator<? super E> comparator;
private transient SortedMultiset<E> descendingMultiset;
AbstractSortedMultiset() {
this(Ordering.c());
}
@Override // com.google.common.collect.SortedMultiset, com.google.common.collect.SortedIterable
public Comparator<? super E> comparator() {
return this.comparator;
}
SortedMultiset<E> createDescendingMultiset() {
return new DescendingMultiset<E>() { // from class: com.google.common.collect.AbstractSortedMultiset.1DescendingMultisetImpl
@Override // com.google.common.collect.DescendingMultiset
Iterator<Multiset.Entry<E>> b() {
return AbstractSortedMultiset.this.descendingEntryIterator();
}
@Override // com.google.common.collect.DescendingMultiset
SortedMultiset<E> c() {
return AbstractSortedMultiset.this;
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<E> iterator() {
return AbstractSortedMultiset.this.descendingIterator();
}
};
}
abstract Iterator<Multiset.Entry<E>> descendingEntryIterator();
Iterator<E> descendingIterator() {
return Multisets.a((Multiset) descendingMultiset());
}
@Override // com.google.common.collect.SortedMultiset
public SortedMultiset<E> descendingMultiset() {
SortedMultiset<E> sortedMultiset = this.descendingMultiset;
if (sortedMultiset != null) {
return sortedMultiset;
}
SortedMultiset<E> createDescendingMultiset = createDescendingMultiset();
this.descendingMultiset = createDescendingMultiset;
return createDescendingMultiset;
}
@Override // com.google.common.collect.SortedMultiset
public Multiset.Entry<E> firstEntry() {
Iterator<Multiset.Entry<E>> entryIterator = entryIterator();
if (entryIterator.hasNext()) {
return entryIterator.next();
}
return null;
}
@Override // com.google.common.collect.SortedMultiset
public Multiset.Entry<E> lastEntry() {
Iterator<Multiset.Entry<E>> descendingEntryIterator = descendingEntryIterator();
if (descendingEntryIterator.hasNext()) {
return descendingEntryIterator.next();
}
return null;
}
@Override // com.google.common.collect.SortedMultiset
public Multiset.Entry<E> pollFirstEntry() {
Iterator<Multiset.Entry<E>> entryIterator = entryIterator();
if (!entryIterator.hasNext()) {
return null;
}
Multiset.Entry<E> next = entryIterator.next();
Multiset.Entry<E> a = Multisets.a(next.a(), next.getCount());
entryIterator.remove();
return a;
}
@Override // com.google.common.collect.SortedMultiset
public Multiset.Entry<E> pollLastEntry() {
Iterator<Multiset.Entry<E>> descendingEntryIterator = descendingEntryIterator();
if (!descendingEntryIterator.hasNext()) {
return null;
}
Multiset.Entry<E> next = descendingEntryIterator.next();
Multiset.Entry<E> a = Multisets.a(next.a(), next.getCount());
descendingEntryIterator.remove();
return a;
}
@Override // com.google.common.collect.SortedMultiset
public SortedMultiset<E> subMultiset(E e, BoundType boundType, E e2, BoundType boundType2) {
Preconditions.a(boundType);
Preconditions.a(boundType2);
return tailMultiset(e, boundType).headMultiset(e2, boundType2);
}
AbstractSortedMultiset(Comparator<? super E> comparator) {
Preconditions.a(comparator);
this.comparator = comparator;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractMultiset
public NavigableSet<E> createElementSet() {
return new SortedMultisets.NavigableElementSet(this);
}
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public NavigableSet<E> elementSet() {
return (NavigableSet) super.elementSet();
}
}

View File

@@ -0,0 +1,77 @@
package com.google.common.collect;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
/* loaded from: classes.dex */
abstract class AbstractSortedSetMultimap<K, V> extends AbstractSetMultimap<K, V> implements SortedSetMultimap<K, V> {
private static final long serialVersionUID = 430848587173315748L;
protected AbstractSortedSetMultimap(Map<K, Collection<V>> map) {
super(map);
}
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public Map<K, Collection<V>> asMap() {
return super.asMap();
}
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap
abstract /* bridge */ /* synthetic */ Collection createCollection();
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap
abstract /* bridge */ /* synthetic */ Set createCollection();
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap
abstract SortedSet<V> createCollection();
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public abstract /* bridge */ /* synthetic */ Collection get(Object obj);
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public abstract /* bridge */ /* synthetic */ Set get(Object obj);
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public SortedSet<V> get(K k) {
return (SortedSet) super.get((AbstractSortedSetMultimap<K, V>) k);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ Collection replaceValues(Object obj, Iterable iterable) {
return replaceValues((AbstractSortedSetMultimap<K, V>) obj, iterable);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap
public Collection<V> values() {
return super.values();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ Set replaceValues(Object obj, Iterable iterable) {
return replaceValues((AbstractSortedSetMultimap<K, V>) obj, iterable);
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap
public SortedSet<V> createUnmodifiableEmptyCollection() {
if (valueComparator() == null) {
return Collections.unmodifiableSortedSet(createCollection());
}
return ImmutableSortedSet.emptySet(valueComparator());
}
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public SortedSet<V> removeAll(Object obj) {
return (SortedSet) super.removeAll(obj);
}
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap
public SortedSet<V> replaceValues(K k, Iterable<? extends V> iterable) {
return (SortedSet) super.replaceValues((AbstractSortedSetMultimap<K, V>) k, (Iterable) iterable);
}
}

View File

@@ -0,0 +1,189 @@
package com.google.common.collect;
import com.google.common.collect.Table;
import java.util.AbstractCollection;
import java.util.AbstractSet;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
abstract class AbstractTable<R, C, V> implements Table<R, C, V> {
private transient Set<Table.Cell<R, C, V>> cellSet;
private transient Collection<V> values;
class CellSet extends AbstractSet<Table.Cell<R, C, V>> {
CellSet() {
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
AbstractTable.this.clear();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
if (!(obj instanceof Table.Cell)) {
return false;
}
Table.Cell cell = (Table.Cell) obj;
Map map = (Map) Maps.e(AbstractTable.this.rowMap(), cell.b());
return map != null && Collections2.a(map.entrySet(), Maps.a(cell.a(), cell.getValue()));
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<Table.Cell<R, C, V>> iterator() {
return AbstractTable.this.cellIterator();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
if (!(obj instanceof Table.Cell)) {
return false;
}
Table.Cell cell = (Table.Cell) obj;
Map map = (Map) Maps.e(AbstractTable.this.rowMap(), cell.b());
return map != null && Collections2.b(map.entrySet(), Maps.a(cell.a(), cell.getValue()));
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return AbstractTable.this.size();
}
}
class Values extends AbstractCollection<V> {
Values() {
}
@Override // java.util.AbstractCollection, java.util.Collection
public void clear() {
AbstractTable.this.clear();
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean contains(Object obj) {
return AbstractTable.this.containsValue(obj);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public Iterator<V> iterator() {
return AbstractTable.this.valuesIterator();
}
@Override // java.util.AbstractCollection, java.util.Collection
public int size() {
return AbstractTable.this.size();
}
}
AbstractTable() {
}
abstract Iterator<Table.Cell<R, C, V>> cellIterator();
@Override // com.google.common.collect.Table
public Set<Table.Cell<R, C, V>> cellSet() {
Set<Table.Cell<R, C, V>> set = this.cellSet;
if (set != null) {
return set;
}
Set<Table.Cell<R, C, V>> createCellSet = createCellSet();
this.cellSet = createCellSet;
return createCellSet;
}
public abstract void clear();
@Override // com.google.common.collect.Table
public abstract Set<C> columnKeySet();
public boolean contains(Object obj, Object obj2) {
Map map = (Map) Maps.e(rowMap(), obj);
return map != null && Maps.d(map, obj2);
}
public boolean containsColumn(Object obj) {
return Maps.d(columnMap(), obj);
}
public boolean containsRow(Object obj) {
return Maps.d(rowMap(), obj);
}
public boolean containsValue(Object obj) {
Iterator<Map<C, V>> it = rowMap().values().iterator();
while (it.hasNext()) {
if (it.next().containsValue(obj)) {
return true;
}
}
return false;
}
Set<Table.Cell<R, C, V>> createCellSet() {
return new CellSet();
}
Collection<V> createValues() {
return new Values();
}
public boolean equals(Object obj) {
return Tables.a(this, obj);
}
public V get(Object obj, Object obj2) {
Map map = (Map) Maps.e(rowMap(), obj);
if (map == null) {
return null;
}
return (V) Maps.e(map, obj2);
}
public int hashCode() {
return cellSet().hashCode();
}
public boolean isEmpty() {
return size() == 0;
}
public abstract V put(R r, C c, V v);
public void putAll(Table<? extends R, ? extends C, ? extends V> table) {
for (Table.Cell<? extends R, ? extends C, ? extends V> cell : table.cellSet()) {
put(cell.b(), cell.a(), cell.getValue());
}
}
public abstract V remove(Object obj, Object obj2);
@Override // com.google.common.collect.Table
public abstract Set<R> rowKeySet();
public String toString() {
return rowMap().toString();
}
public Collection<V> values() {
Collection<V> collection = this.values;
if (collection != null) {
return collection;
}
Collection<V> createValues = createValues();
this.values = createValues;
return createValues;
}
Iterator<V> valuesIterator() {
return new TransformedIterator<Table.Cell<R, C, V>, V>(this, cellSet().iterator()) { // from class: com.google.common.collect.AbstractTable.1
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.TransformedIterator
public V a(Table.Cell<R, C, V> cell) {
return cell.getValue();
}
};
}
}

View File

@@ -0,0 +1,183 @@
package com.google.common.collect;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
public final class ArrayListMultimap<K, V> extends ArrayListMultimapGwtSerializationDependencies<K, V> {
private static final int DEFAULT_VALUES_PER_KEY = 3;
private static final long serialVersionUID = 0;
transient int expectedValuesPerKey;
private ArrayListMultimap() {
super(new HashMap());
this.expectedValuesPerKey = 3;
}
public static <K, V> ArrayListMultimap<K, V> create() {
return new ArrayListMultimap<>();
}
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
objectInputStream.defaultReadObject();
this.expectedValuesPerKey = 3;
int a = Serialization.a(objectInputStream);
setMap(Maps.b());
Serialization.a(this, objectInputStream, a);
}
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
objectOutputStream.defaultWriteObject();
Serialization.a(this, objectOutputStream);
}
@Override // com.google.common.collect.AbstractListMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Map asMap() {
return super.asMap();
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ void clear() {
super.clear();
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean containsEntry(Object obj, Object obj2) {
return super.containsEntry(obj, obj2);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean containsKey(Object obj) {
return super.containsKey(obj);
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ boolean containsValue(Object obj) {
return super.containsValue(obj);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Collection entries() {
return super.entries();
}
@Override // com.google.common.collect.AbstractListMultimap, com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ boolean equals(Object obj) {
return super.equals(obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractListMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ List get(Object obj) {
return super.get((ArrayListMultimap<K, V>) obj);
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ int hashCode() {
return super.hashCode();
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean isEmpty() {
return super.isEmpty();
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Set keySet() {
return super.keySet();
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ Multiset keys() {
return super.keys();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractListMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean put(Object obj, Object obj2) {
return super.put(obj, obj2);
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ boolean putAll(Multimap multimap) {
return super.putAll(multimap);
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean remove(Object obj, Object obj2) {
return super.remove(obj, obj2);
}
@Override // com.google.common.collect.AbstractListMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ List removeAll(Object obj) {
return super.removeAll(obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractListMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ List replaceValues(Object obj, Iterable iterable) {
return super.replaceValues((ArrayListMultimap<K, V>) obj, iterable);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ int size() {
return super.size();
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
@Deprecated
public void trimToSize() {
Iterator<Collection<V>> it = backingMap().values().iterator();
while (it.hasNext()) {
((ArrayList) it.next()).trimToSize();
}
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ Collection values() {
return super.values();
}
public static <K, V> ArrayListMultimap<K, V> create(int i, int i2) {
return new ArrayListMultimap<>(i, i2);
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractListMultimap, com.google.common.collect.AbstractMapBasedMultimap
public List<V> createCollection() {
return new ArrayList(this.expectedValuesPerKey);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean putAll(Object obj, Iterable iterable) {
return super.putAll(obj, iterable);
}
private ArrayListMultimap(int i, int i2) {
super(Maps.b(i));
CollectPreconditions.a(i2, "expectedValuesPerKey");
this.expectedValuesPerKey = i2;
}
public static <K, V> ArrayListMultimap<K, V> create(Multimap<? extends K, ? extends V> multimap) {
return new ArrayListMultimap<>(multimap);
}
private ArrayListMultimap(Multimap<? extends K, ? extends V> multimap) {
this(multimap.keySet().size(), multimap instanceof ArrayListMultimap ? ((ArrayListMultimap) multimap).expectedValuesPerKey : 3);
putAll(multimap);
}
}

View File

@@ -0,0 +1,11 @@
package com.google.common.collect;
import java.util.Collection;
import java.util.Map;
/* loaded from: classes.dex */
abstract class ArrayListMultimapGwtSerializationDependencies<K, V> extends AbstractListMultimap<K, V> {
ArrayListMultimapGwtSerializationDependencies(Map<K, Collection<V>> map) {
super(map);
}
}

View File

@@ -0,0 +1,529 @@
package com.google.common.collect;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import com.google.common.collect.Table;
import com.google.common.collect.Tables;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
public final class ArrayTable<R, C, V> extends AbstractTable<R, C, V> implements Serializable {
private static final long serialVersionUID = 0;
private final V[][] array;
private final ImmutableMap<C, Integer> columnKeyToIndex;
private final ImmutableList<C> columnList;
private transient ArrayTable<R, C, V>.ColumnMap columnMap;
private final ImmutableMap<R, Integer> rowKeyToIndex;
private final ImmutableList<R> rowList;
private transient ArrayTable<R, C, V>.RowMap rowMap;
private static abstract class ArrayMap<K, V> extends Maps.IteratorBasedAbstractMap<K, V> {
private final ImmutableMap<K, Integer> a;
abstract V a(int i, V v);
abstract String a();
Map.Entry<K, V> a(final int i) {
Preconditions.a(i, size());
return new AbstractMapEntry<K, V>() { // from class: com.google.common.collect.ArrayTable.ArrayMap.1
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public K getKey() {
return (K) ArrayMap.this.b(i);
}
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public V getValue() {
return (V) ArrayMap.this.c(i);
}
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public V setValue(V v) {
return (V) ArrayMap.this.a(i, v);
}
};
}
K b(int i) {
return this.a.keySet().asList().get(i);
}
abstract V c(int i);
@Override // com.google.common.collect.Maps.IteratorBasedAbstractMap, java.util.AbstractMap, java.util.Map
public void clear() {
throw new UnsupportedOperationException();
}
@Override // java.util.AbstractMap, java.util.Map
public boolean containsKey(Object obj) {
return this.a.containsKey(obj);
}
@Override // com.google.common.collect.Maps.IteratorBasedAbstractMap
Iterator<Map.Entry<K, V>> entryIterator() {
return new AbstractIndexedListIterator<Map.Entry<K, V>>(size()) { // from class: com.google.common.collect.ArrayTable.ArrayMap.2
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.AbstractIndexedListIterator
public Map.Entry<K, V> a(int i) {
return ArrayMap.this.a(i);
}
};
}
@Override // java.util.AbstractMap, java.util.Map
public V get(Object obj) {
Integer num = this.a.get(obj);
if (num == null) {
return null;
}
return c(num.intValue());
}
@Override // java.util.AbstractMap, java.util.Map
public boolean isEmpty() {
return this.a.isEmpty();
}
@Override // java.util.AbstractMap, java.util.Map
public Set<K> keySet() {
return this.a.keySet();
}
@Override // java.util.AbstractMap, java.util.Map
public V put(K k, V v) {
Integer num = this.a.get(k);
if (num != null) {
return a(num.intValue(), v);
}
throw new IllegalArgumentException(a() + " " + k + " not in " + this.a.keySet());
}
@Override // java.util.AbstractMap, java.util.Map
public V remove(Object obj) {
throw new UnsupportedOperationException();
}
@Override // com.google.common.collect.Maps.IteratorBasedAbstractMap, java.util.AbstractMap, java.util.Map
public int size() {
return this.a.size();
}
private ArrayMap(ImmutableMap<K, Integer> immutableMap) {
this.a = immutableMap;
}
}
private class Column extends ArrayMap<R, V> {
final int b;
Column(int i) {
super(ArrayTable.this.rowKeyToIndex);
this.b = i;
}
@Override // com.google.common.collect.ArrayTable.ArrayMap
V a(int i, V v) {
return (V) ArrayTable.this.set(i, this.b, v);
}
@Override // com.google.common.collect.ArrayTable.ArrayMap
String a() {
return "Row";
}
@Override // com.google.common.collect.ArrayTable.ArrayMap
V c(int i) {
return (V) ArrayTable.this.at(i, this.b);
}
}
private class ColumnMap extends ArrayMap<C, Map<R, V>> {
@Override // com.google.common.collect.ArrayTable.ArrayMap
/* bridge */ /* synthetic */ Object a(int i, Object obj) {
a(i, (Map) obj);
throw null;
}
@Override // com.google.common.collect.ArrayTable.ArrayMap
String a() {
return "Column";
}
@Override // com.google.common.collect.ArrayTable.ArrayMap, java.util.AbstractMap, java.util.Map
public /* bridge */ /* synthetic */ Object put(Object obj, Object obj2) {
a((ColumnMap) obj, (Map) obj2);
throw null;
}
private ColumnMap() {
super(ArrayTable.this.columnKeyToIndex);
}
Map<R, V> a(int i, Map<R, V> map) {
throw new UnsupportedOperationException();
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ArrayTable.ArrayMap
public Map<R, V> c(int i) {
return new Column(i);
}
public Map<R, V> a(C c, Map<R, V> map) {
throw new UnsupportedOperationException();
}
}
private class Row extends ArrayMap<C, V> {
final int b;
Row(int i) {
super(ArrayTable.this.columnKeyToIndex);
this.b = i;
}
@Override // com.google.common.collect.ArrayTable.ArrayMap
V a(int i, V v) {
return (V) ArrayTable.this.set(this.b, i, v);
}
@Override // com.google.common.collect.ArrayTable.ArrayMap
String a() {
return "Column";
}
@Override // com.google.common.collect.ArrayTable.ArrayMap
V c(int i) {
return (V) ArrayTable.this.at(this.b, i);
}
}
private class RowMap extends ArrayMap<R, Map<C, V>> {
@Override // com.google.common.collect.ArrayTable.ArrayMap
/* bridge */ /* synthetic */ Object a(int i, Object obj) {
a(i, (Map) obj);
throw null;
}
@Override // com.google.common.collect.ArrayTable.ArrayMap
String a() {
return "Row";
}
@Override // com.google.common.collect.ArrayTable.ArrayMap, java.util.AbstractMap, java.util.Map
public /* bridge */ /* synthetic */ Object put(Object obj, Object obj2) {
a((RowMap) obj, (Map) obj2);
throw null;
}
private RowMap() {
super(ArrayTable.this.rowKeyToIndex);
}
Map<C, V> a(int i, Map<C, V> map) {
throw new UnsupportedOperationException();
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ArrayTable.ArrayMap
public Map<C, V> c(int i) {
return new Row(i);
}
public Map<C, V> a(R r, Map<C, V> map) {
throw new UnsupportedOperationException();
}
}
private ArrayTable(Iterable<? extends R> iterable, Iterable<? extends C> iterable2) {
this.rowList = ImmutableList.copyOf(iterable);
this.columnList = ImmutableList.copyOf(iterable2);
Preconditions.a(!this.rowList.isEmpty());
Preconditions.a(!this.columnList.isEmpty());
this.rowKeyToIndex = Maps.a(this.rowList);
this.columnKeyToIndex = Maps.a(this.columnList);
this.array = (V[][]) ((Object[][]) Array.newInstance((Class<?>) Object.class, this.rowList.size(), this.columnList.size()));
eraseAll();
}
public static <R, C, V> ArrayTable<R, C, V> create(Iterable<? extends R> iterable, Iterable<? extends C> iterable2) {
return new ArrayTable<>(iterable, iterable2);
}
/* JADX INFO: Access modifiers changed from: private */
public Table.Cell<R, C, V> getCell(final int i) {
return new Tables.AbstractCell<R, C, V>() { // from class: com.google.common.collect.ArrayTable.2
final int a;
final int b;
{
this.a = i / ArrayTable.this.columnList.size();
this.b = i % ArrayTable.this.columnList.size();
}
@Override // com.google.common.collect.Table.Cell
public C a() {
return (C) ArrayTable.this.columnList.get(this.b);
}
@Override // com.google.common.collect.Table.Cell
public R b() {
return (R) ArrayTable.this.rowList.get(this.a);
}
@Override // com.google.common.collect.Table.Cell
public V getValue() {
return (V) ArrayTable.this.at(this.a, this.b);
}
};
}
/* JADX INFO: Access modifiers changed from: private */
public V getValue(int i) {
return at(i / this.columnList.size(), i % this.columnList.size());
}
public V at(int i, int i2) {
Preconditions.a(i, this.rowList.size());
Preconditions.a(i2, this.columnList.size());
return this.array[i][i2];
}
@Override // com.google.common.collect.AbstractTable
Iterator<Table.Cell<R, C, V>> cellIterator() {
return new AbstractIndexedListIterator<Table.Cell<R, C, V>>(size()) { // from class: com.google.common.collect.ArrayTable.1
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.AbstractIndexedListIterator
public Table.Cell<R, C, V> a(int i) {
return ArrayTable.this.getCell(i);
}
};
}
@Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table
public Set<Table.Cell<R, C, V>> cellSet() {
return super.cellSet();
}
@Override // com.google.common.collect.AbstractTable
@Deprecated
public void clear() {
throw new UnsupportedOperationException();
}
public Map<R, V> column(C c) {
Preconditions.a(c);
Integer num = this.columnKeyToIndex.get(c);
return num == null ? ImmutableMap.of() : new Column(num.intValue());
}
public ImmutableList<C> columnKeyList() {
return this.columnList;
}
@Override // com.google.common.collect.Table
public Map<C, Map<R, V>> columnMap() {
ArrayTable<R, C, V>.ColumnMap columnMap = this.columnMap;
if (columnMap != null) {
return columnMap;
}
ArrayTable<R, C, V>.ColumnMap columnMap2 = new ColumnMap();
this.columnMap = columnMap2;
return columnMap2;
}
@Override // com.google.common.collect.AbstractTable
public boolean contains(Object obj, Object obj2) {
return containsRow(obj) && containsColumn(obj2);
}
@Override // com.google.common.collect.AbstractTable
public boolean containsColumn(Object obj) {
return this.columnKeyToIndex.containsKey(obj);
}
@Override // com.google.common.collect.AbstractTable
public boolean containsRow(Object obj) {
return this.rowKeyToIndex.containsKey(obj);
}
@Override // com.google.common.collect.AbstractTable
public boolean containsValue(Object obj) {
for (V[] vArr : this.array) {
for (V v : vArr) {
if (Objects.a(obj, v)) {
return true;
}
}
}
return false;
}
@Override // com.google.common.collect.AbstractTable
public /* bridge */ /* synthetic */ boolean equals(Object obj) {
return super.equals(obj);
}
public V erase(Object obj, Object obj2) {
Integer num = this.rowKeyToIndex.get(obj);
Integer num2 = this.columnKeyToIndex.get(obj2);
if (num == null || num2 == null) {
return null;
}
return set(num.intValue(), num2.intValue(), null);
}
public void eraseAll() {
for (V[] vArr : this.array) {
Arrays.fill(vArr, (Object) null);
}
}
@Override // com.google.common.collect.AbstractTable
public V get(Object obj, Object obj2) {
Integer num = this.rowKeyToIndex.get(obj);
Integer num2 = this.columnKeyToIndex.get(obj2);
if (num == null || num2 == null) {
return null;
}
return at(num.intValue(), num2.intValue());
}
@Override // com.google.common.collect.AbstractTable
public /* bridge */ /* synthetic */ int hashCode() {
return super.hashCode();
}
@Override // com.google.common.collect.AbstractTable
public boolean isEmpty() {
return false;
}
@Override // com.google.common.collect.AbstractTable
public V put(R r, C c, V v) {
Preconditions.a(r);
Preconditions.a(c);
Integer num = this.rowKeyToIndex.get(r);
Preconditions.a(num != null, "Row %s not in %s", r, this.rowList);
Integer num2 = this.columnKeyToIndex.get(c);
Preconditions.a(num2 != null, "Column %s not in %s", c, this.columnList);
return set(num.intValue(), num2.intValue(), v);
}
@Override // com.google.common.collect.AbstractTable
public void putAll(Table<? extends R, ? extends C, ? extends V> table) {
super.putAll(table);
}
@Override // com.google.common.collect.AbstractTable
@Deprecated
public V remove(Object obj, Object obj2) {
throw new UnsupportedOperationException();
}
public Map<C, V> row(R r) {
Preconditions.a(r);
Integer num = this.rowKeyToIndex.get(r);
return num == null ? ImmutableMap.of() : new Row(num.intValue());
}
public ImmutableList<R> rowKeyList() {
return this.rowList;
}
@Override // com.google.common.collect.Table
public Map<R, Map<C, V>> rowMap() {
ArrayTable<R, C, V>.RowMap rowMap = this.rowMap;
if (rowMap != null) {
return rowMap;
}
ArrayTable<R, C, V>.RowMap rowMap2 = new RowMap();
this.rowMap = rowMap2;
return rowMap2;
}
public V set(int i, int i2, V v) {
Preconditions.a(i, this.rowList.size());
Preconditions.a(i2, this.columnList.size());
V[][] vArr = this.array;
V v2 = vArr[i][i2];
vArr[i][i2] = v;
return v2;
}
@Override // com.google.common.collect.Table
public int size() {
return this.rowList.size() * this.columnList.size();
}
public V[][] toArray(Class<V> cls) {
V[][] vArr = (V[][]) ((Object[][]) Array.newInstance((Class<?>) cls, this.rowList.size(), this.columnList.size()));
for (int i = 0; i < this.rowList.size(); i++) {
V[][] vArr2 = this.array;
System.arraycopy(vArr2[i], 0, vArr[i], 0, vArr2[i].length);
}
return vArr;
}
@Override // com.google.common.collect.AbstractTable
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
@Override // com.google.common.collect.AbstractTable
public Collection<V> values() {
return super.values();
}
@Override // com.google.common.collect.AbstractTable
Iterator<V> valuesIterator() {
return new AbstractIndexedListIterator<V>(size()) { // from class: com.google.common.collect.ArrayTable.3
@Override // com.google.common.collect.AbstractIndexedListIterator
protected V a(int i) {
return (V) ArrayTable.this.getValue(i);
}
};
}
public static <R, C, V> ArrayTable<R, C, V> create(Table<R, C, V> table) {
return table instanceof ArrayTable ? new ArrayTable<>((ArrayTable) table) : new ArrayTable<>(table);
}
@Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table
public ImmutableSet<C> columnKeySet() {
return this.columnKeyToIndex.keySet();
}
@Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table
public ImmutableSet<R> rowKeySet() {
return this.rowKeyToIndex.keySet();
}
/* JADX WARN: Multi-variable type inference failed */
private ArrayTable(Table<R, C, V> table) {
this(table.rowKeySet(), table.columnKeySet());
putAll(table);
}
private ArrayTable(ArrayTable<R, C, V> arrayTable) {
this.rowList = arrayTable.rowList;
this.columnList = arrayTable.columnList;
this.rowKeyToIndex = arrayTable.rowKeyToIndex;
this.columnKeyToIndex = arrayTable.columnKeyToIndex;
V[][] vArr = (V[][]) ((Object[][]) Array.newInstance((Class<?>) Object.class, this.rowList.size(), this.columnList.size()));
this.array = vArr;
eraseAll();
for (int i = 0; i < this.rowList.size(); i++) {
V[][] vArr2 = arrayTable.array;
System.arraycopy(vArr2[i], 0, vArr[i], 0, vArr2[i].length);
}
}
}

View File

@@ -0,0 +1,8 @@
package com.google.common.collect;
import java.util.Map;
/* loaded from: classes.dex */
public interface BiMap<K, V> extends Map<K, V> {
BiMap<V, K> inverse();
}

View File

@@ -0,0 +1,23 @@
package com.google.common.collect;
/* loaded from: classes.dex */
public enum BoundType {
OPEN { // from class: com.google.common.collect.BoundType.1
@Override // com.google.common.collect.BoundType
BoundType flip() {
return BoundType.CLOSED;
}
},
CLOSED { // from class: com.google.common.collect.BoundType.2
@Override // com.google.common.collect.BoundType
BoundType flip() {
return BoundType.OPEN;
}
};
static BoundType forBoolean(boolean z) {
return z ? CLOSED : OPEN;
}
abstract BoundType flip();
}

View File

@@ -0,0 +1,44 @@
package com.google.common.collect;
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import java.io.Serializable;
/* loaded from: classes.dex */
final class ByFunctionOrdering<F, T> extends Ordering<F> implements Serializable {
final Function<F, ? extends T> a;
final Ordering<T> b;
ByFunctionOrdering(Function<F, ? extends T> function, Ordering<T> ordering) {
Preconditions.a(function);
this.a = function;
Preconditions.a(ordering);
this.b = ordering;
}
@Override // com.google.common.collect.Ordering, java.util.Comparator
public int compare(F f, F f2) {
return this.b.compare(this.a.apply(f), this.a.apply(f2));
}
@Override // java.util.Comparator
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof ByFunctionOrdering)) {
return false;
}
ByFunctionOrdering byFunctionOrdering = (ByFunctionOrdering) obj;
return this.a.equals(byFunctionOrdering.a) && this.b.equals(byFunctionOrdering.b);
}
public int hashCode() {
return Objects.a(this.a, this.b);
}
public String toString() {
return this.b + ".onResultOf(" + this.a + ")";
}
}

View File

@@ -0,0 +1,7 @@
package com.google.common.collect;
import java.util.Map;
/* loaded from: classes.dex */
public interface ClassToInstanceMap<B> extends Map<Class<? extends B>, B> {
}

View File

@@ -0,0 +1,34 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
/* loaded from: classes.dex */
final class CollectPreconditions {
static void a(Object obj, Object obj2) {
if (obj == null) {
throw new NullPointerException("null key in entry: null=" + obj2);
}
if (obj2 != null) {
return;
}
throw new NullPointerException("null value in entry: " + obj + "=null");
}
static void b(int i, String str) {
if (i > 0) {
return;
}
throw new IllegalArgumentException(str + " must be positive but was: " + i);
}
static int a(int i, String str) {
if (i >= 0) {
return i;
}
throw new IllegalArgumentException(str + " cannot be negative but was: " + i);
}
static void a(boolean z) {
Preconditions.b(z, "no calls to next() since the last call to remove()");
}
}

View File

@@ -0,0 +1,58 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicates;
import java.util.Collection;
/* loaded from: classes.dex */
public final class Collections2 {
static boolean a(Collection<?> collection, Object obj) {
Preconditions.a(collection);
try {
return collection.contains(obj);
} catch (ClassCastException | NullPointerException unused) {
return false;
}
}
static boolean b(Collection<?> collection, Object obj) {
Preconditions.a(collection);
try {
return collection.remove(obj);
} catch (ClassCastException | NullPointerException unused) {
return false;
}
}
static boolean a(Collection<?> collection, Collection<?> collection2) {
return Iterables.a((Iterable) collection2, Predicates.a((Collection) collection));
}
static String a(Collection<?> collection) {
StringBuilder a = a(collection.size());
a.append('[');
boolean z = true;
for (Object obj : collection) {
if (!z) {
a.append(", ");
}
z = false;
if (obj == collection) {
a.append("(this Collection)");
} else {
a.append(obj);
}
}
a.append(']');
return a.toString();
}
static StringBuilder a(int i) {
CollectPreconditions.a(i, "size");
return new StringBuilder((int) Math.min(i * 8, 1073741824L));
}
static <T> Collection<T> a(Iterable<T> iterable) {
return (Collection) iterable;
}
}

View File

@@ -0,0 +1,39 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import java.io.Serializable;
import java.util.Comparator;
/* loaded from: classes.dex */
final class ComparatorOrdering<T> extends Ordering<T> implements Serializable {
final Comparator<T> a;
ComparatorOrdering(Comparator<T> comparator) {
Preconditions.a(comparator);
this.a = comparator;
}
@Override // com.google.common.collect.Ordering, java.util.Comparator
public int compare(T t, T t2) {
return this.a.compare(t, t2);
}
@Override // java.util.Comparator
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof ComparatorOrdering) {
return this.a.equals(((ComparatorOrdering) obj).a);
}
return false;
}
public int hashCode() {
return this.a.hashCode();
}
public String toString() {
return this.a.toString();
}
}

View File

@@ -0,0 +1,52 @@
package com.google.common.collect;
/* loaded from: classes.dex */
public abstract class ComparisonChain {
private static final ComparisonChain a = new ComparisonChain() { // from class: com.google.common.collect.ComparisonChain.1
@Override // com.google.common.collect.ComparisonChain
public int a() {
return 0;
}
@Override // com.google.common.collect.ComparisonChain
public ComparisonChain a(Comparable comparable, Comparable comparable2) {
return a(comparable.compareTo(comparable2));
}
ComparisonChain a(int i) {
return i < 0 ? ComparisonChain.b : i > 0 ? ComparisonChain.c : ComparisonChain.a;
}
};
private static final ComparisonChain b = new InactiveComparisonChain(-1);
private static final ComparisonChain c = new InactiveComparisonChain(1);
private static final class InactiveComparisonChain extends ComparisonChain {
final int d;
InactiveComparisonChain(int i) {
super();
this.d = i;
}
@Override // com.google.common.collect.ComparisonChain
public int a() {
return this.d;
}
@Override // com.google.common.collect.ComparisonChain
public ComparisonChain a(Comparable comparable, Comparable comparable2) {
return this;
}
}
public static ComparisonChain e() {
return a;
}
public abstract int a();
public abstract ComparisonChain a(Comparable<?> comparable, Comparable<?> comparable2);
private ComparisonChain() {
}
}

View File

@@ -0,0 +1,10 @@
package com.google.common.collect;
/* loaded from: classes.dex */
public class ComputationException extends RuntimeException {
private static final long serialVersionUID = 0;
public ComputationException(Throwable th) {
super(th);
}
}

View File

@@ -0,0 +1,434 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import com.google.common.collect.Multiset;
import com.google.common.collect.Serialization;
import com.google.common.math.IntMath;
import com.google.common.primitives.Ints;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
/* loaded from: classes.dex */
public final class ConcurrentHashMultiset<E> extends AbstractMultiset<E> implements Serializable {
private static final long serialVersionUID = 1;
private final transient ConcurrentMap<E, AtomicInteger> countMap;
private class EntrySet extends AbstractMultiset<E>.EntrySet {
private EntrySet() {
super();
}
private List<Multiset.Entry<E>> d() {
ArrayList c = Lists.c(size());
Iterators.a(c, iterator());
return c;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public Object[] toArray() {
return d().toArray();
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractMultiset.EntrySet, com.google.common.collect.Multisets.EntrySet
public ConcurrentHashMultiset<E> c() {
return ConcurrentHashMultiset.this;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public <T> T[] toArray(T[] tArr) {
return (T[]) d().toArray(tArr);
}
}
private static class FieldSettersHolder {
static final Serialization.FieldSetter<ConcurrentHashMultiset> a = Serialization.a(ConcurrentHashMultiset.class, "countMap");
}
ConcurrentHashMultiset(ConcurrentMap<E, AtomicInteger> concurrentMap) {
Preconditions.a(concurrentMap.isEmpty(), "the backing map (%s) must be empty", concurrentMap);
this.countMap = concurrentMap;
}
public static <E> ConcurrentHashMultiset<E> create() {
return new ConcurrentHashMultiset<>(new ConcurrentHashMap());
}
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
objectInputStream.defaultReadObject();
FieldSettersHolder.a.a((Serialization.FieldSetter<ConcurrentHashMultiset>) this, objectInputStream.readObject());
}
/* JADX WARN: Multi-variable type inference failed */
private List<E> snapshot() {
ArrayList c = Lists.c(size());
for (Multiset.Entry entry : entrySet()) {
Object a = entry.a();
for (int count = entry.getCount(); count > 0; count--) {
c.add(a);
}
}
return c;
}
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
objectOutputStream.defaultWriteObject();
objectOutputStream.writeObject(this.countMap);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ boolean add(Object obj) {
return super.add(obj);
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public /* bridge */ /* synthetic */ boolean addAll(Collection collection) {
return super.addAll(collection);
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public void clear() {
this.countMap.clear();
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ boolean contains(Object obj) {
return super.contains(obj);
}
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public int count(Object obj) {
AtomicInteger atomicInteger = (AtomicInteger) Maps.e(this.countMap, obj);
if (atomicInteger == null) {
return 0;
}
return atomicInteger.get();
}
@Override // com.google.common.collect.AbstractMultiset
Set<E> createElementSet() {
final Set<E> keySet = this.countMap.keySet();
return new ForwardingSet<E>(this) { // from class: com.google.common.collect.ConcurrentHashMultiset.1
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return obj != null && Collections2.a(keySet, obj);
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public boolean containsAll(Collection<?> collection) {
return standardContainsAll(collection);
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
return obj != null && Collections2.b(keySet, obj);
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public boolean removeAll(Collection<?> collection) {
return standardRemoveAll(collection);
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.ForwardingSet, com.google.common.collect.ForwardingCollection, com.google.common.collect.ForwardingObject
public Set<E> delegate() {
return keySet;
}
};
}
@Override // com.google.common.collect.AbstractMultiset
public Set<Multiset.Entry<E>> createEntrySet() {
return new EntrySet();
}
@Override // com.google.common.collect.AbstractMultiset
int distinctElements() {
return this.countMap.size();
}
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ Set elementSet() {
return super.elementSet();
}
@Override // com.google.common.collect.AbstractMultiset
Iterator<Multiset.Entry<E>> entryIterator() {
final AbstractIterator<Multiset.Entry<E>> abstractIterator = new AbstractIterator<Multiset.Entry<E>>() { // from class: com.google.common.collect.ConcurrentHashMultiset.2
private final Iterator<Map.Entry<E, AtomicInteger>> c;
{
this.c = ConcurrentHashMultiset.this.countMap.entrySet().iterator();
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.AbstractIterator
public Multiset.Entry<E> a() {
while (this.c.hasNext()) {
Map.Entry<E, AtomicInteger> next = this.c.next();
int i = next.getValue().get();
if (i != 0) {
return Multisets.a(next.getKey(), i);
}
}
return b();
}
};
return new ForwardingIterator<Multiset.Entry<E>>() { // from class: com.google.common.collect.ConcurrentHashMultiset.3
private Multiset.Entry<E> a;
@Override // java.util.Iterator
public void remove() {
CollectPreconditions.a(this.a != null);
ConcurrentHashMultiset.this.setCount(this.a.a(), 0);
this.a = null;
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.ForwardingObject
public Iterator<Multiset.Entry<E>> delegate() {
return abstractIterator;
}
@Override // com.google.common.collect.ForwardingIterator, java.util.Iterator
public Multiset.Entry<E> next() {
this.a = (Multiset.Entry) super.next();
return this.a;
}
};
}
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ Set entrySet() {
return super.entrySet();
}
@Override // com.google.common.collect.AbstractMultiset, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ boolean equals(Object obj) {
return super.equals(obj);
}
@Override // com.google.common.collect.AbstractMultiset, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ int hashCode() {
return super.hashCode();
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public boolean isEmpty() {
return this.countMap.isEmpty();
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public /* bridge */ /* synthetic */ Iterator iterator() {
return super.iterator();
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ boolean remove(Object obj) {
return super.remove(obj);
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public /* bridge */ /* synthetic */ boolean removeAll(Collection collection) {
return super.removeAll(collection);
}
public boolean removeExactly(Object obj, int i) {
int i2;
int i3;
if (i == 0) {
return true;
}
CollectPreconditions.b(i, "occurences");
AtomicInteger atomicInteger = (AtomicInteger) Maps.e(this.countMap, obj);
if (atomicInteger == null) {
return false;
}
do {
i2 = atomicInteger.get();
if (i2 < i) {
return false;
}
i3 = i2 - i;
} while (!atomicInteger.compareAndSet(i2, i3));
if (i3 == 0) {
this.countMap.remove(obj, atomicInteger);
}
return true;
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public /* bridge */ /* synthetic */ boolean retainAll(Collection collection) {
return super.retainAll(collection);
}
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public int setCount(E e, int i) {
AtomicInteger atomicInteger;
int i2;
AtomicInteger atomicInteger2;
Preconditions.a(e);
CollectPreconditions.a(i, "count");
do {
atomicInteger = (AtomicInteger) Maps.e(this.countMap, e);
if (atomicInteger == null && (i == 0 || (atomicInteger = this.countMap.putIfAbsent(e, new AtomicInteger(i))) == null)) {
return 0;
}
do {
i2 = atomicInteger.get();
if (i2 == 0) {
if (i != 0) {
atomicInteger2 = new AtomicInteger(i);
if (this.countMap.putIfAbsent(e, atomicInteger2) == null) {
break;
}
} else {
return 0;
}
}
} while (!atomicInteger.compareAndSet(i2, i));
if (i == 0) {
this.countMap.remove(e, atomicInteger);
}
return i2;
} while (!this.countMap.replace(e, atomicInteger, atomicInteger2));
return 0;
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public int size() {
long j = 0;
while (this.countMap.values().iterator().hasNext()) {
j += r0.next().get();
}
return Ints.b(j);
}
@Override // java.util.AbstractCollection, java.util.Collection
public Object[] toArray() {
return snapshot().toArray();
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
public static <E> ConcurrentHashMultiset<E> create(Iterable<? extends E> iterable) {
ConcurrentHashMultiset<E> create = create();
Iterables.a((Collection) create, (Iterable) iterable);
return create;
}
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public int add(E e, int i) {
AtomicInteger atomicInteger;
int i2;
AtomicInteger atomicInteger2;
Preconditions.a(e);
if (i == 0) {
return count(e);
}
CollectPreconditions.b(i, "occurences");
do {
atomicInteger = (AtomicInteger) Maps.e(this.countMap, e);
if (atomicInteger == null && (atomicInteger = this.countMap.putIfAbsent(e, new AtomicInteger(i))) == null) {
return 0;
}
do {
i2 = atomicInteger.get();
if (i2 == 0) {
atomicInteger2 = new AtomicInteger(i);
if (this.countMap.putIfAbsent(e, atomicInteger2) == null) {
break;
}
} else {
try {
} catch (ArithmeticException unused) {
throw new IllegalArgumentException("Overflow adding " + i + " occurrences to a count of " + i2);
}
}
} while (!atomicInteger.compareAndSet(i2, IntMath.a(i2, i)));
return i2;
} while (!this.countMap.replace(e, atomicInteger, atomicInteger2));
return 0;
}
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public int remove(Object obj, int i) {
int i2;
int max;
if (i == 0) {
return count(obj);
}
CollectPreconditions.b(i, "occurences");
AtomicInteger atomicInteger = (AtomicInteger) Maps.e(this.countMap, obj);
if (atomicInteger == null) {
return 0;
}
do {
i2 = atomicInteger.get();
if (i2 == 0) {
return 0;
}
max = Math.max(0, i2 - i);
} while (!atomicInteger.compareAndSet(i2, max));
if (max == 0) {
this.countMap.remove(obj, atomicInteger);
}
return i2;
}
@Override // java.util.AbstractCollection, java.util.Collection
public <T> T[] toArray(T[] tArr) {
return (T[]) snapshot().toArray(tArr);
}
public static <E> ConcurrentHashMultiset<E> create(ConcurrentMap<E, AtomicInteger> concurrentMap) {
return new ConcurrentHashMultiset<>(concurrentMap);
}
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public boolean setCount(E e, int i, int i2) {
Preconditions.a(e);
CollectPreconditions.a(i, "oldCount");
CollectPreconditions.a(i2, "newCount");
AtomicInteger atomicInteger = (AtomicInteger) Maps.e(this.countMap, e);
if (atomicInteger == null) {
if (i != 0) {
return false;
}
return i2 == 0 || this.countMap.putIfAbsent(e, new AtomicInteger(i2)) == null;
}
int i3 = atomicInteger.get();
if (i3 == i) {
if (i3 == 0) {
if (i2 == 0) {
this.countMap.remove(e, atomicInteger);
return true;
}
AtomicInteger atomicInteger2 = new AtomicInteger(i2);
return this.countMap.putIfAbsent(e, atomicInteger2) == null || this.countMap.replace(e, atomicInteger, atomicInteger2);
}
if (atomicInteger.compareAndSet(i3, i2)) {
if (i2 == 0) {
this.countMap.remove(e, atomicInteger);
}
return true;
}
}
return false;
}
}

View File

@@ -0,0 +1,103 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSortedSet;
import java.lang.Comparable;
import java.util.NoSuchElementException;
/* loaded from: classes.dex */
public abstract class ContiguousSet<C extends Comparable> extends ImmutableSortedSet<C> {
final DiscreteDomain<C> domain;
ContiguousSet(DiscreteDomain<C> discreteDomain) {
super(Ordering.c());
this.domain = discreteDomain;
}
@Deprecated
public static <E> ImmutableSortedSet.Builder<E> builder() {
throw new UnsupportedOperationException();
}
public static <C extends Comparable> ContiguousSet<C> create(Range<C> range, DiscreteDomain<C> discreteDomain) {
Preconditions.a(range);
Preconditions.a(discreteDomain);
try {
Range<C> intersection = !range.hasLowerBound() ? range.intersection(Range.atLeast(discreteDomain.b())) : range;
if (!range.hasUpperBound()) {
intersection = intersection.intersection(Range.atMost(discreteDomain.a()));
}
return intersection.isEmpty() || Range.compareOrThrow(range.lowerBound.c(discreteDomain), range.upperBound.b(discreteDomain)) > 0 ? new EmptyContiguousSet(discreteDomain) : new RegularContiguousSet(intersection, discreteDomain);
} catch (NoSuchElementException e) {
throw new IllegalArgumentException(e);
}
}
@Override // com.google.common.collect.ImmutableSortedSet
ImmutableSortedSet<C> createDescendingSet() {
return new DescendingImmutableSortedSet(this);
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableSortedSet
public abstract ContiguousSet<C> headSetImpl(C c, boolean z);
public abstract ContiguousSet<C> intersection(ContiguousSet<C> contiguousSet);
public abstract Range<C> range();
public abstract Range<C> range(BoundType boundType, BoundType boundType2);
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableSortedSet
public abstract ContiguousSet<C> subSetImpl(C c, boolean z, C c2, boolean z2);
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableSortedSet
public abstract ContiguousSet<C> tailSetImpl(C c, boolean z);
@Override // java.util.AbstractCollection
public String toString() {
return range().toString();
}
@Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet, java.util.SortedSet
public ContiguousSet<C> headSet(C c) {
Preconditions.a(c);
return headSetImpl((ContiguousSet<C>) c, false);
}
@Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet, java.util.SortedSet
public ContiguousSet<C> subSet(C c, C c2) {
Preconditions.a(c);
Preconditions.a(c2);
Preconditions.a(comparator().compare(c, c2) <= 0);
return subSetImpl((boolean) c, true, (boolean) c2, false);
}
@Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet, java.util.SortedSet
public ContiguousSet<C> tailSet(C c) {
Preconditions.a(c);
return tailSetImpl((ContiguousSet<C>) c, true);
}
@Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet
public ContiguousSet<C> headSet(C c, boolean z) {
Preconditions.a(c);
return headSetImpl((ContiguousSet<C>) c, z);
}
@Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet
public ContiguousSet<C> tailSet(C c, boolean z) {
Preconditions.a(c);
return tailSetImpl((ContiguousSet<C>) c, z);
}
@Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet
public ContiguousSet<C> subSet(C c, boolean z, C c2, boolean z2) {
Preconditions.a(c);
Preconditions.a(c2);
Preconditions.a(comparator().compare(c, c2) <= 0);
return subSetImpl((boolean) c, z, (boolean) c2, z2);
}
}

View File

@@ -0,0 +1,439 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import com.google.common.primitives.Booleans;
import java.io.Serializable;
import java.lang.Comparable;
import java.util.NoSuchElementException;
/* loaded from: classes.dex */
abstract class Cut<C extends Comparable> implements Comparable<Cut<C>>, Serializable {
final C a;
/* renamed from: com.google.common.collect.Cut$1, reason: invalid class name */
static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] a = new int[BoundType.values().length];
static {
try {
a[BoundType.CLOSED.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[BoundType.OPEN.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
}
}
private static final class AboveAll extends Cut<Comparable<?>> {
private static final AboveAll b = new AboveAll();
private AboveAll() {
super(null);
}
private Object readResolve() {
return b;
}
@Override // com.google.common.collect.Cut, java.lang.Comparable
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public int compareTo(Cut<Comparable<?>> cut) {
return cut == this ? 0 : 1;
}
@Override // com.google.common.collect.Cut
Cut<Comparable<?>> a(BoundType boundType, DiscreteDomain<Comparable<?>> discreteDomain) {
throw new AssertionError("this statement should be unreachable");
}
@Override // com.google.common.collect.Cut
boolean a(Comparable<?> comparable) {
return false;
}
@Override // com.google.common.collect.Cut
Cut<Comparable<?>> b(BoundType boundType, DiscreteDomain<Comparable<?>> discreteDomain) {
throw new IllegalStateException();
}
@Override // com.google.common.collect.Cut
Comparable<?> c() {
throw new IllegalStateException("range unbounded on this side");
}
@Override // com.google.common.collect.Cut
BoundType d() {
throw new AssertionError("this statement should be unreachable");
}
@Override // com.google.common.collect.Cut
BoundType e() {
throw new IllegalStateException();
}
@Override // com.google.common.collect.Cut
public int hashCode() {
return System.identityHashCode(this);
}
public String toString() {
return "+∞";
}
@Override // com.google.common.collect.Cut
void a(StringBuilder sb) {
throw new AssertionError();
}
@Override // com.google.common.collect.Cut
void b(StringBuilder sb) {
sb.append("+∞)");
}
@Override // com.google.common.collect.Cut
Comparable<?> c(DiscreteDomain<Comparable<?>> discreteDomain) {
throw new AssertionError();
}
@Override // com.google.common.collect.Cut
Comparable<?> b(DiscreteDomain<Comparable<?>> discreteDomain) {
return discreteDomain.a();
}
}
private static final class AboveValue<C extends Comparable> extends Cut<C> {
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
AboveValue(C c) {
super(c);
Preconditions.a(c);
}
@Override // com.google.common.collect.Cut
boolean a(C c) {
return Range.compareOrThrow(this.a, c) < 0;
}
@Override // com.google.common.collect.Cut
Cut<C> b(BoundType boundType, DiscreteDomain<C> discreteDomain) {
int i = AnonymousClass1.a[boundType.ordinal()];
if (i == 1) {
return this;
}
if (i != 2) {
throw new AssertionError();
}
C a = discreteDomain.a(this.a);
return a == null ? Cut.f() : Cut.c(a);
}
@Override // com.google.common.collect.Cut
C c(DiscreteDomain<C> discreteDomain) {
return discreteDomain.a(this.a);
}
@Override // com.google.common.collect.Cut, java.lang.Comparable
public /* bridge */ /* synthetic */ int compareTo(Object obj) {
return super.compareTo((Cut) obj);
}
@Override // com.google.common.collect.Cut
BoundType d() {
return BoundType.OPEN;
}
@Override // com.google.common.collect.Cut
BoundType e() {
return BoundType.CLOSED;
}
@Override // com.google.common.collect.Cut
public int hashCode() {
return ~this.a.hashCode();
}
public String toString() {
return "/" + this.a + "\\";
}
@Override // com.google.common.collect.Cut
Cut<C> a(BoundType boundType, DiscreteDomain<C> discreteDomain) {
int i = AnonymousClass1.a[boundType.ordinal()];
if (i == 1) {
C a = discreteDomain.a(this.a);
return a == null ? Cut.g() : Cut.c(a);
}
if (i == 2) {
return this;
}
throw new AssertionError();
}
@Override // com.google.common.collect.Cut
void b(StringBuilder sb) {
sb.append(this.a);
sb.append(']');
}
@Override // com.google.common.collect.Cut
void a(StringBuilder sb) {
sb.append('(');
sb.append(this.a);
}
@Override // com.google.common.collect.Cut
C b(DiscreteDomain<C> discreteDomain) {
return this.a;
}
@Override // com.google.common.collect.Cut
Cut<C> a(DiscreteDomain<C> discreteDomain) {
C c = c(discreteDomain);
return c != null ? Cut.c(c) : Cut.f();
}
}
private static final class BelowAll extends Cut<Comparable<?>> {
private static final BelowAll b = new BelowAll();
private BelowAll() {
super(null);
}
private Object readResolve() {
return b;
}
@Override // com.google.common.collect.Cut, java.lang.Comparable
/* renamed from: a */
public int compareTo(Cut<Comparable<?>> cut) {
return cut == this ? 0 : -1;
}
@Override // com.google.common.collect.Cut
Cut<Comparable<?>> a(BoundType boundType, DiscreteDomain<Comparable<?>> discreteDomain) {
throw new IllegalStateException();
}
@Override // com.google.common.collect.Cut
boolean a(Comparable<?> comparable) {
return true;
}
@Override // com.google.common.collect.Cut
Cut<Comparable<?>> b(BoundType boundType, DiscreteDomain<Comparable<?>> discreteDomain) {
throw new AssertionError("this statement should be unreachable");
}
@Override // com.google.common.collect.Cut
Comparable<?> c() {
throw new IllegalStateException("range unbounded on this side");
}
@Override // com.google.common.collect.Cut
BoundType d() {
throw new IllegalStateException();
}
@Override // com.google.common.collect.Cut
BoundType e() {
throw new AssertionError("this statement should be unreachable");
}
@Override // com.google.common.collect.Cut
public int hashCode() {
return System.identityHashCode(this);
}
public String toString() {
return "-∞";
}
@Override // com.google.common.collect.Cut
void a(StringBuilder sb) {
sb.append("(-∞");
}
@Override // com.google.common.collect.Cut
void b(StringBuilder sb) {
throw new AssertionError();
}
@Override // com.google.common.collect.Cut
Comparable<?> c(DiscreteDomain<Comparable<?>> discreteDomain) {
return discreteDomain.b();
}
@Override // com.google.common.collect.Cut
Cut<Comparable<?>> a(DiscreteDomain<Comparable<?>> discreteDomain) {
try {
return Cut.c(discreteDomain.b());
} catch (NoSuchElementException unused) {
return this;
}
}
@Override // com.google.common.collect.Cut
Comparable<?> b(DiscreteDomain<Comparable<?>> discreteDomain) {
throw new AssertionError();
}
}
private static final class BelowValue<C extends Comparable> extends Cut<C> {
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
BelowValue(C c) {
super(c);
Preconditions.a(c);
}
@Override // com.google.common.collect.Cut
boolean a(C c) {
return Range.compareOrThrow(this.a, c) <= 0;
}
@Override // com.google.common.collect.Cut
Cut<C> b(BoundType boundType, DiscreteDomain<C> discreteDomain) {
int i = AnonymousClass1.a[boundType.ordinal()];
if (i == 1) {
C b = discreteDomain.b(this.a);
return b == null ? Cut.f() : new AboveValue(b);
}
if (i == 2) {
return this;
}
throw new AssertionError();
}
@Override // com.google.common.collect.Cut
C c(DiscreteDomain<C> discreteDomain) {
return this.a;
}
@Override // com.google.common.collect.Cut, java.lang.Comparable
public /* bridge */ /* synthetic */ int compareTo(Object obj) {
return super.compareTo((Cut) obj);
}
@Override // com.google.common.collect.Cut
BoundType d() {
return BoundType.CLOSED;
}
@Override // com.google.common.collect.Cut
BoundType e() {
return BoundType.OPEN;
}
@Override // com.google.common.collect.Cut
public int hashCode() {
return this.a.hashCode();
}
public String toString() {
return "\\" + this.a + "/";
}
@Override // com.google.common.collect.Cut
Cut<C> a(BoundType boundType, DiscreteDomain<C> discreteDomain) {
int i = AnonymousClass1.a[boundType.ordinal()];
if (i == 1) {
return this;
}
if (i != 2) {
throw new AssertionError();
}
C b = discreteDomain.b(this.a);
return b == null ? Cut.g() : new AboveValue(b);
}
@Override // com.google.common.collect.Cut
void b(StringBuilder sb) {
sb.append(this.a);
sb.append(')');
}
@Override // com.google.common.collect.Cut
void a(StringBuilder sb) {
sb.append('[');
sb.append(this.a);
}
@Override // com.google.common.collect.Cut
C b(DiscreteDomain<C> discreteDomain) {
return discreteDomain.b(this.a);
}
}
Cut(C c) {
this.a = c;
}
static <C extends Comparable> Cut<C> b(C c) {
return new AboveValue(c);
}
static <C extends Comparable> Cut<C> f() {
return AboveAll.b;
}
static <C extends Comparable> Cut<C> g() {
return BelowAll.b;
}
@Override // java.lang.Comparable
/* renamed from: a */
public int compareTo(Cut<C> cut) {
if (cut == g()) {
return 1;
}
if (cut == f()) {
return -1;
}
int compareOrThrow = Range.compareOrThrow(this.a, cut.a);
return compareOrThrow != 0 ? compareOrThrow : Booleans.a(this instanceof AboveValue, cut instanceof AboveValue);
}
abstract Cut<C> a(BoundType boundType, DiscreteDomain<C> discreteDomain);
Cut<C> a(DiscreteDomain<C> discreteDomain) {
return this;
}
abstract void a(StringBuilder sb);
abstract boolean a(C c);
abstract Cut<C> b(BoundType boundType, DiscreteDomain<C> discreteDomain);
abstract C b(DiscreteDomain<C> discreteDomain);
abstract void b(StringBuilder sb);
C c() {
return this.a;
}
abstract C c(DiscreteDomain<C> discreteDomain);
abstract BoundType d();
abstract BoundType e();
public boolean equals(Object obj) {
if (!(obj instanceof Cut)) {
return false;
}
try {
return compareTo((Cut) obj) == 0;
} catch (ClassCastException unused) {
return false;
}
}
public abstract int hashCode();
static <C extends Comparable> Cut<C> c(C c) {
return new BelowValue(c);
}
}

View File

@@ -0,0 +1,253 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableTable;
import com.google.common.collect.Table;
import java.lang.reflect.Array;
import java.util.Map;
/* loaded from: classes.dex */
final class DenseImmutableTable<R, C, V> extends RegularImmutableTable<R, C, V> {
private final ImmutableMap<R, Integer> a;
private final ImmutableMap<C, Integer> b;
private final ImmutableMap<R, Map<C, V>> c;
private final ImmutableMap<C, Map<R, V>> d;
private final int[] e;
private final int[] f;
private final V[][] g;
private final int[] h;
private final int[] i;
private final class Column extends ImmutableArrayMap<R, V> {
private final int b;
Column(int i) {
super(DenseImmutableTable.this.f[i]);
this.b = i;
}
@Override // com.google.common.collect.DenseImmutableTable.ImmutableArrayMap
ImmutableMap<R, Integer> b() {
return DenseImmutableTable.this.a;
}
@Override // com.google.common.collect.ImmutableMap
boolean isPartialView() {
return true;
}
@Override // com.google.common.collect.DenseImmutableTable.ImmutableArrayMap
V b(int i) {
return (V) DenseImmutableTable.this.g[i][this.b];
}
}
private final class ColumnMap extends ImmutableArrayMap<C, Map<R, V>> {
@Override // com.google.common.collect.ImmutableMap
boolean isPartialView() {
return false;
}
private ColumnMap() {
super(DenseImmutableTable.this.f.length);
}
@Override // com.google.common.collect.DenseImmutableTable.ImmutableArrayMap
ImmutableMap<C, Integer> b() {
return DenseImmutableTable.this.b;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.DenseImmutableTable.ImmutableArrayMap
public Map<R, V> b(int i) {
return new Column(i);
}
}
private static abstract class ImmutableArrayMap<K, V> extends ImmutableMap.IteratorBasedImmutableMap<K, V> {
private final int a;
ImmutableArrayMap(int i) {
this.a = i;
}
private boolean c() {
return this.a == b().size();
}
K a(int i) {
return b().keySet().asList().get(i);
}
abstract ImmutableMap<K, Integer> b();
abstract V b(int i);
@Override // com.google.common.collect.ImmutableMap.IteratorBasedImmutableMap, com.google.common.collect.ImmutableMap
ImmutableSet<K> createKeySet() {
return c() ? b().keySet() : super.createKeySet();
}
@Override // com.google.common.collect.ImmutableMap, java.util.Map
public V get(Object obj) {
Integer num = b().get(obj);
if (num == null) {
return null;
}
return b(num.intValue());
}
@Override // java.util.Map
public int size() {
return this.a;
}
@Override // com.google.common.collect.ImmutableMap.IteratorBasedImmutableMap
UnmodifiableIterator<Map.Entry<K, V>> a() {
return new AbstractIterator<Map.Entry<K, V>>() { // from class: com.google.common.collect.DenseImmutableTable.ImmutableArrayMap.1
private int c = -1;
private final int d;
{
this.d = ImmutableArrayMap.this.b().size();
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.AbstractIterator
public Map.Entry<K, V> a() {
int i = this.c;
while (true) {
this.c = i + 1;
int i2 = this.c;
if (i2 >= this.d) {
return b();
}
Object b = ImmutableArrayMap.this.b(i2);
if (b != null) {
return Maps.a(ImmutableArrayMap.this.a(this.c), b);
}
i = this.c;
}
}
};
}
}
private final class Row extends ImmutableArrayMap<C, V> {
private final int b;
Row(int i) {
super(DenseImmutableTable.this.e[i]);
this.b = i;
}
@Override // com.google.common.collect.DenseImmutableTable.ImmutableArrayMap
ImmutableMap<C, Integer> b() {
return DenseImmutableTable.this.b;
}
@Override // com.google.common.collect.ImmutableMap
boolean isPartialView() {
return true;
}
@Override // com.google.common.collect.DenseImmutableTable.ImmutableArrayMap
V b(int i) {
return (V) DenseImmutableTable.this.g[this.b][i];
}
}
private final class RowMap extends ImmutableArrayMap<R, Map<C, V>> {
@Override // com.google.common.collect.ImmutableMap
boolean isPartialView() {
return false;
}
private RowMap() {
super(DenseImmutableTable.this.e.length);
}
@Override // com.google.common.collect.DenseImmutableTable.ImmutableArrayMap
ImmutableMap<R, Integer> b() {
return DenseImmutableTable.this.a;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.DenseImmutableTable.ImmutableArrayMap
public Map<C, V> b(int i) {
return new Row(i);
}
}
DenseImmutableTable(ImmutableList<Table.Cell<R, C, V>> immutableList, ImmutableSet<R> immutableSet, ImmutableSet<C> immutableSet2) {
this.g = (V[][]) ((Object[][]) Array.newInstance((Class<?>) Object.class, immutableSet.size(), immutableSet2.size()));
this.a = Maps.a(immutableSet);
this.b = Maps.a(immutableSet2);
this.e = new int[this.a.size()];
this.f = new int[this.b.size()];
int[] iArr = new int[immutableList.size()];
int[] iArr2 = new int[immutableList.size()];
for (int i = 0; i < immutableList.size(); i++) {
Table.Cell<R, C, V> cell = immutableList.get(i);
R b = cell.b();
C a = cell.a();
int intValue = this.a.get(b).intValue();
int intValue2 = this.b.get(a).intValue();
Preconditions.a(this.g[intValue][intValue2] == null, "duplicate key: (%s, %s)", b, a);
this.g[intValue][intValue2] = cell.getValue();
int[] iArr3 = this.e;
iArr3[intValue] = iArr3[intValue] + 1;
int[] iArr4 = this.f;
iArr4[intValue2] = iArr4[intValue2] + 1;
iArr[i] = intValue;
iArr2[i] = intValue2;
}
this.h = iArr;
this.i = iArr2;
this.c = new RowMap();
this.d = new ColumnMap();
}
@Override // com.google.common.collect.ImmutableTable
ImmutableTable.SerializedForm createSerializedForm() {
return ImmutableTable.SerializedForm.a(this, this.h, this.i);
}
@Override // com.google.common.collect.ImmutableTable, com.google.common.collect.AbstractTable
public V get(Object obj, Object obj2) {
Integer num = this.a.get(obj);
Integer num2 = this.b.get(obj2);
if (num == null || num2 == null) {
return null;
}
return this.g[num.intValue()][num2.intValue()];
}
@Override // com.google.common.collect.RegularImmutableTable
Table.Cell<R, C, V> getCell(int i) {
int i2 = this.h[i];
int i3 = this.i[i];
return ImmutableTable.cellOf(rowKeySet().asList().get(i2), columnKeySet().asList().get(i3), this.g[i2][i3]);
}
@Override // com.google.common.collect.RegularImmutableTable
V getValue(int i) {
return this.g[this.h[i]][this.i[i]];
}
@Override // com.google.common.collect.Table
public int size() {
return this.h.length;
}
@Override // com.google.common.collect.ImmutableTable, com.google.common.collect.Table
public ImmutableMap<C, Map<R, V>> columnMap() {
return this.d;
}
@Override // com.google.common.collect.ImmutableTable, com.google.common.collect.Table
public ImmutableMap<R, Map<C, V>> rowMap() {
return this.c;
}
}

View File

@@ -0,0 +1,74 @@
package com.google.common.collect;
import com.google.common.collect.Multiset;
/* loaded from: classes.dex */
final class DescendingImmutableSortedMultiset<E> extends ImmutableSortedMultiset<E> {
private final transient ImmutableSortedMultiset<E> a;
DescendingImmutableSortedMultiset(ImmutableSortedMultiset<E> immutableSortedMultiset) {
this.a = immutableSortedMultiset;
}
@Override // com.google.common.collect.Multiset
public int count(Object obj) {
return this.a.count(obj);
}
@Override // com.google.common.collect.SortedMultiset
public Multiset.Entry<E> firstEntry() {
return this.a.lastEntry();
}
@Override // com.google.common.collect.ImmutableMultiset
Multiset.Entry<E> getEntry(int i) {
return this.a.entrySet().asList().reverse().get(i);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableSortedMultiset, com.google.common.collect.SortedMultiset
public /* bridge */ /* synthetic */ SortedMultiset headMultiset(Object obj, BoundType boundType) {
return headMultiset((DescendingImmutableSortedMultiset<E>) obj, boundType);
}
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return this.a.isPartialView();
}
@Override // com.google.common.collect.SortedMultiset
public Multiset.Entry<E> lastEntry() {
return this.a.firstEntry();
}
@Override // java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public int size() {
return this.a.size();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableSortedMultiset, com.google.common.collect.SortedMultiset
public /* bridge */ /* synthetic */ SortedMultiset tailMultiset(Object obj, BoundType boundType) {
return tailMultiset((DescendingImmutableSortedMultiset<E>) obj, boundType);
}
@Override // com.google.common.collect.ImmutableSortedMultiset, com.google.common.collect.SortedMultiset
public ImmutableSortedMultiset<E> descendingMultiset() {
return this.a;
}
@Override // com.google.common.collect.ImmutableSortedMultiset, com.google.common.collect.SortedMultiset
public ImmutableSortedMultiset<E> headMultiset(E e, BoundType boundType) {
return this.a.tailMultiset((ImmutableSortedMultiset<E>) e, boundType).descendingMultiset();
}
@Override // com.google.common.collect.ImmutableSortedMultiset, com.google.common.collect.SortedMultiset
public ImmutableSortedMultiset<E> tailMultiset(E e, BoundType boundType) {
return this.a.headMultiset((ImmutableSortedMultiset<E>) e, boundType).descendingMultiset();
}
@Override // com.google.common.collect.ImmutableSortedMultiset, com.google.common.collect.ImmutableMultiset, com.google.common.collect.Multiset
public ImmutableSortedSet<E> elementSet() {
return this.a.elementSet().descendingSet();
}
}

View File

@@ -0,0 +1,87 @@
package com.google.common.collect;
/* loaded from: classes.dex */
final class DescendingImmutableSortedSet<E> extends ImmutableSortedSet<E> {
private final ImmutableSortedSet<E> a;
DescendingImmutableSortedSet(ImmutableSortedSet<E> immutableSortedSet) {
super(Ordering.a(immutableSortedSet.comparator()).b());
this.a = immutableSortedSet;
}
@Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet
public E ceiling(E e) {
return this.a.floor(e);
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return this.a.contains(obj);
}
@Override // com.google.common.collect.ImmutableSortedSet
ImmutableSortedSet<E> createDescendingSet() {
throw new AssertionError("should never be called");
}
@Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet
public E floor(E e) {
return this.a.ceiling(e);
}
@Override // com.google.common.collect.ImmutableSortedSet
ImmutableSortedSet<E> headSetImpl(E e, boolean z) {
return this.a.tailSet((ImmutableSortedSet<E>) e, z).descendingSet();
}
@Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet
public E higher(E e) {
return this.a.lower(e);
}
@Override // com.google.common.collect.ImmutableSortedSet
int indexOf(Object obj) {
int indexOf = this.a.indexOf(obj);
return indexOf == -1 ? indexOf : (size() - 1) - indexOf;
}
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return this.a.isPartialView();
}
@Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet
public E lower(E e) {
return this.a.higher(e);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return this.a.size();
}
@Override // com.google.common.collect.ImmutableSortedSet
ImmutableSortedSet<E> subSetImpl(E e, boolean z, E e2, boolean z2) {
return this.a.subSet((boolean) e2, z2, (boolean) e, z).descendingSet();
}
@Override // com.google.common.collect.ImmutableSortedSet
ImmutableSortedSet<E> tailSetImpl(E e, boolean z) {
return this.a.headSet((ImmutableSortedSet<E>) e, z).descendingSet();
}
@Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet
public UnmodifiableIterator<E> descendingIterator() {
return this.a.iterator();
}
@Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet
public ImmutableSortedSet<E> descendingSet() {
return this.a;
}
@Override // com.google.common.collect.ImmutableSortedSet, com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
public UnmodifiableIterator<E> iterator() {
return this.a.descendingIterator();
}
}

View File

@@ -0,0 +1,136 @@
package com.google.common.collect;
import com.google.common.collect.Multiset;
import com.google.common.collect.Multisets;
import com.google.common.collect.SortedMultisets;
import java.util.Comparator;
import java.util.Iterator;
import java.util.NavigableSet;
import java.util.Set;
/* loaded from: classes.dex */
abstract class DescendingMultiset<E> extends ForwardingMultiset<E> implements SortedMultiset<E> {
private transient Comparator<? super E> a;
private transient NavigableSet<E> b;
private transient Set<Multiset.Entry<E>> c;
DescendingMultiset() {
}
Set<Multiset.Entry<E>> a() {
return new Multisets.EntrySet<E>() { // from class: com.google.common.collect.DescendingMultiset.1EntrySetImpl
@Override // com.google.common.collect.Multisets.EntrySet
Multiset<E> c() {
return DescendingMultiset.this;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<Multiset.Entry<E>> iterator() {
return DescendingMultiset.this.b();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return DescendingMultiset.this.c().entrySet().size();
}
};
}
abstract Iterator<Multiset.Entry<E>> b();
abstract SortedMultiset<E> c();
@Override // com.google.common.collect.SortedMultiset, com.google.common.collect.SortedIterable
public Comparator<? super E> comparator() {
Comparator<? super E> comparator = this.a;
if (comparator != null) {
return comparator;
}
Ordering b = Ordering.a(c().comparator()).b();
this.a = b;
return b;
}
@Override // com.google.common.collect.SortedMultiset
public SortedMultiset<E> descendingMultiset() {
return c();
}
@Override // com.google.common.collect.ForwardingMultiset, com.google.common.collect.Multiset
public Set<Multiset.Entry<E>> entrySet() {
Set<Multiset.Entry<E>> set = this.c;
if (set != null) {
return set;
}
Set<Multiset.Entry<E>> a = a();
this.c = a;
return a;
}
@Override // com.google.common.collect.SortedMultiset
public Multiset.Entry<E> firstEntry() {
return c().lastEntry();
}
@Override // com.google.common.collect.SortedMultiset
public SortedMultiset<E> headMultiset(E e, BoundType boundType) {
return c().tailMultiset(e, boundType).descendingMultiset();
}
@Override // com.google.common.collect.SortedMultiset
public Multiset.Entry<E> lastEntry() {
return c().firstEntry();
}
@Override // com.google.common.collect.SortedMultiset
public Multiset.Entry<E> pollFirstEntry() {
return c().pollLastEntry();
}
@Override // com.google.common.collect.SortedMultiset
public Multiset.Entry<E> pollLastEntry() {
return c().pollFirstEntry();
}
@Override // com.google.common.collect.SortedMultiset
public SortedMultiset<E> subMultiset(E e, BoundType boundType, E e2, BoundType boundType2) {
return c().subMultiset(e2, boundType2, e, boundType).descendingMultiset();
}
@Override // com.google.common.collect.SortedMultiset
public SortedMultiset<E> tailMultiset(E e, BoundType boundType) {
return c().headMultiset(e, boundType).descendingMultiset();
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public Object[] toArray() {
return standardToArray();
}
@Override // com.google.common.collect.ForwardingObject
public String toString() {
return entrySet().toString();
}
@Override // com.google.common.collect.Multiset
public NavigableSet<E> elementSet() {
NavigableSet<E> navigableSet = this.b;
if (navigableSet != null) {
return navigableSet;
}
SortedMultisets.NavigableElementSet navigableElementSet = new SortedMultisets.NavigableElementSet(this);
this.b = navigableElementSet;
return navigableElementSet;
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public <T> T[] toArray(T[] tArr) {
return (T[]) standardToArray(tArr);
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.ForwardingCollection, com.google.common.collect.ForwardingObject
public Multiset<E> delegate() {
return c();
}
}

View File

@@ -0,0 +1,20 @@
package com.google.common.collect;
import java.lang.Comparable;
/* loaded from: classes.dex */
public abstract class DiscreteDomain<C extends Comparable> {
final boolean a;
public abstract long a(C c, C c2);
public abstract C a();
public abstract C a(C c);
abstract C a(C c, long j);
public abstract C b();
public abstract C b(C c);
}

View File

@@ -0,0 +1,142 @@
package com.google.common.collect;
import java.io.Serializable;
import java.lang.Comparable;
import java.util.NoSuchElementException;
import java.util.Set;
/* loaded from: classes.dex */
final class EmptyContiguousSet<C extends Comparable> extends ContiguousSet<C> {
private static final class SerializedForm<C extends Comparable> implements Serializable {
private final DiscreteDomain<C> a;
private Object readResolve() {
return new EmptyContiguousSet(this.a);
}
private SerializedForm(DiscreteDomain<C> discreteDomain) {
this.a = discreteDomain;
}
}
EmptyContiguousSet(DiscreteDomain<C> discreteDomain) {
super(discreteDomain);
}
@Override // com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection
public ImmutableList<C> asList() {
return ImmutableList.of();
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return false;
}
@Override // com.google.common.collect.ContiguousSet, com.google.common.collect.ImmutableSortedSet
ImmutableSortedSet<C> createDescendingSet() {
return ImmutableSortedSet.emptySet(Ordering.c().b());
}
@Override // com.google.common.collect.ImmutableSet, java.util.Collection, java.util.Set
public boolean equals(Object obj) {
if (obj instanceof Set) {
return ((Set) obj).isEmpty();
}
return false;
}
@Override // com.google.common.collect.ImmutableSet, java.util.Collection, java.util.Set
public int hashCode() {
return 0;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ContiguousSet, com.google.common.collect.ImmutableSortedSet
public ContiguousSet<C> headSetImpl(C c, boolean z) {
return this;
}
@Override // com.google.common.collect.ImmutableSortedSet
int indexOf(Object obj) {
return -1;
}
@Override // com.google.common.collect.ContiguousSet
public ContiguousSet<C> intersection(ContiguousSet<C> contiguousSet) {
return this;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean isEmpty() {
return true;
}
@Override // com.google.common.collect.ImmutableSet
boolean isHashCodeFast() {
return true;
}
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return false;
}
@Override // com.google.common.collect.ContiguousSet
public Range<C> range() {
throw new NoSuchElementException();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return 0;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ContiguousSet, com.google.common.collect.ImmutableSortedSet
public ContiguousSet<C> subSetImpl(C c, boolean z, C c2, boolean z2) {
return this;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ContiguousSet, com.google.common.collect.ImmutableSortedSet
public ContiguousSet<C> tailSetImpl(C c, boolean z) {
return this;
}
@Override // com.google.common.collect.ContiguousSet, java.util.AbstractCollection
public String toString() {
return "[]";
}
@Override // com.google.common.collect.ImmutableSortedSet, com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection
Object writeReplace() {
return new SerializedForm(this.domain);
}
@Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet
public UnmodifiableIterator<C> descendingIterator() {
return Iterators.a();
}
@Override // com.google.common.collect.ImmutableSortedSet, java.util.SortedSet
public C first() {
throw new NoSuchElementException();
}
@Override // com.google.common.collect.ImmutableSortedSet, com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
public UnmodifiableIterator<C> iterator() {
return Iterators.a();
}
@Override // com.google.common.collect.ImmutableSortedSet, java.util.SortedSet
public C last() {
throw new NoSuchElementException();
}
@Override // com.google.common.collect.ContiguousSet
public Range<C> range(BoundType boundType, BoundType boundType2) {
throw new NoSuchElementException();
}
}

View File

@@ -0,0 +1,14 @@
package com.google.common.collect;
/* loaded from: classes.dex */
class EmptyImmutableListMultimap extends ImmutableListMultimap<Object, Object> {
static final EmptyImmutableListMultimap a = new EmptyImmutableListMultimap();
private EmptyImmutableListMultimap() {
super(ImmutableMap.of(), 0);
}
private Object readResolve() {
return a;
}
}

View File

@@ -0,0 +1,14 @@
package com.google.common.collect;
/* loaded from: classes.dex */
class EmptyImmutableSetMultimap extends ImmutableSetMultimap<Object, Object> {
static final EmptyImmutableSetMultimap a = new EmptyImmutableSetMultimap();
private EmptyImmutableSetMultimap() {
super(ImmutableMap.of(), 0, null);
}
private Object readResolve() {
return a;
}
}

View File

@@ -0,0 +1,124 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.lang.Enum;
import java.util.EnumMap;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
public final class EnumBiMap<K extends Enum<K>, V extends Enum<V>> extends AbstractBiMap<K, V> {
private static final long serialVersionUID = 0;
private transient Class<K> keyType;
private transient Class<V> valueType;
private EnumBiMap(Class<K> cls, Class<V> cls2) {
super(WellBehavedMap.a(new EnumMap(cls)), WellBehavedMap.a(new EnumMap(cls2)));
this.keyType = cls;
this.valueType = cls2;
}
public static <K extends Enum<K>, V extends Enum<V>> EnumBiMap<K, V> create(Class<K> cls, Class<V> cls2) {
return new EnumBiMap<>(cls, cls2);
}
static <K extends Enum<K>> Class<K> inferKeyType(Map<K, ?> map) {
if (map instanceof EnumBiMap) {
return ((EnumBiMap) map).keyType();
}
if (map instanceof EnumHashBiMap) {
return ((EnumHashBiMap) map).keyType();
}
Preconditions.a(!map.isEmpty());
return map.keySet().iterator().next().getDeclaringClass();
}
private static <V extends Enum<V>> Class<V> inferValueType(Map<?, V> map) {
if (map instanceof EnumBiMap) {
return ((EnumBiMap) map).valueType;
}
Preconditions.a(!map.isEmpty());
return map.values().iterator().next().getDeclaringClass();
}
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
objectInputStream.defaultReadObject();
this.keyType = (Class) objectInputStream.readObject();
this.valueType = (Class) objectInputStream.readObject();
setDelegates(WellBehavedMap.a(new EnumMap(this.keyType)), WellBehavedMap.a(new EnumMap(this.valueType)));
Serialization.a(this, objectInputStream);
}
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
objectOutputStream.defaultWriteObject();
objectOutputStream.writeObject(this.keyType);
objectOutputStream.writeObject(this.valueType);
Serialization.a(this, objectOutputStream);
}
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.ForwardingMap, java.util.Map
public /* bridge */ /* synthetic */ void clear() {
super.clear();
}
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.ForwardingMap, java.util.Map
public /* bridge */ /* synthetic */ boolean containsValue(Object obj) {
return super.containsValue(obj);
}
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.ForwardingMap, java.util.Map
public /* bridge */ /* synthetic */ Set entrySet() {
return super.entrySet();
}
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.BiMap
public /* bridge */ /* synthetic */ BiMap inverse() {
return super.inverse();
}
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.ForwardingMap, java.util.Map
public /* bridge */ /* synthetic */ Set keySet() {
return super.keySet();
}
public Class<K> keyType() {
return this.keyType;
}
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.ForwardingMap, java.util.Map
public /* bridge */ /* synthetic */ void putAll(Map map) {
super.putAll(map);
}
public Class<V> valueType() {
return this.valueType;
}
@Override // com.google.common.collect.AbstractBiMap, com.google.common.collect.ForwardingMap, java.util.Map
public /* bridge */ /* synthetic */ Set values() {
return super.values();
}
public static <K extends Enum<K>, V extends Enum<V>> EnumBiMap<K, V> create(Map<K, V> map) {
EnumBiMap<K, V> create = create(inferKeyType(map), inferValueType(map));
create.putAll(map);
return create;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractBiMap
public K checkKey(K k) {
Preconditions.a(k);
return k;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractBiMap
public V checkValue(V v) {
Preconditions.a(v);
return v;
}
}

View File

@@ -0,0 +1,288 @@
package com.google.common.collect;
import com.google.common.collect.Multiset;
import java.lang.Enum;
import java.util.Arrays;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Set;
/* loaded from: classes.dex */
class EnumCountHashMap<K extends Enum<K>> extends AbstractObjectCountMap<K> {
private final Class<K> g;
private abstract class EnumIterator<T> extends AbstractObjectCountMap<K>.Itr<T> {
int e;
private EnumIterator() {
super();
this.e = -1;
}
@Override // com.google.common.collect.AbstractObjectCountMap.Itr, java.util.Iterator
public boolean hasNext() {
while (true) {
int i = this.c;
int[] iArr = EnumCountHashMap.this.b;
if (i >= iArr.length || iArr[i] > 0) {
break;
}
this.c = i + 1;
}
return this.c != EnumCountHashMap.this.b.length;
}
@Override // com.google.common.collect.AbstractObjectCountMap.Itr, java.util.Iterator
public T next() {
a();
if (!hasNext()) {
throw new NoSuchElementException();
}
this.b = true;
int i = this.c;
this.e = i;
this.c = i + 1;
return a(i);
}
@Override // com.google.common.collect.AbstractObjectCountMap.Itr, java.util.Iterator
public void remove() {
a();
CollectPreconditions.a(this.b);
this.a++;
EnumCountHashMap.this.e(this.e);
this.b = false;
this.e = -1;
this.c--;
}
}
class EnumMapEntry extends AbstractObjectCountMap<K>.MapEntry {
EnumMapEntry(int i) {
super(i);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractObjectCountMap.MapEntry
public int a(int i) {
EnumCountHashMap enumCountHashMap = EnumCountHashMap.this;
int[] iArr = enumCountHashMap.b;
int i2 = this.b;
if (iArr[i2] == -1) {
enumCountHashMap.a((EnumCountHashMap) this.a, i);
return 0;
}
int i3 = iArr[i2];
iArr[i2] = i;
if (i3 == -1) {
return 0;
}
return i3;
}
@Override // com.google.common.collect.AbstractObjectCountMap.MapEntry, com.google.common.collect.Multiset.Entry
public int getCount() {
int[] iArr = EnumCountHashMap.this.b;
int i = this.b;
if (iArr[i] == -1) {
return 0;
}
return iArr[i];
}
}
EnumCountHashMap(Class<K> cls) {
this.g = cls;
this.a = cls.getEnumConstants();
Object[] objArr = this.a;
if (objArr != null) {
this.b = new int[objArr.length];
Arrays.fill(this.b, 0, objArr.length, -1);
} else {
throw new IllegalStateException("Expected Enum class type, but got " + cls.getName());
}
}
@Override // com.google.common.collect.AbstractObjectCountMap
Set<Multiset.Entry<K>> b() {
return new AbstractObjectCountMap<K>.EntrySetView() { // from class: com.google.common.collect.EnumCountHashMap.2
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<Multiset.Entry<K>> iterator() {
return new EnumCountHashMap<K>.EnumIterator<Multiset.Entry<K>>() { // from class: com.google.common.collect.EnumCountHashMap.2.1
{
EnumCountHashMap enumCountHashMap = EnumCountHashMap.this;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractObjectCountMap.Itr
public Multiset.Entry<K> a(int i) {
return new EnumMapEntry(i);
}
};
}
};
}
@Override // com.google.common.collect.AbstractObjectCountMap
Set<K> c() {
return new AbstractObjectCountMap<K>.KeySetView() { // from class: com.google.common.collect.EnumCountHashMap.1
private Object[] c() {
Object[] objArr = new Object[EnumCountHashMap.this.c];
int i = 0;
int i2 = 0;
while (true) {
EnumCountHashMap enumCountHashMap = EnumCountHashMap.this;
Object[] objArr2 = enumCountHashMap.a;
if (i >= objArr2.length) {
return objArr;
}
if (enumCountHashMap.b[i] != -1) {
objArr[i2] = objArr2[i];
i2++;
}
i++;
}
}
@Override // com.google.common.collect.AbstractObjectCountMap.KeySetView, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<K> iterator() {
return new EnumCountHashMap<K>.EnumIterator<K>() { // from class: com.google.common.collect.EnumCountHashMap.1.1
{
EnumCountHashMap enumCountHashMap = EnumCountHashMap.this;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractObjectCountMap.Itr
public K a(int i) {
return (K) EnumCountHashMap.this.a[i];
}
};
}
@Override // com.google.common.collect.AbstractObjectCountMap.KeySetView, java.util.AbstractCollection, java.util.Collection, java.util.Set
public Object[] toArray() {
return c();
}
@Override // com.google.common.collect.AbstractObjectCountMap.KeySetView, java.util.AbstractCollection, java.util.Collection, java.util.Set
public <T> T[] toArray(T[] tArr) {
return (T[]) ObjectArrays.a(c(), 0, EnumCountHashMap.this.c, tArr);
}
};
}
@Override // com.google.common.collect.AbstractObjectCountMap
int d(int i) {
do {
i++;
if (i >= this.a.length) {
return -1;
}
} while (this.b[i] <= 0);
return i;
}
@Override // com.google.common.collect.AbstractObjectCountMap
int e() {
for (int i = 0; i < this.a.length; i++) {
if (this.b[i] > 0) {
return i;
}
}
return -1;
}
public int hashCode() {
int i = 0;
int i2 = 0;
while (true) {
Object[] objArr = this.a;
if (i >= objArr.length) {
return i2;
}
i2 += objArr[i].hashCode() ^ this.b[i];
i++;
}
}
@Override // com.google.common.collect.AbstractObjectCountMap
public void a() {
this.d++;
if (this.a != null) {
int[] iArr = this.b;
Arrays.fill(iArr, 0, iArr.length, -1);
this.c = 0;
}
}
@Override // com.google.common.collect.AbstractObjectCountMap
int b(Object obj) {
if (e(obj)) {
return ((Enum) obj).ordinal();
}
return -1;
}
@Override // com.google.common.collect.AbstractObjectCountMap
public int c(Object obj) {
int ordinal;
int[] iArr;
int i;
if (!e(obj) || (i = (iArr = this.b)[(ordinal = ((Enum) obj).ordinal())]) == -1) {
return 0;
}
iArr[ordinal] = -1;
this.c--;
this.d++;
return i;
}
private boolean e(Object obj) {
if (obj == null) {
return false;
}
Class<?> cls = obj.getClass();
return cls == this.g || cls.getSuperclass() == this.g;
}
public boolean d(Object obj) {
return e(obj) && this.b[((Enum) obj).ordinal()] != -1;
}
@Override // com.google.common.collect.AbstractObjectCountMap
int e(int i) {
return c(this.a[i]);
}
@Override // com.google.common.collect.AbstractObjectCountMap
public int a(Object obj) {
if (d(obj)) {
return this.b[((Enum) obj).ordinal()];
}
return 0;
}
@Override // com.google.common.collect.AbstractObjectCountMap
public int a(K k, int i) {
CollectPreconditions.b(i, "count");
a((EnumCountHashMap<K>) k);
int ordinal = k.ordinal();
int[] iArr = this.b;
int i2 = iArr[ordinal];
iArr[ordinal] = i;
this.d++;
if (i2 != -1) {
return i2;
}
this.c++;
return 0;
}
private void a(K k) {
Class<?> cls = k.getClass();
if (cls == this.g || cls.getSuperclass() == this.g) {
return;
}
throw new ClassCastException(cls + " != " + this.g);
}
}

View File

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

View File

@@ -0,0 +1,137 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.lang.Enum;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
/* loaded from: classes.dex */
public final class EnumMultiset<E extends Enum<E>> extends AbstractMapBasedMultiset<E> {
private static final long serialVersionUID = 0;
private transient Class<E> type;
private EnumMultiset(Class<E> cls) {
super(new EnumCountHashMap(cls));
this.type = cls;
}
public static <E extends Enum<E>> EnumMultiset<E> create(Class<E> cls) {
return new EnumMultiset<>(cls);
}
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
objectInputStream.defaultReadObject();
this.type = (Class) objectInputStream.readObject();
setBackingMap(new EnumCountHashMap(this.type));
Serialization.a(this, objectInputStream);
}
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
objectOutputStream.defaultWriteObject();
objectOutputStream.writeObject(this.type);
Serialization.a(this, objectOutputStream);
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public /* bridge */ /* synthetic */ boolean addAll(Collection collection) {
return super.addAll(collection);
}
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public /* bridge */ /* synthetic */ void clear() {
super.clear();
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ boolean contains(Object obj) {
return super.contains(obj);
}
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ int count(Object obj) {
return super.count(obj);
}
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset
public /* bridge */ /* synthetic */ Set createEntrySet() {
return super.createEntrySet();
}
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ Set elementSet() {
return super.elementSet();
}
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ Set entrySet() {
return super.entrySet();
}
@Override // com.google.common.collect.AbstractMultiset, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ boolean equals(Object obj) {
return super.equals(obj);
}
@Override // com.google.common.collect.AbstractMultiset, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ int hashCode() {
return super.hashCode();
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public /* bridge */ /* synthetic */ boolean isEmpty() {
return super.isEmpty();
}
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public /* bridge */ /* synthetic */ Iterator iterator() {
return super.iterator();
}
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ int remove(Object obj, int i) {
return super.remove(obj, i);
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public /* bridge */ /* synthetic */ boolean removeAll(Collection collection) {
return super.removeAll(collection);
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public /* bridge */ /* synthetic */ boolean retainAll(Collection collection) {
return super.retainAll(collection);
}
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ int size() {
return super.size();
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
public static <E extends Enum<E>> EnumMultiset<E> create(Iterable<E> iterable) {
Iterator<E> it = iterable.iterator();
Preconditions.a(it.hasNext(), "EnumMultiset constructor passed empty Iterable");
EnumMultiset<E> enumMultiset = new EnumMultiset<>(it.next().getDeclaringClass());
Iterables.a((Collection) enumMultiset, (Iterable) iterable);
return enumMultiset;
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ boolean remove(Object obj) {
return super.remove(obj);
}
public static <E extends Enum<E>> EnumMultiset<E> create(Iterable<E> iterable, Class<E> cls) {
EnumMultiset<E> create = create(cls);
Iterables.a((Collection) create, (Iterable) iterable);
return create;
}
}

View File

@@ -0,0 +1,76 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import java.io.Serializable;
import java.util.ArrayDeque;
import java.util.Collection;
import java.util.Queue;
/* loaded from: classes.dex */
public final class EvictingQueue<E> extends ForwardingQueue<E> implements Serializable {
private static final long serialVersionUID = 0;
private final Queue<E> delegate;
final int maxSize;
private EvictingQueue(int i) {
Preconditions.a(i >= 0, "maxSize (%s) must >= 0", i);
this.delegate = new ArrayDeque(i);
this.maxSize = i;
}
public static <E> EvictingQueue<E> create(int i) {
return new EvictingQueue<>(i);
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Queue
public boolean add(E e) {
Preconditions.a(e);
if (this.maxSize == 0) {
return true;
}
if (size() == this.maxSize) {
this.delegate.remove();
}
this.delegate.add(e);
return true;
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection
public boolean addAll(Collection<? extends E> collection) {
int size = collection.size();
if (size < this.maxSize) {
return standardAddAll(collection);
}
clear();
return Iterables.a((Collection) this, Iterables.a(collection, size - this.maxSize));
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
Queue<E> delegate = delegate();
Preconditions.a(obj);
return delegate.contains(obj);
}
@Override // com.google.common.collect.ForwardingQueue, java.util.Queue
public boolean offer(E e) {
return add(e);
}
public int remainingCapacity() {
return this.maxSize - size();
}
@Override // com.google.common.collect.ForwardingCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
Queue<E> delegate = delegate();
Preconditions.a(obj);
return delegate.remove(obj);
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.ForwardingQueue, com.google.common.collect.ForwardingCollection, com.google.common.collect.ForwardingObject
public Queue<E> delegate() {
return this.delegate;
}
}

View File

@@ -0,0 +1,59 @@
package com.google.common.collect;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import java.util.Iterator;
/* loaded from: classes.dex */
public abstract class FluentIterable<E> implements Iterable<E> {
private final Optional<Iterable<E>> a;
protected FluentIterable() {
this.a = Optional.absent();
}
public static <T> FluentIterable<T> a(Iterable<? extends T> iterable, Iterable<? extends T> iterable2) {
return a(ImmutableList.of(iterable, iterable2));
}
private Iterable<E> b() {
return this.a.or((Optional<Iterable<E>>) this);
}
public String toString() {
return Iterables.f(b());
}
public static <T> FluentIterable<T> a(final Iterable<? extends Iterable<? extends T>> iterable) {
Preconditions.a(iterable);
return new FluentIterable<T>() { // from class: com.google.common.collect.FluentIterable.2
@Override // java.lang.Iterable
public Iterator<T> iterator() {
return Iterators.c(Iterables.a(iterable, Iterables.a()).iterator());
}
};
}
public static <E> FluentIterable<E> b(final Iterable<E> iterable) {
return iterable instanceof FluentIterable ? (FluentIterable) iterable : new FluentIterable<E>(iterable) { // from class: com.google.common.collect.FluentIterable.1
@Override // java.lang.Iterable
public Iterator<E> iterator() {
return iterable.iterator();
}
};
}
FluentIterable(Iterable<E> iterable) {
Preconditions.a(iterable);
this.a = Optional.fromNullable(this == iterable ? null : iterable);
}
public final FluentIterable<E> a(Predicate<? super E> predicate) {
return b(Iterables.b(b(), predicate));
}
public final ImmutableSet<E> a() {
return ImmutableSet.copyOf(b());
}
}

View File

@@ -0,0 +1,122 @@
package com.google.common.collect;
import com.google.common.base.Objects;
import java.util.Collection;
import java.util.Iterator;
/* loaded from: classes.dex */
public abstract class ForwardingCollection<E> extends ForwardingObject implements Collection<E> {
protected ForwardingCollection() {
}
public boolean add(E e) {
return delegate().add(e);
}
public boolean addAll(Collection<? extends E> collection) {
return delegate().addAll(collection);
}
public void clear() {
delegate().clear();
}
public boolean contains(Object obj) {
return delegate().contains(obj);
}
public boolean containsAll(Collection<?> collection) {
return delegate().containsAll(collection);
}
@Override // com.google.common.collect.ForwardingObject
protected abstract /* bridge */ /* synthetic */ Object delegate();
@Override // com.google.common.collect.ForwardingObject
protected abstract Collection<E> delegate();
@Override // java.util.Collection
public boolean isEmpty() {
return delegate().isEmpty();
}
public Iterator<E> iterator() {
return delegate().iterator();
}
public boolean remove(Object obj) {
return delegate().remove(obj);
}
public boolean removeAll(Collection<?> collection) {
return delegate().removeAll(collection);
}
public boolean retainAll(Collection<?> collection) {
return delegate().retainAll(collection);
}
@Override // java.util.Collection
public int size() {
return delegate().size();
}
protected boolean standardAddAll(Collection<? extends E> collection) {
return Iterators.a(this, collection.iterator());
}
protected void standardClear() {
Iterators.b(iterator());
}
protected boolean standardContains(Object obj) {
return Iterators.a((Iterator<?>) iterator(), obj);
}
protected boolean standardContainsAll(Collection<?> collection) {
return Collections2.a((Collection<?>) this, collection);
}
protected boolean standardIsEmpty() {
return !iterator().hasNext();
}
protected boolean standardRemove(Object obj) {
Iterator<E> it = iterator();
while (it.hasNext()) {
if (Objects.a(it.next(), obj)) {
it.remove();
return true;
}
}
return false;
}
protected boolean standardRemoveAll(Collection<?> collection) {
return Iterators.a((Iterator<?>) iterator(), collection);
}
protected boolean standardRetainAll(Collection<?> collection) {
return Iterators.b((Iterator<?>) iterator(), collection);
}
protected Object[] standardToArray() {
return toArray(new Object[size()]);
}
protected String standardToString() {
return Collections2.a((Collection<?>) this);
}
public Object[] toArray() {
return delegate().toArray();
}
public <T> T[] toArray(T[] tArr) {
return (T[]) delegate().toArray(tArr);
}
protected <T> T[] standardToArray(T[] tArr) {
return (T[]) ObjectArrays.a((Collection<?>) this, (Object[]) tArr);
}
}

View File

@@ -0,0 +1,32 @@
package com.google.common.collect;
import java.util.concurrent.ConcurrentMap;
/* loaded from: classes.dex */
public abstract class ForwardingConcurrentMap<K, V> extends ForwardingMap<K, V> implements ConcurrentMap<K, V> {
protected ForwardingConcurrentMap() {
}
@Override // com.google.common.collect.ForwardingMap, com.google.common.collect.ForwardingObject
protected abstract ConcurrentMap<K, V> delegate();
@Override // java.util.Map, java.util.concurrent.ConcurrentMap
public V putIfAbsent(K k, V v) {
return delegate().putIfAbsent(k, v);
}
@Override // java.util.Map, java.util.concurrent.ConcurrentMap
public boolean remove(Object obj, Object obj2) {
return delegate().remove(obj, obj2);
}
@Override // java.util.Map, java.util.concurrent.ConcurrentMap
public V replace(K k, V v) {
return delegate().replace(k, v);
}
@Override // java.util.Map, java.util.concurrent.ConcurrentMap
public boolean replace(K k, V v, V v2) {
return delegate().replace(k, v, v2);
}
}

View File

@@ -0,0 +1,21 @@
package com.google.common.collect;
import java.util.Iterator;
/* loaded from: classes.dex */
public abstract class ForwardingIterator<T> extends ForwardingObject implements Iterator<T> {
protected ForwardingIterator() {
}
@Override // com.google.common.collect.ForwardingObject
protected abstract Iterator<T> delegate();
@Override // java.util.Iterator
public boolean hasNext() {
return delegate().hasNext();
}
public T next() {
return delegate().next();
}
}

View File

@@ -0,0 +1,126 @@
package com.google.common.collect;
import com.google.common.base.Objects;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
public abstract class ForwardingMap<K, V> extends ForwardingObject implements Map<K, V> {
protected ForwardingMap() {
}
public void clear() {
delegate().clear();
}
@Override // java.util.Map
public boolean containsKey(Object obj) {
return delegate().containsKey(obj);
}
public boolean containsValue(Object obj) {
return delegate().containsValue(obj);
}
@Override // com.google.common.collect.ForwardingObject
protected abstract /* bridge */ /* synthetic */ Object delegate();
@Override // com.google.common.collect.ForwardingObject
protected abstract Map<K, V> delegate();
public Set<Map.Entry<K, V>> entrySet() {
return delegate().entrySet();
}
@Override // java.util.Map
public boolean equals(Object obj) {
return obj == this || delegate().equals(obj);
}
@Override // java.util.Map
public V get(Object obj) {
return delegate().get(obj);
}
@Override // java.util.Map
public int hashCode() {
return delegate().hashCode();
}
@Override // java.util.Map
public boolean isEmpty() {
return delegate().isEmpty();
}
public Set<K> keySet() {
return delegate().keySet();
}
public V put(K k, V v) {
return delegate().put(k, v);
}
public void putAll(Map<? extends K, ? extends V> map) {
delegate().putAll(map);
}
public V remove(Object obj) {
return delegate().remove(obj);
}
@Override // java.util.Map
public int size() {
return delegate().size();
}
protected void standardClear() {
Iterators.b(entrySet().iterator());
}
protected boolean standardContainsKey(Object obj) {
return Maps.a((Map<?, ?>) this, obj);
}
protected boolean standardContainsValue(Object obj) {
return Maps.b(this, obj);
}
protected boolean standardEquals(Object obj) {
return Maps.c(this, obj);
}
protected int standardHashCode() {
return Sets.a(entrySet());
}
protected boolean standardIsEmpty() {
return !entrySet().iterator().hasNext();
}
protected void standardPutAll(Map<? extends K, ? extends V> map) {
Maps.a((Map) this, (Map) map);
}
protected V standardRemove(Object obj) {
Iterator<Map.Entry<K, V>> it = entrySet().iterator();
while (it.hasNext()) {
Map.Entry<K, V> next = it.next();
if (Objects.a(next.getKey(), obj)) {
V value = next.getValue();
it.remove();
return value;
}
}
return null;
}
protected String standardToString() {
return Maps.a(this);
}
public Collection<V> values() {
return delegate().values();
}
}

View File

@@ -0,0 +1,45 @@
package com.google.common.collect;
import com.google.common.base.Objects;
import java.util.Map;
/* loaded from: classes.dex */
public abstract class ForwardingMapEntry<K, V> extends ForwardingObject implements Map.Entry<K, V> {
protected ForwardingMapEntry() {
}
@Override // com.google.common.collect.ForwardingObject
protected abstract Map.Entry<K, V> delegate();
@Override // java.util.Map.Entry
public boolean equals(Object obj) {
return delegate().equals(obj);
}
@Override // java.util.Map.Entry
public K getKey() {
return delegate().getKey();
}
@Override // java.util.Map.Entry
public V getValue() {
return delegate().getValue();
}
@Override // java.util.Map.Entry
public int hashCode() {
return delegate().hashCode();
}
public V setValue(V v) {
return delegate().setValue(v);
}
protected boolean standardEquals(Object obj) {
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
return Objects.a(getKey(), entry.getKey()) && Objects.a(getValue(), entry.getValue());
}
}

View File

@@ -0,0 +1,86 @@
package com.google.common.collect;
import com.google.common.collect.Multiset;
import java.util.Collection;
import java.util.Set;
/* loaded from: classes.dex */
public abstract class ForwardingMultiset<E> extends ForwardingCollection<E> implements Multiset<E> {
protected ForwardingMultiset() {
}
@Override // com.google.common.collect.Multiset
public int add(E e, int i) {
return delegate().add(e, i);
}
@Override // com.google.common.collect.Multiset
public int count(Object obj) {
return delegate().count(obj);
}
@Override // com.google.common.collect.ForwardingCollection, com.google.common.collect.ForwardingObject
protected abstract Multiset<E> delegate();
public abstract Set<Multiset.Entry<E>> entrySet();
@Override // java.util.Collection, com.google.common.collect.Multiset
public boolean equals(Object obj) {
return obj == this || delegate().equals(obj);
}
@Override // java.util.Collection, com.google.common.collect.Multiset
public int hashCode() {
return delegate().hashCode();
}
@Override // com.google.common.collect.Multiset
public int remove(Object obj, int i) {
return delegate().remove(obj, i);
}
@Override // com.google.common.collect.Multiset
public int setCount(E e, int i) {
return delegate().setCount(e, i);
}
@Override // com.google.common.collect.ForwardingCollection
protected boolean standardAddAll(Collection<? extends E> collection) {
return Multisets.a((Multiset) this, (Collection) collection);
}
@Override // com.google.common.collect.ForwardingCollection
protected void standardClear() {
Iterators.b(entrySet().iterator());
}
@Override // com.google.common.collect.ForwardingCollection
protected boolean standardContains(Object obj) {
return count(obj) > 0;
}
@Override // com.google.common.collect.ForwardingCollection
protected boolean standardRemove(Object obj) {
return remove(obj, 1) > 0;
}
@Override // com.google.common.collect.ForwardingCollection
protected boolean standardRemoveAll(Collection<?> collection) {
return Multisets.b(this, collection);
}
@Override // com.google.common.collect.ForwardingCollection
protected boolean standardRetainAll(Collection<?> collection) {
return Multisets.c(this, collection);
}
@Override // com.google.common.collect.ForwardingCollection
protected String standardToString() {
return entrySet().toString();
}
@Override // com.google.common.collect.Multiset
public boolean setCount(E e, int i, int i2) {
return delegate().setCount(e, i, i2);
}
}

View File

@@ -0,0 +1,13 @@
package com.google.common.collect;
/* loaded from: classes.dex */
public abstract class ForwardingObject {
protected ForwardingObject() {
}
protected abstract Object delegate();
public String toString() {
return delegate().toString();
}
}

View File

@@ -0,0 +1,66 @@
package com.google.common.collect;
import java.util.Collection;
import java.util.NoSuchElementException;
import java.util.Queue;
/* loaded from: classes.dex */
public abstract class ForwardingQueue<E> extends ForwardingCollection<E> implements Queue<E> {
protected ForwardingQueue() {
}
@Override // com.google.common.collect.ForwardingCollection, com.google.common.collect.ForwardingObject
protected abstract /* bridge */ /* synthetic */ Object delegate();
@Override // com.google.common.collect.ForwardingCollection, com.google.common.collect.ForwardingObject
protected abstract /* bridge */ /* synthetic */ Collection delegate();
@Override // com.google.common.collect.ForwardingCollection, com.google.common.collect.ForwardingObject
protected abstract Queue<E> delegate();
@Override // java.util.Queue
public E element() {
return delegate().element();
}
public abstract boolean offer(E e);
@Override // java.util.Queue
public E peek() {
return delegate().peek();
}
@Override // java.util.Queue
public E poll() {
return delegate().poll();
}
@Override // java.util.Queue
public E remove() {
return delegate().remove();
}
protected boolean standardOffer(E e) {
try {
return add(e);
} catch (IllegalStateException unused) {
return false;
}
}
protected E standardPeek() {
try {
return element();
} catch (NoSuchElementException unused) {
return null;
}
}
protected E standardPoll() {
try {
return remove();
} catch (NoSuchElementException unused) {
return null;
}
}
}

View File

@@ -0,0 +1,44 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import java.util.Collection;
import java.util.Set;
/* loaded from: classes.dex */
public abstract class ForwardingSet<E> extends ForwardingCollection<E> implements Set<E> {
protected ForwardingSet() {
}
@Override // com.google.common.collect.ForwardingCollection, com.google.common.collect.ForwardingObject
protected abstract /* bridge */ /* synthetic */ Object delegate();
@Override // com.google.common.collect.ForwardingCollection, com.google.common.collect.ForwardingObject
protected abstract /* bridge */ /* synthetic */ Collection delegate();
@Override // com.google.common.collect.ForwardingCollection, com.google.common.collect.ForwardingObject
protected abstract Set<E> delegate();
@Override // java.util.Collection, java.util.Set
public boolean equals(Object obj) {
return obj == this || delegate().equals(obj);
}
@Override // java.util.Collection, java.util.Set
public int hashCode() {
return delegate().hashCode();
}
protected boolean standardEquals(Object obj) {
return Sets.a(this, obj);
}
protected int standardHashCode() {
return Sets.a(this);
}
@Override // com.google.common.collect.ForwardingCollection
protected boolean standardRemoveAll(Collection<?> collection) {
Preconditions.a(collection);
return Sets.a((Set<?>) this, collection);
}
}

View File

@@ -0,0 +1,74 @@
package com.google.common.collect;
import java.util.Comparator;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.SortedSet;
/* loaded from: classes.dex */
public abstract class ForwardingSortedSet<E> extends ForwardingSet<E> implements SortedSet<E> {
protected ForwardingSortedSet() {
}
private int a(Object obj, Object obj2) {
Comparator<? super E> comparator = comparator();
return comparator == null ? ((Comparable) obj).compareTo(obj2) : comparator.compare(obj, obj2);
}
@Override // java.util.SortedSet
public Comparator<? super E> comparator() {
return delegate().comparator();
}
@Override // com.google.common.collect.ForwardingSet, com.google.common.collect.ForwardingCollection, com.google.common.collect.ForwardingObject
protected abstract SortedSet<E> delegate();
@Override // java.util.SortedSet
public E first() {
return delegate().first();
}
@Override // java.util.SortedSet
public SortedSet<E> headSet(E e) {
return delegate().headSet(e);
}
@Override // java.util.SortedSet
public E last() {
return delegate().last();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ForwardingCollection
protected boolean standardContains(Object obj) {
try {
return a(tailSet(obj).first(), obj) == 0;
} catch (ClassCastException | NullPointerException | NoSuchElementException unused) {
return false;
}
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ForwardingCollection
protected boolean standardRemove(Object obj) {
try {
Iterator<E> it = tailSet(obj).iterator();
if (it.hasNext() && a(it.next(), obj) == 0) {
it.remove();
return true;
}
} catch (ClassCastException | NullPointerException unused) {
}
return false;
}
@Override // java.util.SortedSet
public SortedSet<E> subSet(E e, E e2) {
return delegate().subSet(e, e2);
}
@Override // java.util.SortedSet
public SortedSet<E> tailSet(E e) {
return delegate().tailSet(e);
}
}

View File

@@ -0,0 +1,176 @@
package com.google.common.collect;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import java.io.Serializable;
import java.util.Comparator;
/* loaded from: classes.dex */
final class GeneralRange<T> implements Serializable {
private final Comparator<? super T> a;
private final boolean b;
private final T c;
private final BoundType d;
private final boolean e;
private final T f;
private final BoundType g;
/* JADX WARN: Multi-variable type inference failed */
private GeneralRange(Comparator<? super T> comparator, boolean z, T t, BoundType boundType, boolean z2, T t2, BoundType boundType2) {
Preconditions.a(comparator);
this.a = comparator;
this.b = z;
this.e = z2;
this.c = t;
Preconditions.a(boundType);
this.d = boundType;
this.f = t2;
Preconditions.a(boundType2);
this.g = boundType2;
if (z) {
comparator.compare(t, t);
}
if (z2) {
comparator.compare(t2, t2);
}
if (z && z2) {
int compare = comparator.compare(t, t2);
Preconditions.a(compare <= 0, "lowerEndpoint (%s) > upperEndpoint (%s)", t, t2);
if (compare == 0) {
Preconditions.a((boundType != BoundType.OPEN) | (boundType2 != BoundType.OPEN));
}
}
}
static <T> GeneralRange<T> a(Comparator<? super T> comparator) {
BoundType boundType = BoundType.OPEN;
return new GeneralRange<>(comparator, false, null, boundType, false, null, boundType);
}
static <T> GeneralRange<T> b(Comparator<? super T> comparator, T t, BoundType boundType) {
return new GeneralRange<>(comparator, false, null, BoundType.OPEN, true, t, boundType);
}
boolean c(T t) {
if (!f()) {
return false;
}
int compare = this.a.compare(t, c());
return ((compare == 0) & (b() == BoundType.OPEN)) | (compare < 0);
}
BoundType d() {
return this.g;
}
T e() {
return this.f;
}
public boolean equals(Object obj) {
if (!(obj instanceof GeneralRange)) {
return false;
}
GeneralRange generalRange = (GeneralRange) obj;
return this.a.equals(generalRange.a) && this.b == generalRange.b && this.e == generalRange.e && b().equals(generalRange.b()) && d().equals(generalRange.d()) && Objects.a(c(), generalRange.c()) && Objects.a(e(), generalRange.e());
}
boolean f() {
return this.b;
}
boolean g() {
return this.e;
}
public int hashCode() {
return Objects.a(this.a, c(), b(), e(), d());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(this.a);
sb.append(":");
sb.append(this.d == BoundType.CLOSED ? '[' : '(');
sb.append(this.b ? this.c : "-∞");
sb.append(',');
sb.append(this.e ? this.f : "");
sb.append(this.g == BoundType.CLOSED ? ']' : ')');
return sb.toString();
}
static <T> GeneralRange<T> a(Comparator<? super T> comparator, T t, BoundType boundType) {
return new GeneralRange<>(comparator, true, t, boundType, false, null, BoundType.OPEN);
}
boolean b(T t) {
if (!g()) {
return false;
}
int compare = this.a.compare(t, e());
return ((compare == 0) & (d() == BoundType.OPEN)) | (compare > 0);
}
Comparator<? super T> a() {
return this.a;
}
boolean a(T t) {
return (c(t) || b(t)) ? false : true;
}
GeneralRange<T> a(GeneralRange<T> generalRange) {
int compare;
int compare2;
BoundType boundType;
BoundType boundType2;
T t;
int compare3;
BoundType boundType3;
Preconditions.a(generalRange);
Preconditions.a(this.a.equals(generalRange.a));
boolean z = this.b;
T c = c();
BoundType b = b();
if (!f()) {
z = generalRange.b;
c = generalRange.c();
b = generalRange.b();
} else if (generalRange.f() && ((compare = this.a.compare(c(), generalRange.c())) < 0 || (compare == 0 && generalRange.b() == BoundType.OPEN))) {
c = generalRange.c();
b = generalRange.b();
}
boolean z2 = z;
boolean z3 = this.e;
T e = e();
BoundType d = d();
if (!g()) {
z3 = generalRange.e;
e = generalRange.e();
d = generalRange.d();
} else if (generalRange.g() && ((compare2 = this.a.compare(e(), generalRange.e())) > 0 || (compare2 == 0 && generalRange.d() == BoundType.OPEN))) {
e = generalRange.e();
d = generalRange.d();
}
boolean z4 = z3;
T t2 = e;
if (z2 && z4 && ((compare3 = this.a.compare(c, t2)) > 0 || (compare3 == 0 && b == (boundType3 = BoundType.OPEN) && d == boundType3))) {
boundType = BoundType.OPEN;
boundType2 = BoundType.CLOSED;
t = t2;
} else {
boundType = b;
boundType2 = d;
t = c;
}
return new GeneralRange<>(this.a, z2, t, boundType, z4, t2, boundType2);
}
T c() {
return this.c;
}
BoundType b() {
return this.d;
}
}

View File

@@ -0,0 +1,158 @@
package com.google.common.collect;
import com.google.common.base.Supplier;
import java.io.Serializable;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
public class HashBasedTable<R, C, V> extends StandardTable<R, C, V> {
private static final long serialVersionUID = 0;
private static class Factory<C, V> implements Supplier<Map<C, V>>, Serializable {
final int a;
Factory(int i) {
this.a = i;
}
@Override // com.google.common.base.Supplier
public Map<C, V> get() {
return Maps.c(this.a);
}
}
HashBasedTable(Map<R, Map<C, V>> map, Factory<C, V> factory) {
super(map, factory);
}
public static <R, C, V> HashBasedTable<R, C, V> create() {
return new HashBasedTable<>(new LinkedHashMap(), new Factory(0));
}
@Override // com.google.common.collect.StandardTable, com.google.common.collect.AbstractTable, com.google.common.collect.Table
public /* bridge */ /* synthetic */ Set cellSet() {
return super.cellSet();
}
@Override // com.google.common.collect.StandardTable, com.google.common.collect.AbstractTable
public /* bridge */ /* synthetic */ void clear() {
super.clear();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.StandardTable
public /* bridge */ /* synthetic */ Map column(Object obj) {
return super.column(obj);
}
@Override // com.google.common.collect.StandardTable, com.google.common.collect.AbstractTable, com.google.common.collect.Table
public /* bridge */ /* synthetic */ Set columnKeySet() {
return super.columnKeySet();
}
@Override // com.google.common.collect.StandardTable, com.google.common.collect.Table
public /* bridge */ /* synthetic */ Map columnMap() {
return super.columnMap();
}
@Override // com.google.common.collect.StandardTable, com.google.common.collect.AbstractTable
public boolean contains(Object obj, Object obj2) {
return super.contains(obj, obj2);
}
@Override // com.google.common.collect.StandardTable, com.google.common.collect.AbstractTable
public boolean containsColumn(Object obj) {
return super.containsColumn(obj);
}
@Override // com.google.common.collect.StandardTable, com.google.common.collect.AbstractTable
public boolean containsRow(Object obj) {
return super.containsRow(obj);
}
@Override // com.google.common.collect.StandardTable, com.google.common.collect.AbstractTable
public boolean containsValue(Object obj) {
return super.containsValue(obj);
}
@Override // com.google.common.collect.AbstractTable
public boolean equals(Object obj) {
return super.equals(obj);
}
@Override // com.google.common.collect.StandardTable, com.google.common.collect.AbstractTable
public V get(Object obj, Object obj2) {
return (V) super.get(obj, obj2);
}
@Override // com.google.common.collect.AbstractTable
public /* bridge */ /* synthetic */ int hashCode() {
return super.hashCode();
}
@Override // com.google.common.collect.StandardTable, com.google.common.collect.AbstractTable
public /* bridge */ /* synthetic */ boolean isEmpty() {
return super.isEmpty();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.StandardTable, com.google.common.collect.AbstractTable
public /* bridge */ /* synthetic */ Object put(Object obj, Object obj2, Object obj3) {
return super.put(obj, obj2, obj3);
}
@Override // com.google.common.collect.AbstractTable
public /* bridge */ /* synthetic */ void putAll(Table table) {
super.putAll(table);
}
@Override // com.google.common.collect.StandardTable, com.google.common.collect.AbstractTable
public V remove(Object obj, Object obj2) {
return (V) super.remove(obj, obj2);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.StandardTable
public /* bridge */ /* synthetic */ Map row(Object obj) {
return super.row(obj);
}
@Override // com.google.common.collect.StandardTable, com.google.common.collect.AbstractTable, com.google.common.collect.Table
public /* bridge */ /* synthetic */ Set rowKeySet() {
return super.rowKeySet();
}
@Override // com.google.common.collect.StandardTable, com.google.common.collect.Table
public /* bridge */ /* synthetic */ Map rowMap() {
return super.rowMap();
}
@Override // com.google.common.collect.StandardTable, com.google.common.collect.Table
public /* bridge */ /* synthetic */ int size() {
return super.size();
}
@Override // com.google.common.collect.AbstractTable
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
@Override // com.google.common.collect.StandardTable, com.google.common.collect.AbstractTable
public /* bridge */ /* synthetic */ Collection values() {
return super.values();
}
public static <R, C, V> HashBasedTable<R, C, V> create(int i, int i2) {
CollectPreconditions.a(i2, "expectedCellsPerRow");
return new HashBasedTable<>(Maps.c(i), new Factory(i2));
}
public static <R, C, V> HashBasedTable<R, C, V> create(Table<? extends R, ? extends C, ? extends V> table) {
HashBasedTable<R, C, V> create = create();
create.putAll(table);
return create;
}
}

View File

@@ -0,0 +1,653 @@
package com.google.common.collect;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.AbstractMap;
import java.util.Arrays;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
/* loaded from: classes.dex */
public final class HashBiMap<K, V> extends Maps.IteratorBasedAbstractMap<K, V> implements BiMap<K, V>, Serializable {
private static final double LOAD_FACTOR = 1.0d;
private static final long serialVersionUID = 0;
private transient BiEntry<K, V> firstInKeyInsertionOrder;
private transient BiEntry<K, V>[] hashTableKToV;
private transient BiEntry<K, V>[] hashTableVToK;
private transient BiMap<V, K> inverse;
private transient BiEntry<K, V> lastInKeyInsertionOrder;
private transient int mask;
private transient int modCount;
private transient int size;
private static final class BiEntry<K, V> extends ImmutableEntry<K, V> {
final int c;
final int d;
BiEntry<K, V> e;
BiEntry<K, V> f;
BiEntry<K, V> g;
BiEntry<K, V> h;
BiEntry(K k, int i, V v, int i2) {
super(k, v);
this.c = i;
this.d = i2;
}
}
private final class Inverse extends AbstractMap<V, K> implements BiMap<V, K>, Serializable {
/* renamed from: com.google.common.collect.HashBiMap$Inverse$1, reason: invalid class name */
class AnonymousClass1 extends Maps.EntrySet<V, K> {
AnonymousClass1() {
}
@Override // com.google.common.collect.Maps.EntrySet
Map<V, K> c() {
return Inverse.this;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<Map.Entry<V, K>> iterator() {
return new HashBiMap<K, V>.Itr<Map.Entry<V, K>>() { // from class: com.google.common.collect.HashBiMap.Inverse.1.1
/* renamed from: com.google.common.collect.HashBiMap$Inverse$1$1$InverseEntry */
class InverseEntry extends AbstractMapEntry<V, K> {
BiEntry<K, V> a;
InverseEntry(BiEntry<K, V> biEntry) {
this.a = biEntry;
}
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public V getKey() {
return this.a.b;
}
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public K getValue() {
return this.a.a;
}
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public K setValue(K k) {
K k2 = this.a.a;
int a = Hashing.a(k);
if (a == this.a.c && Objects.a(k, k2)) {
return k;
}
Preconditions.a(HashBiMap.this.seekByKey(k, a) == null, "value already present: %s", k);
HashBiMap.this.delete(this.a);
BiEntry<K, V> biEntry = this.a;
BiEntry<K, V> biEntry2 = new BiEntry<>(k, a, biEntry.b, biEntry.d);
this.a = biEntry2;
HashBiMap.this.insert(biEntry2, null);
C00071 c00071 = C00071.this;
c00071.c = HashBiMap.this.modCount;
return k2;
}
}
{
HashBiMap hashBiMap = HashBiMap.this;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.HashBiMap.Itr
public Map.Entry<V, K> a(BiEntry<K, V> biEntry) {
return new InverseEntry(biEntry);
}
};
}
}
private final class InverseKeySet extends Maps.KeySet<V, K> {
InverseKeySet() {
super(Inverse.this);
}
@Override // com.google.common.collect.Maps.KeySet, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<V> iterator() {
return new HashBiMap<K, V>.Itr<V>(this) { // from class: com.google.common.collect.HashBiMap.Inverse.InverseKeySet.1
{
HashBiMap hashBiMap = HashBiMap.this;
}
@Override // com.google.common.collect.HashBiMap.Itr
V a(BiEntry<K, V> biEntry) {
return biEntry.b;
}
};
}
@Override // com.google.common.collect.Maps.KeySet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
BiEntry seekByValue = HashBiMap.this.seekByValue(obj, Hashing.a(obj));
if (seekByValue == null) {
return false;
}
HashBiMap.this.delete(seekByValue);
return true;
}
}
private Inverse() {
}
BiMap<K, V> a() {
return HashBiMap.this;
}
@Override // java.util.AbstractMap, java.util.Map
public void clear() {
a().clear();
}
@Override // java.util.AbstractMap, java.util.Map
public boolean containsKey(Object obj) {
return a().containsValue(obj);
}
@Override // java.util.AbstractMap, java.util.Map
public Set<Map.Entry<V, K>> entrySet() {
return new AnonymousClass1();
}
@Override // java.util.AbstractMap, java.util.Map
public K get(Object obj) {
return (K) Maps.a(HashBiMap.this.seekByValue(obj, Hashing.a(obj)));
}
@Override // com.google.common.collect.BiMap
public BiMap<K, V> inverse() {
return a();
}
@Override // java.util.AbstractMap, java.util.Map
public Set<V> keySet() {
return new InverseKeySet();
}
@Override // java.util.AbstractMap, java.util.Map
public K put(V v, K k) {
return (K) HashBiMap.this.putInverse(v, k, false);
}
@Override // java.util.AbstractMap, java.util.Map
public K remove(Object obj) {
BiEntry seekByValue = HashBiMap.this.seekByValue(obj, Hashing.a(obj));
if (seekByValue == null) {
return null;
}
HashBiMap.this.delete(seekByValue);
seekByValue.h = null;
seekByValue.g = null;
return seekByValue.a;
}
@Override // java.util.AbstractMap, java.util.Map
public int size() {
return HashBiMap.this.size;
}
Object writeReplace() {
return new InverseSerializedForm(HashBiMap.this);
}
@Override // java.util.AbstractMap, java.util.Map
public Set<K> values() {
return a().keySet();
}
}
private static final class InverseSerializedForm<K, V> implements Serializable {
private final HashBiMap<K, V> a;
InverseSerializedForm(HashBiMap<K, V> hashBiMap) {
this.a = hashBiMap;
}
Object readResolve() {
return this.a.inverse();
}
}
abstract class Itr<T> implements Iterator<T> {
BiEntry<K, V> a;
BiEntry<K, V> b = null;
int c;
Itr() {
this.a = HashBiMap.this.firstInKeyInsertionOrder;
this.c = HashBiMap.this.modCount;
}
abstract T a(BiEntry<K, V> biEntry);
@Override // java.util.Iterator
public boolean hasNext() {
if (HashBiMap.this.modCount == this.c) {
return this.a != null;
}
throw new ConcurrentModificationException();
}
@Override // java.util.Iterator
public T next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
BiEntry<K, V> biEntry = this.a;
this.a = biEntry.g;
this.b = biEntry;
return a(biEntry);
}
@Override // java.util.Iterator
public void remove() {
if (HashBiMap.this.modCount != this.c) {
throw new ConcurrentModificationException();
}
CollectPreconditions.a(this.b != null);
HashBiMap.this.delete(this.b);
this.c = HashBiMap.this.modCount;
this.b = null;
}
}
private final class KeySet extends Maps.KeySet<K, V> {
KeySet() {
super(HashBiMap.this);
}
@Override // com.google.common.collect.Maps.KeySet, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<K> iterator() {
return new HashBiMap<K, V>.Itr<K>(this) { // from class: com.google.common.collect.HashBiMap.KeySet.1
{
HashBiMap hashBiMap = HashBiMap.this;
}
@Override // com.google.common.collect.HashBiMap.Itr
K a(BiEntry<K, V> biEntry) {
return biEntry.a;
}
};
}
@Override // com.google.common.collect.Maps.KeySet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
BiEntry seekByKey = HashBiMap.this.seekByKey(obj, Hashing.a(obj));
if (seekByKey == null) {
return false;
}
HashBiMap.this.delete(seekByKey);
seekByKey.h = null;
seekByKey.g = null;
return true;
}
}
private HashBiMap(int i) {
init(i);
}
public static <K, V> HashBiMap<K, V> create() {
return create(16);
}
private BiEntry<K, V>[] createTable(int i) {
return new BiEntry[i];
}
/* JADX INFO: Access modifiers changed from: private */
public void delete(BiEntry<K, V> biEntry) {
BiEntry<K, V> biEntry2;
int i = biEntry.c & this.mask;
BiEntry<K, V> biEntry3 = null;
BiEntry<K, V> biEntry4 = null;
for (BiEntry<K, V> biEntry5 = this.hashTableKToV[i]; biEntry5 != biEntry; biEntry5 = biEntry5.e) {
biEntry4 = biEntry5;
}
if (biEntry4 == null) {
this.hashTableKToV[i] = biEntry.e;
} else {
biEntry4.e = biEntry.e;
}
int i2 = biEntry.d & this.mask;
BiEntry<K, V> biEntry6 = this.hashTableVToK[i2];
while (true) {
biEntry2 = biEntry3;
biEntry3 = biEntry6;
if (biEntry3 == biEntry) {
break;
} else {
biEntry6 = biEntry3.f;
}
}
if (biEntry2 == null) {
this.hashTableVToK[i2] = biEntry.f;
} else {
biEntry2.f = biEntry.f;
}
BiEntry<K, V> biEntry7 = biEntry.h;
if (biEntry7 == null) {
this.firstInKeyInsertionOrder = biEntry.g;
} else {
biEntry7.g = biEntry.g;
}
BiEntry<K, V> biEntry8 = biEntry.g;
if (biEntry8 == null) {
this.lastInKeyInsertionOrder = biEntry.h;
} else {
biEntry8.h = biEntry.h;
}
this.size--;
this.modCount++;
}
private void init(int i) {
CollectPreconditions.a(i, "expectedSize");
int a = Hashing.a(i, LOAD_FACTOR);
this.hashTableKToV = createTable(a);
this.hashTableVToK = createTable(a);
this.firstInKeyInsertionOrder = null;
this.lastInKeyInsertionOrder = null;
this.size = 0;
this.mask = a - 1;
this.modCount = 0;
}
/* JADX INFO: Access modifiers changed from: private */
public void insert(BiEntry<K, V> biEntry, BiEntry<K, V> biEntry2) {
int i = biEntry.c;
int i2 = this.mask;
int i3 = i & i2;
BiEntry<K, V>[] biEntryArr = this.hashTableKToV;
biEntry.e = biEntryArr[i3];
biEntryArr[i3] = biEntry;
int i4 = biEntry.d & i2;
BiEntry<K, V>[] biEntryArr2 = this.hashTableVToK;
biEntry.f = biEntryArr2[i4];
biEntryArr2[i4] = biEntry;
if (biEntry2 == null) {
BiEntry<K, V> biEntry3 = this.lastInKeyInsertionOrder;
biEntry.h = biEntry3;
biEntry.g = null;
if (biEntry3 == null) {
this.firstInKeyInsertionOrder = biEntry;
} else {
biEntry3.g = biEntry;
}
this.lastInKeyInsertionOrder = biEntry;
} else {
biEntry.h = biEntry2.h;
BiEntry<K, V> biEntry4 = biEntry.h;
if (biEntry4 == null) {
this.firstInKeyInsertionOrder = biEntry;
} else {
biEntry4.g = biEntry;
}
biEntry.g = biEntry2.g;
BiEntry<K, V> biEntry5 = biEntry.g;
if (biEntry5 == null) {
this.lastInKeyInsertionOrder = biEntry;
} else {
biEntry5.h = biEntry;
}
}
this.size++;
this.modCount++;
}
/* JADX INFO: Access modifiers changed from: private */
public K putInverse(V v, K k, boolean z) {
int a = Hashing.a(v);
int a2 = Hashing.a(k);
BiEntry<K, V> seekByValue = seekByValue(v, a);
if (seekByValue != null && a2 == seekByValue.c && Objects.a(k, seekByValue.a)) {
return k;
}
BiEntry<K, V> seekByKey = seekByKey(k, a2);
if (seekByKey != null) {
if (!z) {
throw new IllegalArgumentException("value already present: " + k);
}
delete(seekByKey);
}
if (seekByValue != null) {
delete(seekByValue);
}
insert(new BiEntry<>(k, a2, v, a), seekByKey);
if (seekByKey != null) {
seekByKey.h = null;
seekByKey.g = null;
}
rehashIfNecessary();
return (K) Maps.a(seekByValue);
}
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
objectInputStream.defaultReadObject();
init(16);
Serialization.a(this, objectInputStream, Serialization.a(objectInputStream));
}
private void rehashIfNecessary() {
BiEntry<K, V>[] biEntryArr = this.hashTableKToV;
if (Hashing.a(this.size, biEntryArr.length, LOAD_FACTOR)) {
int length = biEntryArr.length * 2;
this.hashTableKToV = createTable(length);
this.hashTableVToK = createTable(length);
this.mask = length - 1;
this.size = 0;
for (BiEntry<K, V> biEntry = this.firstInKeyInsertionOrder; biEntry != null; biEntry = biEntry.g) {
insert(biEntry, biEntry);
}
this.modCount++;
}
}
/* JADX INFO: Access modifiers changed from: private */
public BiEntry<K, V> seekByKey(Object obj, int i) {
for (BiEntry<K, V> biEntry = this.hashTableKToV[this.mask & i]; biEntry != null; biEntry = biEntry.e) {
if (i == biEntry.c && Objects.a(obj, biEntry.a)) {
return biEntry;
}
}
return null;
}
/* JADX INFO: Access modifiers changed from: private */
public BiEntry<K, V> seekByValue(Object obj, int i) {
for (BiEntry<K, V> biEntry = this.hashTableVToK[this.mask & i]; biEntry != null; biEntry = biEntry.f) {
if (i == biEntry.d && Objects.a(obj, biEntry.b)) {
return biEntry;
}
}
return null;
}
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
objectOutputStream.defaultWriteObject();
Serialization.a(this, objectOutputStream);
}
@Override // com.google.common.collect.Maps.IteratorBasedAbstractMap, java.util.AbstractMap, java.util.Map
public void clear() {
this.size = 0;
Arrays.fill(this.hashTableKToV, (Object) null);
Arrays.fill(this.hashTableVToK, (Object) null);
this.firstInKeyInsertionOrder = null;
this.lastInKeyInsertionOrder = null;
this.modCount++;
}
@Override // java.util.AbstractMap, java.util.Map
public boolean containsKey(Object obj) {
return seekByKey(obj, Hashing.a(obj)) != null;
}
@Override // java.util.AbstractMap, java.util.Map
public boolean containsValue(Object obj) {
return seekByValue(obj, Hashing.a(obj)) != null;
}
@Override // com.google.common.collect.Maps.IteratorBasedAbstractMap
Iterator<Map.Entry<K, V>> entryIterator() {
return new HashBiMap<K, V>.Itr<Map.Entry<K, V>>() { // from class: com.google.common.collect.HashBiMap.1
/* renamed from: com.google.common.collect.HashBiMap$1$MapEntry */
class MapEntry extends AbstractMapEntry<K, V> {
BiEntry<K, V> a;
MapEntry(BiEntry<K, V> biEntry) {
this.a = biEntry;
}
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public K getKey() {
return this.a.a;
}
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public V getValue() {
return this.a.b;
}
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public V setValue(V v) {
V v2 = this.a.b;
int a = Hashing.a(v);
if (a == this.a.d && Objects.a(v, v2)) {
return v;
}
Preconditions.a(HashBiMap.this.seekByValue(v, a) == null, "value already present: %s", v);
HashBiMap.this.delete(this.a);
BiEntry<K, V> biEntry = this.a;
BiEntry<K, V> biEntry2 = new BiEntry<>(biEntry.a, biEntry.c, v, a);
HashBiMap.this.insert(biEntry2, this.a);
BiEntry<K, V> biEntry3 = this.a;
biEntry3.h = null;
biEntry3.g = null;
AnonymousClass1 anonymousClass1 = AnonymousClass1.this;
anonymousClass1.c = HashBiMap.this.modCount;
AnonymousClass1 anonymousClass12 = AnonymousClass1.this;
if (anonymousClass12.b == this.a) {
anonymousClass12.b = biEntry2;
}
this.a = biEntry2;
return v2;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.HashBiMap.Itr
public Map.Entry<K, V> a(BiEntry<K, V> biEntry) {
return new MapEntry(biEntry);
}
};
}
@Override // com.google.common.collect.Maps.IteratorBasedAbstractMap, java.util.AbstractMap, java.util.Map
public /* bridge */ /* synthetic */ Set entrySet() {
return super.entrySet();
}
public V forcePut(K k, V v) {
return put(k, v, true);
}
@Override // java.util.AbstractMap, java.util.Map
public V get(Object obj) {
return (V) Maps.c(seekByKey(obj, Hashing.a(obj)));
}
@Override // com.google.common.collect.BiMap
public BiMap<V, K> inverse() {
BiMap<V, K> biMap = this.inverse;
if (biMap != null) {
return biMap;
}
Inverse inverse = new Inverse();
this.inverse = inverse;
return inverse;
}
@Override // java.util.AbstractMap, java.util.Map
public Set<K> keySet() {
return new KeySet();
}
@Override // java.util.AbstractMap, java.util.Map
public V put(K k, V v) {
return put(k, v, false);
}
@Override // java.util.AbstractMap, java.util.Map
public V remove(Object obj) {
BiEntry<K, V> seekByKey = seekByKey(obj, Hashing.a(obj));
if (seekByKey == null) {
return null;
}
delete(seekByKey);
seekByKey.h = null;
seekByKey.g = null;
return seekByKey.b;
}
@Override // com.google.common.collect.Maps.IteratorBasedAbstractMap, java.util.AbstractMap, java.util.Map
public int size() {
return this.size;
}
public static <K, V> HashBiMap<K, V> create(int i) {
return new HashBiMap<>(i);
}
private V put(K k, V v, boolean z) {
int a = Hashing.a(k);
int a2 = Hashing.a(v);
BiEntry<K, V> seekByKey = seekByKey(k, a);
if (seekByKey != null && a2 == seekByKey.d && Objects.a(v, seekByKey.b)) {
return v;
}
BiEntry<K, V> seekByValue = seekByValue(v, a2);
if (seekByValue != null) {
if (!z) {
throw new IllegalArgumentException("value already present: " + v);
}
delete(seekByValue);
}
BiEntry<K, V> biEntry = new BiEntry<>(k, a, v, a2);
if (seekByKey == null) {
insert(biEntry, null);
rehashIfNecessary();
return null;
}
delete(seekByKey);
insert(biEntry, seekByKey);
seekByKey.h = null;
seekByKey.g = null;
rehashIfNecessary();
return seekByKey.b;
}
@Override // java.util.AbstractMap, java.util.Map
public Set<V> values() {
return inverse().keySet();
}
public static <K, V> HashBiMap<K, V> create(Map<? extends K, ? extends V> map) {
HashBiMap<K, V> create = create(map.size());
create.putAll(map);
return create;
}
}

View File

@@ -0,0 +1,175 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
public final class HashMultimap<K, V> extends HashMultimapGwtSerializationDependencies<K, V> {
private static final int DEFAULT_VALUES_PER_KEY = 2;
private static final long serialVersionUID = 0;
transient int expectedValuesPerKey;
private HashMultimap() {
super(new HashMap());
this.expectedValuesPerKey = 2;
}
public static <K, V> HashMultimap<K, V> create() {
return new HashMultimap<>();
}
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
objectInputStream.defaultReadObject();
this.expectedValuesPerKey = 2;
int a = Serialization.a(objectInputStream);
setMap(Maps.b());
Serialization.a(this, objectInputStream, a);
}
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
objectOutputStream.defaultWriteObject();
Serialization.a(this, objectOutputStream);
}
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Map asMap() {
return super.asMap();
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ void clear() {
super.clear();
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean containsEntry(Object obj, Object obj2) {
return super.containsEntry(obj, obj2);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean containsKey(Object obj) {
return super.containsKey(obj);
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ boolean containsValue(Object obj) {
return super.containsValue(obj);
}
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Set entries() {
return super.entries();
}
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ boolean equals(Object obj) {
return super.equals(obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Set get(Object obj) {
return super.get((HashMultimap<K, V>) obj);
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ int hashCode() {
return super.hashCode();
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean isEmpty() {
return super.isEmpty();
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Set keySet() {
return super.keySet();
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ Multiset keys() {
return super.keys();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean put(Object obj, Object obj2) {
return super.put(obj, obj2);
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ boolean putAll(Multimap multimap) {
return super.putAll(multimap);
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean remove(Object obj, Object obj2) {
return super.remove(obj, obj2);
}
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Set removeAll(Object obj) {
return super.removeAll(obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ Set replaceValues(Object obj, Iterable iterable) {
return super.replaceValues((HashMultimap<K, V>) obj, iterable);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ int size() {
return super.size();
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ Collection values() {
return super.values();
}
public static <K, V> HashMultimap<K, V> create(int i, int i2) {
return new HashMultimap<>(i, i2);
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap
public Set<V> createCollection() {
return Sets.a(this.expectedValuesPerKey);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean putAll(Object obj, Iterable iterable) {
return super.putAll(obj, iterable);
}
private HashMultimap(int i, int i2) {
super(Maps.b(i));
this.expectedValuesPerKey = 2;
Preconditions.a(i2 >= 0);
this.expectedValuesPerKey = i2;
}
public static <K, V> HashMultimap<K, V> create(Multimap<? extends K, ? extends V> multimap) {
return new HashMultimap<>(multimap);
}
private HashMultimap(Multimap<? extends K, ? extends V> multimap) {
super(Maps.b(multimap.keySet().size()));
this.expectedValuesPerKey = 2;
putAll(multimap);
}
}

View File

@@ -0,0 +1,11 @@
package com.google.common.collect;
import java.util.Collection;
import java.util.Map;
/* loaded from: classes.dex */
abstract class HashMultimapGwtSerializationDependencies<K, V> extends AbstractSetMultimap<K, V> {
HashMultimapGwtSerializationDependencies(Map<K, Collection<V>> map) {
super(map);
}
}

View File

@@ -0,0 +1,156 @@
package com.google.common.collect;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
/* loaded from: classes.dex */
public final class HashMultiset<E> extends AbstractMapBasedMultiset<E> {
private static final long serialVersionUID = 0;
private HashMultiset() {
super(new ObjectCountHashMap());
}
public static <E> HashMultiset<E> create() {
return new HashMultiset<>();
}
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
objectInputStream.defaultReadObject();
int a = Serialization.a(objectInputStream);
setBackingMap(new ObjectCountHashMap());
Serialization.a(this, objectInputStream, a);
}
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
objectOutputStream.defaultWriteObject();
Serialization.a(this, objectOutputStream);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ int add(Object obj, int i) {
return super.add(obj, i);
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public /* bridge */ /* synthetic */ boolean addAll(Collection collection) {
return super.addAll(collection);
}
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public /* bridge */ /* synthetic */ void clear() {
super.clear();
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ boolean contains(Object obj) {
return super.contains(obj);
}
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ int count(Object obj) {
return super.count(obj);
}
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset
public /* bridge */ /* synthetic */ Set createEntrySet() {
return super.createEntrySet();
}
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ Set elementSet() {
return super.elementSet();
}
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ Set entrySet() {
return super.entrySet();
}
@Override // com.google.common.collect.AbstractMultiset, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ boolean equals(Object obj) {
return super.equals(obj);
}
@Override // com.google.common.collect.AbstractMultiset, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ int hashCode() {
return super.hashCode();
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public /* bridge */ /* synthetic */ boolean isEmpty() {
return super.isEmpty();
}
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public /* bridge */ /* synthetic */ Iterator iterator() {
return super.iterator();
}
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ int remove(Object obj, int i) {
return super.remove(obj, i);
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public /* bridge */ /* synthetic */ boolean removeAll(Collection collection) {
return super.removeAll(collection);
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public /* bridge */ /* synthetic */ boolean retainAll(Collection collection) {
return super.retainAll(collection);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ int setCount(Object obj, int i) {
return super.setCount(obj, i);
}
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ int size() {
return super.size();
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
private HashMultiset(int i) {
super(new ObjectCountHashMap(i));
}
public static <E> HashMultiset<E> create(int i) {
return new HashMultiset<>(i);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ boolean add(Object obj) {
return super.add(obj);
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ boolean remove(Object obj) {
return super.remove(obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ boolean setCount(Object obj, int i, int i2) {
return super.setCount(obj, i, i2);
}
public static <E> HashMultiset<E> create(Iterable<? extends E> iterable) {
HashMultiset<E> create = create(Multisets.b(iterable));
Iterables.a((Collection) create, (Iterable) iterable);
return create;
}
}

View File

@@ -0,0 +1,29 @@
package com.google.common.collect;
/* loaded from: classes.dex */
final class Hashing {
static int a(int i) {
return (int) (Integer.rotateLeft((int) (i * (-862048943)), 15) * 461845907);
}
static boolean a(int i, int i2, double d) {
return ((double) i) > d * ((double) i2) && i2 < 1073741824;
}
static int a(Object obj) {
return a(obj == null ? 0 : obj.hashCode());
}
static int a(int i, double d) {
int max = Math.max(i, 2);
int highestOneBit = Integer.highestOneBit(max);
if (max <= ((int) (d * highestOneBit))) {
return highestOneBit;
}
int i2 = highestOneBit << 1;
if (i2 > 0) {
return i2;
}
return 1073741824;
}
}

View File

@@ -0,0 +1,55 @@
package com.google.common.collect;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.Serializable;
/* loaded from: classes.dex */
abstract class ImmutableAsList<E> extends ImmutableList<E> {
static class SerializedForm implements Serializable {
final ImmutableCollection<?> a;
SerializedForm(ImmutableCollection<?> immutableCollection) {
this.a = immutableCollection;
}
Object readResolve() {
return this.a.asList();
}
}
ImmutableAsList() {
}
private void readObject(ObjectInputStream objectInputStream) throws InvalidObjectException {
throw new InvalidObjectException("Use SerializedForm");
}
abstract ImmutableCollection<E> a();
@Override // com.google.common.collect.ImmutableList, com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return a().contains(obj);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public boolean isEmpty() {
return a().isEmpty();
}
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return a().isPartialView();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public int size() {
return a().size();
}
@Override // com.google.common.collect.ImmutableList, com.google.common.collect.ImmutableCollection
Object writeReplace() {
return new SerializedForm(a());
}
}

View File

@@ -0,0 +1,174 @@
package com.google.common.collect;
import com.google.common.collect.ImmutableMap;
import java.util.Collection;
import java.util.Map;
/* loaded from: classes.dex */
public abstract class ImmutableBiMap<K, V> extends ImmutableMap<K, V> implements BiMap<K, V> {
public static final class Builder<K, V> extends ImmutableMap.Builder<K, V> {
public Builder() {
}
Builder(int i) {
super(i);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMap.Builder
public /* bridge */ /* synthetic */ ImmutableMap.Builder a(Object obj, Object obj2) {
a((Builder<K, V>) obj, obj2);
return this;
}
@Override // com.google.common.collect.ImmutableMap.Builder
public /* bridge */ /* synthetic */ ImmutableMap.Builder a(Map.Entry entry) {
a(entry);
return this;
}
@Override // com.google.common.collect.ImmutableMap.Builder
public /* bridge */ /* synthetic */ ImmutableMap.Builder a(Iterable iterable) {
a(iterable);
return this;
}
@Override // com.google.common.collect.ImmutableMap.Builder
public /* bridge */ /* synthetic */ ImmutableMap.Builder a(Map map) {
a(map);
return this;
}
@Override // com.google.common.collect.ImmutableMap.Builder
public Builder<K, V> a(K k, V v) {
super.a((Builder<K, V>) k, (K) v);
return this;
}
@Override // com.google.common.collect.ImmutableMap.Builder
public Builder<K, V> a(Map.Entry<? extends K, ? extends V> entry) {
super.a((Map.Entry) entry);
return this;
}
@Override // com.google.common.collect.ImmutableMap.Builder
public Builder<K, V> a(Map<? extends K, ? extends V> map) {
super.a((Map) map);
return this;
}
@Override // com.google.common.collect.ImmutableMap.Builder
public Builder<K, V> a(Iterable<? extends Map.Entry<? extends K, ? extends V>> iterable) {
super.a((Iterable) iterable);
return this;
}
@Override // com.google.common.collect.ImmutableMap.Builder
public ImmutableBiMap<K, V> a() {
if (this.c == 0) {
return ImmutableBiMap.of();
}
b();
this.d = true;
return new RegularImmutableBiMap(this.b, this.c);
}
}
private static class SerializedForm extends ImmutableMap.SerializedForm {
SerializedForm(ImmutableBiMap<?, ?> immutableBiMap) {
super(immutableBiMap);
}
@Override // com.google.common.collect.ImmutableMap.SerializedForm
Object readResolve() {
return a(new Builder());
}
}
ImmutableBiMap() {
}
public static <K, V> Builder<K, V> builder() {
return new Builder<>();
}
public static <K, V> ImmutableBiMap<K, V> copyOf(Map<? extends K, ? extends V> map) {
if (map instanceof ImmutableBiMap) {
ImmutableBiMap<K, V> immutableBiMap = (ImmutableBiMap) map;
if (!immutableBiMap.isPartialView()) {
return immutableBiMap;
}
}
return copyOf((Iterable) map.entrySet());
}
public static <K, V> ImmutableBiMap<K, V> of() {
return RegularImmutableBiMap.f;
}
@Deprecated
public V forcePut(K k, V v) {
throw new UnsupportedOperationException();
}
@Override // com.google.common.collect.BiMap
public abstract ImmutableBiMap<V, K> inverse();
@Override // com.google.common.collect.ImmutableMap
Object writeReplace() {
return new SerializedForm(this);
}
public static <K, V> ImmutableBiMap<K, V> of(K k, V v) {
CollectPreconditions.a(k, v);
return new RegularImmutableBiMap(new Object[]{k, v}, 1);
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableMap
public final ImmutableSet<V> createValues() {
throw new AssertionError("should never be called");
}
public static <K, V> ImmutableBiMap<K, V> of(K k, V v, K k2, V v2) {
CollectPreconditions.a(k, v);
CollectPreconditions.a(k2, v2);
return new RegularImmutableBiMap(new Object[]{k, v, k2, v2}, 2);
}
@Override // com.google.common.collect.ImmutableMap, java.util.Map
public ImmutableSet<V> values() {
return inverse().keySet();
}
public static <K, V> ImmutableBiMap<K, V> copyOf(Iterable<? extends Map.Entry<? extends K, ? extends V>> iterable) {
Builder builder = new Builder(iterable instanceof Collection ? ((Collection) iterable).size() : 4);
builder.a((Iterable) iterable);
return builder.a();
}
public static <K, V> ImmutableBiMap<K, V> of(K k, V v, K k2, V v2, K k3, V v3) {
CollectPreconditions.a(k, v);
CollectPreconditions.a(k2, v2);
CollectPreconditions.a(k3, v3);
return new RegularImmutableBiMap(new Object[]{k, v, k2, v2, k3, v3}, 3);
}
public static <K, V> ImmutableBiMap<K, V> of(K k, V v, K k2, V v2, K k3, V v3, K k4, V v4) {
CollectPreconditions.a(k, v);
CollectPreconditions.a(k2, v2);
CollectPreconditions.a(k3, v3);
CollectPreconditions.a(k4, v4);
return new RegularImmutableBiMap(new Object[]{k, v, k2, v2, k3, v3, k4, v4}, 4);
}
public static <K, V> ImmutableBiMap<K, V> of(K k, V v, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
CollectPreconditions.a(k, v);
CollectPreconditions.a(k2, v2);
CollectPreconditions.a(k3, v3);
CollectPreconditions.a(k4, v4);
CollectPreconditions.a(k5, v5);
return new RegularImmutableBiMap(new Object[]{k, v, k2, v2, k3, v3, k4, v4, k5, v5}, 5);
}
}

View File

@@ -0,0 +1,83 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import com.google.common.primitives.Primitives;
import java.io.Serializable;
import java.util.Map;
/* loaded from: classes.dex */
public final class ImmutableClassToInstanceMap<B> extends ForwardingMap<Class<? extends B>, B> implements ClassToInstanceMap<B>, Serializable {
private static final ImmutableClassToInstanceMap<Object> EMPTY = new ImmutableClassToInstanceMap<>(ImmutableMap.of());
private final ImmutableMap<Class<? extends B>, B> delegate;
public static <B> Builder<B> builder() {
return new Builder<>();
}
public static <B, S extends B> ImmutableClassToInstanceMap<B> copyOf(Map<? extends Class<? extends S>, ? extends S> map) {
if (map instanceof ImmutableClassToInstanceMap) {
return (ImmutableClassToInstanceMap) map;
}
Builder builder = new Builder();
builder.a(map);
return builder.a();
}
public static <B> ImmutableClassToInstanceMap<B> of() {
return (ImmutableClassToInstanceMap<B>) EMPTY;
}
public <T extends B> T getInstance(Class<T> cls) {
ImmutableMap<Class<? extends B>, B> immutableMap = this.delegate;
Preconditions.a(cls);
return immutableMap.get(cls);
}
@Deprecated
public <T extends B> T putInstance(Class<T> cls, T t) {
throw new UnsupportedOperationException();
}
Object readResolve() {
return isEmpty() ? of() : this;
}
private ImmutableClassToInstanceMap(ImmutableMap<Class<? extends B>, B> immutableMap) {
this.delegate = immutableMap;
}
public static <B, T extends B> ImmutableClassToInstanceMap<B> of(Class<T> cls, T t) {
return new ImmutableClassToInstanceMap<>(ImmutableMap.of(cls, t));
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.ForwardingMap, com.google.common.collect.ForwardingObject
public Map<Class<? extends B>, B> delegate() {
return this.delegate;
}
public static final class Builder<B> {
private final ImmutableMap.Builder<Class<? extends B>, B> a = ImmutableMap.builder();
public <T extends B> Builder<B> a(Map<? extends Class<? extends T>, ? extends T> map) {
for (Map.Entry<? extends Class<? extends T>, ? extends T> entry : map.entrySet()) {
Class<? extends T> key = entry.getKey();
this.a.a(key, a(key, entry.getValue()));
}
return this;
}
private static <B, T extends B> T a(Class<T> cls, B b) {
return (T) Primitives.b(cls).cast(b);
}
public ImmutableClassToInstanceMap<B> a() {
ImmutableMap<Class<? extends B>, B> a = this.a.a();
if (a.isEmpty()) {
return ImmutableClassToInstanceMap.of();
}
return new ImmutableClassToInstanceMap<>(a);
}
}
}

View File

@@ -0,0 +1,188 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import java.io.Serializable;
import java.util.AbstractCollection;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
/* loaded from: classes.dex */
public abstract class ImmutableCollection<E> extends AbstractCollection<E> implements Serializable {
private static final Object[] EMPTY_ARRAY = new Object[0];
ImmutableCollection() {
}
@Override // java.util.AbstractCollection, java.util.Collection
@Deprecated
public final boolean add(E e) {
throw new UnsupportedOperationException();
}
@Override // java.util.AbstractCollection, java.util.Collection
@Deprecated
public final boolean addAll(Collection<? extends E> collection) {
throw new UnsupportedOperationException();
}
public ImmutableList<E> asList() {
return isEmpty() ? ImmutableList.of() : ImmutableList.asImmutableList(toArray());
}
@Override // java.util.AbstractCollection, java.util.Collection
@Deprecated
public final void clear() {
throw new UnsupportedOperationException();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public abstract boolean contains(Object obj);
int copyIntoArray(Object[] objArr, int i) {
UnmodifiableIterator<E> it = iterator();
while (it.hasNext()) {
objArr[i] = it.next();
i++;
}
return i;
}
abstract boolean isPartialView();
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
public abstract UnmodifiableIterator<E> iterator();
@Override // java.util.AbstractCollection, java.util.Collection
@Deprecated
public final boolean remove(Object obj) {
throw new UnsupportedOperationException();
}
@Override // java.util.AbstractCollection, java.util.Collection
@Deprecated
public final boolean removeAll(Collection<?> collection) {
throw new UnsupportedOperationException();
}
@Override // java.util.AbstractCollection, java.util.Collection
@Deprecated
public final boolean retainAll(Collection<?> collection) {
throw new UnsupportedOperationException();
}
@Override // java.util.AbstractCollection, java.util.Collection
public final Object[] toArray() {
int size = size();
if (size == 0) {
return EMPTY_ARRAY;
}
Object[] objArr = new Object[size];
copyIntoArray(objArr, 0);
return objArr;
}
Object writeReplace() {
return new ImmutableList.SerializedForm(toArray());
}
public static abstract class Builder<E> {
Builder() {
}
static int a(int i, int i2) {
if (i2 < 0) {
throw new AssertionError("cannot store more than MAX_VALUE elements");
}
int i3 = i + (i >> 1) + 1;
if (i3 < i2) {
i3 = Integer.highestOneBit(i2 - 1) << 1;
}
if (i3 < 0) {
return Integer.MAX_VALUE;
}
return i3;
}
public abstract Builder<E> a(E e);
public Builder<E> a(E... eArr) {
for (E e : eArr) {
a((Builder<E>) e);
}
return this;
}
public Builder<E> a(Iterable<? extends E> iterable) {
Iterator<? extends E> it = iterable.iterator();
while (it.hasNext()) {
a((Builder<E>) it.next());
}
return this;
}
public Builder<E> a(Iterator<? extends E> it) {
while (it.hasNext()) {
a((Builder<E>) it.next());
}
return this;
}
}
@Override // java.util.AbstractCollection, java.util.Collection
public final <T> T[] toArray(T[] tArr) {
Preconditions.a(tArr);
int size = size();
if (tArr.length < size) {
tArr = (T[]) ObjectArrays.b(tArr, size);
} else if (tArr.length > size) {
tArr[size] = null;
}
copyIntoArray(tArr, 0);
return tArr;
}
static abstract class ArrayBasedBuilder<E> extends Builder<E> {
Object[] a;
int b;
boolean c;
ArrayBasedBuilder(int i) {
CollectPreconditions.a(i, "initialCapacity");
this.a = new Object[i];
this.b = 0;
}
private void a(int i) {
Object[] objArr = this.a;
if (objArr.length < i) {
this.a = Arrays.copyOf(objArr, Builder.a(objArr.length, i));
this.c = false;
} else if (this.c) {
this.a = (Object[]) objArr.clone();
this.c = false;
}
}
@Override // com.google.common.collect.ImmutableCollection.Builder
public ArrayBasedBuilder<E> a(E e) {
Preconditions.a(e);
a(this.b + 1);
Object[] objArr = this.a;
int i = this.b;
this.b = i + 1;
objArr[i] = e;
return this;
}
@Override // com.google.common.collect.ImmutableCollection.Builder
public Builder<E> a(E... eArr) {
ObjectArrays.a(eArr);
a(this.b + eArr.length);
System.arraycopy(eArr, 0, this.a, this.b, eArr.length);
this.b += eArr.length;
return this;
}
}
}

View File

@@ -0,0 +1,29 @@
package com.google.common.collect;
import java.io.Serializable;
/* loaded from: classes.dex */
class ImmutableEntry<K, V> extends AbstractMapEntry<K, V> implements Serializable {
final K a;
final V b;
ImmutableEntry(K k, V v) {
this.a = k;
this.b = v;
}
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public final K getKey() {
return this.a;
}
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public final V getValue() {
return this.b;
}
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public final V setValue(V v) {
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,448 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableCollection;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.RandomAccess;
/* loaded from: classes.dex */
public abstract class ImmutableList<E> extends ImmutableCollection<E> implements List<E>, RandomAccess {
public static final class Builder<E> extends ImmutableCollection.ArrayBasedBuilder<E> {
public Builder() {
this(4);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableCollection.Builder
public /* bridge */ /* synthetic */ ImmutableCollection.Builder a(Object obj) {
a((Builder<E>) obj);
return this;
}
Builder(int i) {
super(i);
}
@Override // com.google.common.collect.ImmutableCollection.ArrayBasedBuilder, com.google.common.collect.ImmutableCollection.Builder
public Builder<E> a(E e) {
super.a((Builder<E>) e);
return this;
}
@Override // com.google.common.collect.ImmutableCollection.Builder
public Builder<E> a(Iterator<? extends E> it) {
super.a((Iterator) it);
return this;
}
public ImmutableList<E> a() {
this.c = true;
return ImmutableList.asImmutableList(this.a, this.b);
}
}
private static class ReverseImmutableList<E> extends ImmutableList<E> {
private final transient ImmutableList<E> a;
ReverseImmutableList(ImmutableList<E> immutableList) {
this.a = immutableList;
}
private int c(int i) {
return (size() - 1) - i;
}
private int d(int i) {
return size() - i;
}
@Override // com.google.common.collect.ImmutableList, com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return this.a.contains(obj);
}
@Override // java.util.List
public E get(int i) {
Preconditions.a(i, size());
return this.a.get(c(i));
}
@Override // com.google.common.collect.ImmutableList, java.util.List
public int indexOf(Object obj) {
int lastIndexOf = this.a.lastIndexOf(obj);
if (lastIndexOf >= 0) {
return c(lastIndexOf);
}
return -1;
}
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return this.a.isPartialView();
}
@Override // com.google.common.collect.ImmutableList, com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
public /* bridge */ /* synthetic */ Iterator iterator() {
return super.iterator();
}
@Override // com.google.common.collect.ImmutableList, java.util.List
public int lastIndexOf(Object obj) {
int indexOf = this.a.indexOf(obj);
if (indexOf >= 0) {
return c(indexOf);
}
return -1;
}
@Override // com.google.common.collect.ImmutableList, java.util.List
public /* bridge */ /* synthetic */ ListIterator listIterator() {
return super.listIterator();
}
@Override // com.google.common.collect.ImmutableList
public ImmutableList<E> reverse() {
return this.a;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public int size() {
return this.a.size();
}
@Override // com.google.common.collect.ImmutableList, java.util.List
public /* bridge */ /* synthetic */ ListIterator listIterator(int i) {
return super.listIterator(i);
}
@Override // com.google.common.collect.ImmutableList, java.util.List
public ImmutableList<E> subList(int i, int i2) {
Preconditions.b(i, i2, size());
return this.a.subList(d(i2), d(i)).reverse();
}
}
static class SerializedForm implements Serializable {
final Object[] a;
SerializedForm(Object[] objArr) {
this.a = objArr;
}
Object readResolve() {
return ImmutableList.copyOf(this.a);
}
}
class SubList extends ImmutableList<E> {
final transient int a;
final transient int b;
SubList(int i, int i2) {
this.a = i;
this.b = i2;
}
@Override // java.util.List
public E get(int i) {
Preconditions.a(i, this.b);
return ImmutableList.this.get(i + this.a);
}
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return true;
}
@Override // com.google.common.collect.ImmutableList, com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
public /* bridge */ /* synthetic */ Iterator iterator() {
return super.iterator();
}
@Override // com.google.common.collect.ImmutableList, java.util.List
public /* bridge */ /* synthetic */ ListIterator listIterator() {
return super.listIterator();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public int size() {
return this.b;
}
@Override // com.google.common.collect.ImmutableList, java.util.List
public /* bridge */ /* synthetic */ ListIterator listIterator(int i) {
return super.listIterator(i);
}
@Override // com.google.common.collect.ImmutableList, java.util.List
public ImmutableList<E> subList(int i, int i2) {
Preconditions.b(i, i2, this.b);
ImmutableList immutableList = ImmutableList.this;
int i3 = this.a;
return immutableList.subList(i + i3, i2 + i3);
}
}
ImmutableList() {
}
static <E> ImmutableList<E> asImmutableList(Object[] objArr) {
return asImmutableList(objArr, objArr.length);
}
public static <E> Builder<E> builder() {
return new Builder<>();
}
private static <E> ImmutableList<E> construct(Object... objArr) {
ObjectArrays.a(objArr);
return asImmutableList(objArr);
}
public static <E> ImmutableList<E> copyOf(Iterable<? extends E> iterable) {
Preconditions.a(iterable);
return iterable instanceof Collection ? copyOf((Collection) iterable) : copyOf(iterable.iterator());
}
public static <E> ImmutableList<E> of() {
return (ImmutableList<E>) RegularImmutableList.c;
}
private void readObject(ObjectInputStream objectInputStream) throws InvalidObjectException {
throw new InvalidObjectException("Use SerializedForm");
}
public static <E extends Comparable<? super E>> ImmutableList<E> sortedCopyOf(Iterable<? extends E> iterable) {
Comparable[] comparableArr = (Comparable[]) Iterables.a((Iterable) iterable, (Object[]) new Comparable[0]);
ObjectArrays.a(comparableArr);
Arrays.sort(comparableArr);
return asImmutableList(comparableArr);
}
@Override // java.util.List
@Deprecated
public final void add(int i, E e) {
throw new UnsupportedOperationException();
}
@Override // java.util.List
@Deprecated
public final boolean addAll(int i, Collection<? extends E> collection) {
throw new UnsupportedOperationException();
}
@Override // com.google.common.collect.ImmutableCollection
public final ImmutableList<E> asList() {
return this;
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return indexOf(obj) >= 0;
}
@Override // com.google.common.collect.ImmutableCollection
int copyIntoArray(Object[] objArr, int i) {
int size = size();
for (int i2 = 0; i2 < size; i2++) {
objArr[i + i2] = get(i2);
}
return i + size;
}
@Override // java.util.Collection, java.util.List
public boolean equals(Object obj) {
return Lists.a(this, obj);
}
@Override // java.util.Collection, java.util.List
public int hashCode() {
int size = size();
int i = 1;
for (int i2 = 0; i2 < size; i2++) {
i = ~(~((i * 31) + get(i2).hashCode()));
}
return i;
}
@Override // java.util.List
public int indexOf(Object obj) {
if (obj == null) {
return -1;
}
return Lists.b(this, obj);
}
@Override // java.util.List
public int lastIndexOf(Object obj) {
if (obj == null) {
return -1;
}
return Lists.d(this, obj);
}
@Override // java.util.List
@Deprecated
public final E remove(int i) {
throw new UnsupportedOperationException();
}
public ImmutableList<E> reverse() {
return size() <= 1 ? this : new ReverseImmutableList(this);
}
@Override // java.util.List
@Deprecated
public final E set(int i, E e) {
throw new UnsupportedOperationException();
}
ImmutableList<E> subListUnchecked(int i, int i2) {
return new SubList(i, i2 - i);
}
@Override // com.google.common.collect.ImmutableCollection
Object writeReplace() {
return new SerializedForm(toArray());
}
static <E> ImmutableList<E> asImmutableList(Object[] objArr, int i) {
return i == 0 ? of() : new RegularImmutableList(objArr, i);
}
public static <E> ImmutableList<E> of(E e) {
return construct(e);
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
public UnmodifiableIterator<E> iterator() {
return listIterator();
}
@Override // java.util.List
public ImmutableList<E> subList(int i, int i2) {
Preconditions.b(i, i2, size());
int i3 = i2 - i;
return i3 == size() ? this : i3 == 0 ? of() : subListUnchecked(i, i2);
}
public static <E> ImmutableList<E> of(E e, E e2) {
return construct(e, e2);
}
@Override // java.util.List
public UnmodifiableListIterator<E> listIterator() {
return listIterator(0);
}
public static <E> ImmutableList<E> of(E e, E e2, E e3) {
return construct(e, e2, e3);
}
@Override // java.util.List
public UnmodifiableListIterator<E> listIterator(int i) {
return new AbstractIndexedListIterator<E>(size(), i) { // from class: com.google.common.collect.ImmutableList.1
@Override // com.google.common.collect.AbstractIndexedListIterator
protected E a(int i2) {
return ImmutableList.this.get(i2);
}
};
}
public static <E> ImmutableList<E> copyOf(Collection<? extends E> collection) {
if (collection instanceof ImmutableCollection) {
ImmutableList<E> asList = ((ImmutableCollection) collection).asList();
return asList.isPartialView() ? asImmutableList(asList.toArray()) : asList;
}
return construct(collection.toArray());
}
public static <E> ImmutableList<E> of(E e, E e2, E e3, E e4) {
return construct(e, e2, e3, e4);
}
public static <E> ImmutableList<E> sortedCopyOf(Comparator<? super E> comparator, Iterable<? extends E> iterable) {
Preconditions.a(comparator);
Object[] e = Iterables.e(iterable);
ObjectArrays.a(e);
Arrays.sort(e, comparator);
return asImmutableList(e);
}
public static <E> ImmutableList<E> of(E e, E e2, E e3, E e4, E e5) {
return construct(e, e2, e3, e4, e5);
}
public static <E> ImmutableList<E> of(E e, E e2, E e3, E e4, E e5, E e6) {
return construct(e, e2, e3, e4, e5, e6);
}
public static <E> ImmutableList<E> of(E e, E e2, E e3, E e4, E e5, E e6, E e7) {
return construct(e, e2, e3, e4, e5, e6, e7);
}
public static <E> ImmutableList<E> copyOf(Iterator<? extends E> it) {
if (!it.hasNext()) {
return of();
}
E next = it.next();
if (!it.hasNext()) {
return of((Object) next);
}
Builder builder = new Builder();
builder.a((Builder) next);
builder.a((Iterator) it);
return builder.a();
}
public static <E> ImmutableList<E> of(E e, E e2, E e3, E e4, E e5, E e6, E e7, E e8) {
return construct(e, e2, e3, e4, e5, e6, e7, e8);
}
public static <E> ImmutableList<E> of(E e, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) {
return construct(e, e2, e3, e4, e5, e6, e7, e8, e9);
}
public static <E> ImmutableList<E> of(E e, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) {
return construct(e, e2, e3, e4, e5, e6, e7, e8, e9, e10);
}
public static <E> ImmutableList<E> of(E e, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11) {
return construct(e, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11);
}
@SafeVarargs
public static <E> ImmutableList<E> of(E e, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11, E e12, E... eArr) {
Object[] objArr = new Object[eArr.length + 12];
objArr[0] = e;
objArr[1] = e2;
objArr[2] = e3;
objArr[3] = e4;
objArr[4] = e5;
objArr[5] = e6;
objArr[6] = e7;
objArr[7] = e8;
objArr[8] = e9;
objArr[9] = e10;
objArr[10] = e11;
objArr[11] = e12;
System.arraycopy(eArr, 0, objArr, 12, eArr.length);
return construct(objArr);
}
public static <E> ImmutableList<E> copyOf(E[] eArr) {
if (eArr.length == 0) {
return of();
}
return construct((Object[]) eArr.clone());
}
}

View File

@@ -0,0 +1,253 @@
package com.google.common.collect;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Serialization;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
public class ImmutableListMultimap<K, V> extends ImmutableMultimap<K, V> implements ListMultimap<K, V> {
private static final long serialVersionUID = 0;
private transient ImmutableListMultimap<V, K> inverse;
public static final class Builder<K, V> extends ImmutableMultimap.Builder<K, V> {
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultimap.Builder
public /* bridge */ /* synthetic */ ImmutableMultimap.Builder a(Object obj, Object obj2) {
a((Builder<K, V>) obj, obj2);
return this;
}
@Override // com.google.common.collect.ImmutableMultimap.Builder
public /* bridge */ /* synthetic */ ImmutableMultimap.Builder a(Map.Entry entry) {
a(entry);
return this;
}
@Override // com.google.common.collect.ImmutableMultimap.Builder
public Builder<K, V> a(K k, V v) {
super.a((Builder<K, V>) k, (K) v);
return this;
}
@Override // com.google.common.collect.ImmutableMultimap.Builder
public Builder<K, V> a(Map.Entry<? extends K, ? extends V> entry) {
super.a((Map.Entry) entry);
return this;
}
@Override // com.google.common.collect.ImmutableMultimap.Builder
public Builder<K, V> a(Iterable<? extends Map.Entry<? extends K, ? extends V>> iterable) {
super.a((Iterable) iterable);
return this;
}
@Override // com.google.common.collect.ImmutableMultimap.Builder
public ImmutableListMultimap<K, V> a() {
return (ImmutableListMultimap) super.a();
}
}
ImmutableListMultimap(ImmutableMap<K, ImmutableList<V>> immutableMap, int i) {
super(immutableMap, i);
}
public static <K, V> Builder<K, V> builder() {
return new Builder<>();
}
public static <K, V> ImmutableListMultimap<K, V> copyOf(Multimap<? extends K, ? extends V> multimap) {
if (multimap.isEmpty()) {
return of();
}
if (multimap instanceof ImmutableListMultimap) {
ImmutableListMultimap<K, V> immutableListMultimap = (ImmutableListMultimap) multimap;
if (!immutableListMultimap.isPartialView()) {
return immutableListMultimap;
}
}
ImmutableMap.Builder builder = new ImmutableMap.Builder(multimap.asMap().size());
int i = 0;
for (Map.Entry<? extends K, Collection<? extends V>> entry : multimap.asMap().entrySet()) {
ImmutableList copyOf = ImmutableList.copyOf((Collection) entry.getValue());
if (!copyOf.isEmpty()) {
builder.a(entry.getKey(), copyOf);
i += copyOf.size();
}
}
return new ImmutableListMultimap<>(builder.a(), i);
}
/* JADX WARN: Multi-variable type inference failed */
private ImmutableListMultimap<V, K> invert() {
Builder builder = builder();
UnmodifiableIterator it = entries().iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
builder.a((Builder) entry.getValue(), entry.getKey());
}
ImmutableListMultimap<V, K> a = builder.a();
a.inverse = this;
return a;
}
public static <K, V> ImmutableListMultimap<K, V> of() {
return EmptyImmutableListMultimap.a;
}
/* JADX WARN: Multi-variable type inference failed */
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
objectInputStream.defaultReadObject();
int readInt = objectInputStream.readInt();
if (readInt < 0) {
throw new InvalidObjectException("Invalid key count " + readInt);
}
ImmutableMap.Builder builder = ImmutableMap.builder();
int i = 0;
for (int i2 = 0; i2 < readInt; i2++) {
Object readObject = objectInputStream.readObject();
int readInt2 = objectInputStream.readInt();
if (readInt2 <= 0) {
throw new InvalidObjectException("Invalid value count " + readInt2);
}
ImmutableList.Builder builder2 = ImmutableList.builder();
for (int i3 = 0; i3 < readInt2; i3++) {
builder2.a((ImmutableList.Builder) objectInputStream.readObject());
}
builder.a(readObject, builder2.a());
i += readInt2;
}
try {
ImmutableMultimap.FieldSettersHolder.a.a((Serialization.FieldSetter<ImmutableMultimap>) this, (Object) builder.a());
ImmutableMultimap.FieldSettersHolder.b.a((Serialization.FieldSetter<ImmutableMultimap>) this, i);
} catch (IllegalArgumentException e) {
throw ((InvalidObjectException) new InvalidObjectException(e.getMessage()).initCause(e));
}
}
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
objectOutputStream.defaultWriteObject();
Serialization.a(this, objectOutputStream);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ ImmutableCollection get(Object obj) {
return get((ImmutableListMultimap<K, V>) obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.AbstractMultimap
@Deprecated
public /* bridge */ /* synthetic */ ImmutableCollection replaceValues(Object obj, Iterable iterable) {
return replaceValues((ImmutableListMultimap<K, V>) obj, iterable);
}
public static <K, V> ImmutableListMultimap<K, V> of(K k, V v) {
Builder builder = builder();
builder.a((Builder) k, (K) v);
return builder.a();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Collection get(Object obj) {
return get((ImmutableListMultimap<K, V>) obj);
}
@Override // com.google.common.collect.ImmutableMultimap
public ImmutableListMultimap<V, K> inverse() {
ImmutableListMultimap<V, K> immutableListMultimap = this.inverse;
if (immutableListMultimap != null) {
return immutableListMultimap;
}
ImmutableListMultimap<V, K> invert = invert();
this.inverse = invert;
return invert;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.AbstractMultimap
@Deprecated
public /* bridge */ /* synthetic */ Collection replaceValues(Object obj, Iterable iterable) {
return replaceValues((ImmutableListMultimap<K, V>) obj, iterable);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ List get(Object obj) {
return get((ImmutableListMultimap<K, V>) obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.AbstractMultimap
@Deprecated
public /* bridge */ /* synthetic */ List replaceValues(Object obj, Iterable iterable) {
return replaceValues((ImmutableListMultimap<K, V>) obj, iterable);
}
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.Multimap
public ImmutableList<V> get(K k) {
ImmutableList<V> immutableList = (ImmutableList) this.map.get(k);
return immutableList == null ? ImmutableList.of() : immutableList;
}
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.Multimap
@Deprecated
public ImmutableList<V> removeAll(Object obj) {
throw new UnsupportedOperationException();
}
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.AbstractMultimap
@Deprecated
public ImmutableList<V> replaceValues(K k, Iterable<? extends V> iterable) {
throw new UnsupportedOperationException();
}
public static <K, V> ImmutableListMultimap<K, V> of(K k, V v, K k2, V v2) {
Builder builder = builder();
builder.a((Builder) k, (K) v);
builder.a((Builder) k2, (K) v2);
return builder.a();
}
public static <K, V> ImmutableListMultimap<K, V> of(K k, V v, K k2, V v2, K k3, V v3) {
Builder builder = builder();
builder.a((Builder) k, (K) v);
builder.a((Builder) k2, (K) v2);
builder.a((Builder) k3, (K) v3);
return builder.a();
}
public static <K, V> ImmutableListMultimap<K, V> copyOf(Iterable<? extends Map.Entry<? extends K, ? extends V>> iterable) {
Builder builder = new Builder();
builder.a((Iterable) iterable);
return builder.a();
}
public static <K, V> ImmutableListMultimap<K, V> of(K k, V v, K k2, V v2, K k3, V v3, K k4, V v4) {
Builder builder = builder();
builder.a((Builder) k, (K) v);
builder.a((Builder) k2, (K) v2);
builder.a((Builder) k3, (K) v3);
builder.a((Builder) k4, (K) v4);
return builder.a();
}
public static <K, V> ImmutableListMultimap<K, V> of(K k, V v, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
Builder builder = builder();
builder.a((Builder) k, (K) v);
builder.a((Builder) k2, (K) v2);
builder.a((Builder) k3, (K) v3);
builder.a((Builder) k4, (K) v4);
builder.a((Builder) k5, (K) v5);
return builder.a();
}
}

View File

@@ -0,0 +1,469 @@
package com.google.common.collect;
import com.google.common.collect.ImmutableCollection;
import java.io.Serializable;
import java.util.AbstractMap;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
/* loaded from: classes.dex */
public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
static final Map.Entry<?, ?>[] EMPTY_ENTRY_ARRAY = new Map.Entry[0];
private transient ImmutableSet<Map.Entry<K, V>> entrySet;
private transient ImmutableSet<K> keySet;
private transient ImmutableSetMultimap<K, V> multimapView;
private transient ImmutableCollection<V> values;
public static class Builder<K, V> {
Comparator<? super V> a;
Object[] b;
int c;
boolean d;
public Builder() {
this(4);
}
private void a(int i) {
int i2 = i * 2;
Object[] objArr = this.b;
if (i2 > objArr.length) {
this.b = Arrays.copyOf(objArr, ImmutableCollection.Builder.a(objArr.length, i2));
this.d = false;
}
}
void b() {
int i;
if (this.a != null) {
if (this.d) {
this.b = Arrays.copyOf(this.b, this.c * 2);
}
Map.Entry[] entryArr = new Map.Entry[this.c];
int i2 = 0;
while (true) {
i = this.c;
if (i2 >= i) {
break;
}
Object[] objArr = this.b;
int i3 = i2 * 2;
entryArr[i2] = new AbstractMap.SimpleImmutableEntry(objArr[i3], objArr[i3 + 1]);
i2++;
}
Arrays.sort(entryArr, 0, i, Ordering.a(this.a).a(Maps.d()));
for (int i4 = 0; i4 < this.c; i4++) {
int i5 = i4 * 2;
this.b[i5] = entryArr[i4].getKey();
this.b[i5 + 1] = entryArr[i4].getValue();
}
}
}
Builder(int i) {
this.b = new Object[i * 2];
this.c = 0;
this.d = false;
}
public Builder<K, V> a(K k, V v) {
a(this.c + 1);
CollectPreconditions.a(k, v);
Object[] objArr = this.b;
int i = this.c;
objArr[i * 2] = k;
objArr[(i * 2) + 1] = v;
this.c = i + 1;
return this;
}
public Builder<K, V> a(Map.Entry<? extends K, ? extends V> entry) {
return a(entry.getKey(), entry.getValue());
}
public Builder<K, V> a(Map<? extends K, ? extends V> map) {
return a(map.entrySet());
}
public Builder<K, V> a(Iterable<? extends Map.Entry<? extends K, ? extends V>> iterable) {
if (iterable instanceof Collection) {
a(this.c + ((Collection) iterable).size());
}
Iterator<? extends Map.Entry<? extends K, ? extends V>> it = iterable.iterator();
while (it.hasNext()) {
a(it.next());
}
return this;
}
public ImmutableMap<K, V> a() {
b();
this.d = true;
return RegularImmutableMap.a(this.c, this.b);
}
}
static abstract class IteratorBasedImmutableMap<K, V> extends ImmutableMap<K, V> {
IteratorBasedImmutableMap() {
}
abstract UnmodifiableIterator<Map.Entry<K, V>> a();
@Override // com.google.common.collect.ImmutableMap
ImmutableSet<Map.Entry<K, V>> createEntrySet() {
return new ImmutableMapEntrySet<K, V>() { // from class: com.google.common.collect.ImmutableMap.IteratorBasedImmutableMap.1EntrySetImpl
@Override // com.google.common.collect.ImmutableMapEntrySet
ImmutableMap<K, V> a() {
return IteratorBasedImmutableMap.this;
}
@Override // com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
public UnmodifiableIterator<Map.Entry<K, V>> iterator() {
return IteratorBasedImmutableMap.this.a();
}
};
}
@Override // com.google.common.collect.ImmutableMap
ImmutableSet<K> createKeySet() {
return new ImmutableMapKeySet(this);
}
@Override // com.google.common.collect.ImmutableMap
ImmutableCollection<V> createValues() {
return new ImmutableMapValues(this);
}
@Override // com.google.common.collect.ImmutableMap, java.util.Map
public /* bridge */ /* synthetic */ Set entrySet() {
return super.entrySet();
}
@Override // com.google.common.collect.ImmutableMap, java.util.Map
public /* bridge */ /* synthetic */ Set keySet() {
return super.keySet();
}
@Override // com.google.common.collect.ImmutableMap, java.util.Map
public /* bridge */ /* synthetic */ Collection values() {
return super.values();
}
}
private final class MapViewOfValuesAsSingletonSets extends IteratorBasedImmutableMap<K, ImmutableSet<V>> {
private MapViewOfValuesAsSingletonSets() {
}
@Override // com.google.common.collect.ImmutableMap.IteratorBasedImmutableMap
UnmodifiableIterator<Map.Entry<K, ImmutableSet<V>>> a() {
final UnmodifiableIterator<Map.Entry<K, V>> it = ImmutableMap.this.entrySet().iterator();
return new UnmodifiableIterator<Map.Entry<K, ImmutableSet<V>>>(this) { // from class: com.google.common.collect.ImmutableMap.MapViewOfValuesAsSingletonSets.1
@Override // java.util.Iterator
public boolean hasNext() {
return it.hasNext();
}
@Override // java.util.Iterator
public Map.Entry<K, ImmutableSet<V>> next() {
final Map.Entry entry = (Map.Entry) it.next();
return new AbstractMapEntry<K, ImmutableSet<V>>(this) { // from class: com.google.common.collect.ImmutableMap.MapViewOfValuesAsSingletonSets.1.1
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public K getKey() {
return (K) entry.getKey();
}
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public ImmutableSet<V> getValue() {
return ImmutableSet.of(entry.getValue());
}
};
}
};
}
@Override // com.google.common.collect.ImmutableMap, java.util.Map
public boolean containsKey(Object obj) {
return ImmutableMap.this.containsKey(obj);
}
@Override // com.google.common.collect.ImmutableMap.IteratorBasedImmutableMap, com.google.common.collect.ImmutableMap
ImmutableSet<K> createKeySet() {
return ImmutableMap.this.keySet();
}
@Override // com.google.common.collect.ImmutableMap, java.util.Map
public int hashCode() {
return ImmutableMap.this.hashCode();
}
@Override // com.google.common.collect.ImmutableMap
boolean isHashCodeFast() {
return ImmutableMap.this.isHashCodeFast();
}
@Override // com.google.common.collect.ImmutableMap
boolean isPartialView() {
return ImmutableMap.this.isPartialView();
}
@Override // java.util.Map
public int size() {
return ImmutableMap.this.size();
}
@Override // com.google.common.collect.ImmutableMap, java.util.Map
public ImmutableSet<V> get(Object obj) {
Object obj2 = ImmutableMap.this.get(obj);
if (obj2 == null) {
return null;
}
return ImmutableSet.of(obj2);
}
}
static class SerializedForm implements Serializable {
private final Object[] a;
private final Object[] b;
SerializedForm(ImmutableMap<?, ?> immutableMap) {
this.a = new Object[immutableMap.size()];
this.b = new Object[immutableMap.size()];
UnmodifiableIterator<Map.Entry<?, ?>> it = immutableMap.entrySet().iterator();
int i = 0;
while (it.hasNext()) {
Map.Entry<?, ?> next = it.next();
this.a[i] = next.getKey();
this.b[i] = next.getValue();
i++;
}
}
Object a(Builder<Object, Object> builder) {
int i = 0;
while (true) {
Object[] objArr = this.a;
if (i >= objArr.length) {
return builder.a();
}
builder.a(objArr[i], this.b[i]);
i++;
}
}
Object readResolve() {
return a(new Builder<>(this.a.length));
}
}
ImmutableMap() {
}
public static <K, V> Builder<K, V> builder() {
return new Builder<>();
}
static void checkNoConflict(boolean z, String str, Map.Entry<?, ?> entry, Map.Entry<?, ?> entry2) {
if (z) {
return;
}
throw new IllegalArgumentException("Multiple entries with same " + str + ": " + entry + " and " + entry2);
}
public static <K, V> ImmutableMap<K, V> copyOf(Map<? extends K, ? extends V> map) {
if ((map instanceof ImmutableMap) && !(map instanceof SortedMap)) {
ImmutableMap<K, V> immutableMap = (ImmutableMap) map;
if (!immutableMap.isPartialView()) {
return immutableMap;
}
}
return copyOf(map.entrySet());
}
static <K, V> Map.Entry<K, V> entryOf(K k, V v) {
CollectPreconditions.a(k, v);
return new AbstractMap.SimpleImmutableEntry(k, v);
}
public static <K, V> ImmutableMap<K, V> of() {
return (ImmutableMap<K, V>) RegularImmutableMap.d;
}
public ImmutableSetMultimap<K, V> asMultimap() {
if (isEmpty()) {
return ImmutableSetMultimap.of();
}
ImmutableSetMultimap<K, V> immutableSetMultimap = this.multimapView;
if (immutableSetMultimap != null) {
return immutableSetMultimap;
}
ImmutableSetMultimap<K, V> immutableSetMultimap2 = new ImmutableSetMultimap<>(new MapViewOfValuesAsSingletonSets(), size(), null);
this.multimapView = immutableSetMultimap2;
return immutableSetMultimap2;
}
@Override // java.util.Map
@Deprecated
public final void clear() {
throw new UnsupportedOperationException();
}
@Override // java.util.Map
public boolean containsKey(Object obj) {
return get(obj) != null;
}
@Override // java.util.Map
public boolean containsValue(Object obj) {
return values().contains(obj);
}
abstract ImmutableSet<Map.Entry<K, V>> createEntrySet();
abstract ImmutableSet<K> createKeySet();
abstract ImmutableCollection<V> createValues();
@Override // java.util.Map
public boolean equals(Object obj) {
return Maps.c(this, obj);
}
@Override // java.util.Map
public abstract V get(Object obj);
@Override // java.util.Map
public int hashCode() {
return Sets.a(entrySet());
}
@Override // java.util.Map
public boolean isEmpty() {
return size() == 0;
}
boolean isHashCodeFast() {
return false;
}
abstract boolean isPartialView();
UnmodifiableIterator<K> keyIterator() {
final UnmodifiableIterator<Map.Entry<K, V>> it = entrySet().iterator();
return new UnmodifiableIterator<K>(this) { // from class: com.google.common.collect.ImmutableMap.1
@Override // java.util.Iterator
public boolean hasNext() {
return it.hasNext();
}
@Override // java.util.Iterator
public K next() {
return (K) ((Map.Entry) it.next()).getKey();
}
};
}
@Override // java.util.Map
@Deprecated
public final V put(K k, V v) {
throw new UnsupportedOperationException();
}
@Override // java.util.Map
@Deprecated
public final void putAll(Map<? extends K, ? extends V> map) {
throw new UnsupportedOperationException();
}
@Override // java.util.Map
@Deprecated
public final V remove(Object obj) {
throw new UnsupportedOperationException();
}
public String toString() {
return Maps.a(this);
}
Object writeReplace() {
return new SerializedForm(this);
}
public static <K, V> ImmutableMap<K, V> of(K k, V v) {
CollectPreconditions.a(k, v);
return RegularImmutableMap.a(1, new Object[]{k, v});
}
@Override // java.util.Map
public ImmutableSet<Map.Entry<K, V>> entrySet() {
ImmutableSet<Map.Entry<K, V>> immutableSet = this.entrySet;
if (immutableSet != null) {
return immutableSet;
}
ImmutableSet<Map.Entry<K, V>> createEntrySet = createEntrySet();
this.entrySet = createEntrySet;
return createEntrySet;
}
@Override // java.util.Map
public ImmutableSet<K> keySet() {
ImmutableSet<K> immutableSet = this.keySet;
if (immutableSet != null) {
return immutableSet;
}
ImmutableSet<K> createKeySet = createKeySet();
this.keySet = createKeySet;
return createKeySet;
}
@Override // java.util.Map
public ImmutableCollection<V> values() {
ImmutableCollection<V> immutableCollection = this.values;
if (immutableCollection != null) {
return immutableCollection;
}
ImmutableCollection<V> createValues = createValues();
this.values = createValues;
return createValues;
}
public static <K, V> ImmutableMap<K, V> of(K k, V v, K k2, V v2) {
CollectPreconditions.a(k, v);
CollectPreconditions.a(k2, v2);
return RegularImmutableMap.a(2, new Object[]{k, v, k2, v2});
}
public static <K, V> ImmutableMap<K, V> copyOf(Iterable<? extends Map.Entry<? extends K, ? extends V>> iterable) {
Builder builder = new Builder(iterable instanceof Collection ? ((Collection) iterable).size() : 4);
builder.a(iterable);
return builder.a();
}
public static <K, V> ImmutableMap<K, V> of(K k, V v, K k2, V v2, K k3, V v3) {
CollectPreconditions.a(k, v);
CollectPreconditions.a(k2, v2);
CollectPreconditions.a(k3, v3);
return RegularImmutableMap.a(3, new Object[]{k, v, k2, v2, k3, v3});
}
public static <K, V> ImmutableMap<K, V> of(K k, V v, K k2, V v2, K k3, V v3, K k4, V v4) {
CollectPreconditions.a(k, v);
CollectPreconditions.a(k2, v2);
CollectPreconditions.a(k3, v3);
CollectPreconditions.a(k4, v4);
return RegularImmutableMap.a(4, new Object[]{k, v, k2, v2, k3, v3, k4, v4});
}
public static <K, V> ImmutableMap<K, V> of(K k, V v, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
CollectPreconditions.a(k, v);
CollectPreconditions.a(k2, v2);
CollectPreconditions.a(k3, v3);
CollectPreconditions.a(k4, v4);
CollectPreconditions.a(k5, v5);
return RegularImmutableMap.a(5, new Object[]{k, v, k2, v2, k3, v3, k4, v4, k5, v5});
}
}

View File

@@ -0,0 +1,60 @@
package com.google.common.collect;
import java.io.Serializable;
import java.util.Map;
/* loaded from: classes.dex */
abstract class ImmutableMapEntrySet<K, V> extends ImmutableSet<Map.Entry<K, V>> {
private static class EntrySetSerializedForm<K, V> implements Serializable {
final ImmutableMap<K, V> a;
EntrySetSerializedForm(ImmutableMap<K, V> immutableMap) {
this.a = immutableMap;
}
Object readResolve() {
return this.a.entrySet();
}
}
ImmutableMapEntrySet() {
}
abstract ImmutableMap<K, V> a();
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
V v = a().get(entry.getKey());
return v != null && v.equals(entry.getValue());
}
@Override // com.google.common.collect.ImmutableSet, java.util.Collection, java.util.Set
public int hashCode() {
return a().hashCode();
}
@Override // com.google.common.collect.ImmutableSet
boolean isHashCodeFast() {
return a().isHashCodeFast();
}
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return a().isPartialView();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return a().size();
}
@Override // com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection
Object writeReplace() {
return new EntrySetSerializedForm(a());
}
}

View File

@@ -0,0 +1,55 @@
package com.google.common.collect;
import com.google.common.collect.ImmutableSet;
import java.io.Serializable;
/* loaded from: classes.dex */
final class ImmutableMapKeySet<K, V> extends ImmutableSet.Indexed<K> {
private final ImmutableMap<K, V> a;
private static class KeySetSerializedForm<K> implements Serializable {
final ImmutableMap<K, ?> a;
KeySetSerializedForm(ImmutableMap<K, ?> immutableMap) {
this.a = immutableMap;
}
Object readResolve() {
return this.a.keySet();
}
}
ImmutableMapKeySet(ImmutableMap<K, V> immutableMap) {
this.a = immutableMap;
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return this.a.containsKey(obj);
}
@Override // com.google.common.collect.ImmutableSet.Indexed
K get(int i) {
return this.a.entrySet().asList().get(i).getKey();
}
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return this.a.size();
}
@Override // com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection
Object writeReplace() {
return new KeySetSerializedForm(this.a);
}
@Override // com.google.common.collect.ImmutableSet.Indexed, com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
public UnmodifiableIterator<K> iterator() {
return this.a.keyIterator();
}
}

View File

@@ -0,0 +1,87 @@
package com.google.common.collect;
import java.io.Serializable;
import java.util.Map;
/* loaded from: classes.dex */
final class ImmutableMapValues<K, V> extends ImmutableCollection<V> {
private final ImmutableMap<K, V> a;
private static class SerializedForm<V> implements Serializable {
final ImmutableMap<?, V> a;
SerializedForm(ImmutableMap<?, V> immutableMap) {
this.a = immutableMap;
}
Object readResolve() {
return this.a.values();
}
}
ImmutableMapValues(ImmutableMap<K, V> immutableMap) {
this.a = immutableMap;
}
@Override // com.google.common.collect.ImmutableCollection
public ImmutableList<V> asList() {
final ImmutableList<Map.Entry<K, V>> asList = this.a.entrySet().asList();
return new ImmutableList<V>(this) { // from class: com.google.common.collect.ImmutableMapValues.2
@Override // java.util.List
public V get(int i) {
return (V) ((Map.Entry) asList.get(i)).getValue();
}
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public int size() {
return asList.size();
}
};
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return obj != null && Iterators.a(iterator(), obj);
}
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection
public int size() {
return this.a.size();
}
@Override // com.google.common.collect.ImmutableCollection
Object writeReplace() {
return new SerializedForm(this.a);
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
public UnmodifiableIterator<V> iterator() {
return new UnmodifiableIterator<V>() { // from class: com.google.common.collect.ImmutableMapValues.1
final UnmodifiableIterator<Map.Entry<K, V>> a;
{
this.a = ImmutableMapValues.this.a.entrySet().iterator();
}
@Override // java.util.Iterator
public boolean hasNext() {
return this.a.hasNext();
}
@Override // java.util.Iterator
public V next() {
return this.a.next().getValue();
}
};
}
}

View File

@@ -0,0 +1,438 @@
package com.google.common.collect;
import com.google.common.collect.Multiset;
import com.google.common.collect.Serialization;
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
public abstract class ImmutableMultimap<K, V> extends AbstractMultimap<K, V> implements Serializable {
private static final long serialVersionUID = 0;
final transient ImmutableMap<K, ? extends ImmutableCollection<V>> map;
final transient int size;
public static class Builder<K, V> {
Multimap<K, V> a;
Comparator<? super K> b;
Comparator<? super V> c;
public Builder() {
this(MultimapBuilder.a().a().b());
}
public Builder<K, V> a(K k, V v) {
CollectPreconditions.a(k, v);
this.a.put(k, v);
return this;
}
Builder(Multimap<K, V> multimap) {
this.a = multimap;
}
public Builder<K, V> a(Map.Entry<? extends K, ? extends V> entry) {
return a(entry.getKey(), entry.getValue());
}
public Builder<K, V> a(Iterable<? extends Map.Entry<? extends K, ? extends V>> iterable) {
Iterator<? extends Map.Entry<? extends K, ? extends V>> it = iterable.iterator();
while (it.hasNext()) {
a(it.next());
}
return this;
}
/* JADX WARN: Multi-variable type inference failed */
public ImmutableMultimap<K, V> a() {
if (this.c != null) {
Iterator<Collection<V>> it = this.a.asMap().values().iterator();
while (it.hasNext()) {
Collections.sort((List) it.next(), this.c);
}
}
if (this.b != null) {
AbstractListMultimap b = MultimapBuilder.a().a().b();
for (Map.Entry entry : Ordering.a(this.b).a().a(this.a.asMap().entrySet())) {
b.putAll(entry.getKey(), (Iterable) entry.getValue());
}
this.a = b;
}
return ImmutableMultimap.copyOf(this.a);
}
}
private static class EntryCollection<K, V> extends ImmutableCollection<Map.Entry<K, V>> {
final ImmutableMultimap<K, V> a;
EntryCollection(ImmutableMultimap<K, V> immutableMultimap) {
this.a = immutableMultimap;
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
return this.a.containsEntry(entry.getKey(), entry.getValue());
}
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return this.a.isPartialView();
}
@Override // java.util.AbstractCollection, java.util.Collection
public int size() {
return this.a.size();
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
public UnmodifiableIterator<Map.Entry<K, V>> iterator() {
return this.a.entryIterator();
}
}
static class FieldSettersHolder {
static final Serialization.FieldSetter<ImmutableMultimap> a = Serialization.a(ImmutableMultimap.class, "map");
static final Serialization.FieldSetter<ImmutableMultimap> b = Serialization.a(ImmutableMultimap.class, "size");
static final Serialization.FieldSetter<ImmutableSetMultimap> c = Serialization.a(ImmutableSetMultimap.class, "emptySet");
}
private abstract class Itr<T> extends UnmodifiableIterator<T> {
final Iterator<Map.Entry<K, Collection<V>>> a;
K b;
Iterator<V> c;
private Itr() {
this.a = ImmutableMultimap.this.asMap().entrySet().iterator();
this.b = null;
this.c = Iterators.a();
}
abstract T a(K k, V v);
@Override // java.util.Iterator
public boolean hasNext() {
return this.a.hasNext() || this.c.hasNext();
}
@Override // java.util.Iterator
public T next() {
if (!this.c.hasNext()) {
Map.Entry<K, Collection<V>> next = this.a.next();
this.b = next.getKey();
this.c = next.getValue().iterator();
}
return a(this.b, this.c.next());
}
}
class Keys extends ImmutableMultiset<K> {
Keys() {
}
@Override // com.google.common.collect.ImmutableMultiset, com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return ImmutableMultimap.this.containsKey(obj);
}
@Override // com.google.common.collect.Multiset
public int count(Object obj) {
ImmutableCollection<V> immutableCollection = ImmutableMultimap.this.map.get(obj);
if (immutableCollection == null) {
return 0;
}
return immutableCollection.size();
}
@Override // com.google.common.collect.ImmutableMultiset
Multiset.Entry<K> getEntry(int i) {
Map.Entry<K, ? extends ImmutableCollection<V>> entry = ImmutableMultimap.this.map.entrySet().asList().get(i);
return Multisets.a(entry.getKey(), entry.getValue().size());
}
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public int size() {
return ImmutableMultimap.this.size();
}
@Override // com.google.common.collect.ImmutableMultiset, com.google.common.collect.Multiset
public ImmutableSet<K> elementSet() {
return ImmutableMultimap.this.keySet();
}
}
private static final class Values<K, V> extends ImmutableCollection<V> {
private final transient ImmutableMultimap<K, V> a;
Values(ImmutableMultimap<K, V> immutableMultimap) {
this.a = immutableMultimap;
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return this.a.containsValue(obj);
}
@Override // com.google.common.collect.ImmutableCollection
int copyIntoArray(Object[] objArr, int i) {
UnmodifiableIterator<? extends ImmutableCollection<V>> it = this.a.map.values().iterator();
while (it.hasNext()) {
i = it.next().copyIntoArray(objArr, i);
}
return i;
}
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection
public int size() {
return this.a.size();
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
public UnmodifiableIterator<V> iterator() {
return this.a.valueIterator();
}
}
ImmutableMultimap(ImmutableMap<K, ? extends ImmutableCollection<V>> immutableMap, int i) {
this.map = immutableMap;
this.size = i;
}
public static <K, V> Builder<K, V> builder() {
return new Builder<>();
}
public static <K, V> ImmutableMultimap<K, V> copyOf(Multimap<? extends K, ? extends V> multimap) {
if (multimap instanceof ImmutableMultimap) {
ImmutableMultimap<K, V> immutableMultimap = (ImmutableMultimap) multimap;
if (!immutableMultimap.isPartialView()) {
return immutableMultimap;
}
}
return ImmutableListMultimap.copyOf((Multimap) multimap);
}
public static <K, V> ImmutableMultimap<K, V> of() {
return ImmutableListMultimap.of();
}
@Override // com.google.common.collect.Multimap
@Deprecated
public void clear() {
throw new UnsupportedOperationException();
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean containsEntry(Object obj, Object obj2) {
return super.containsEntry(obj, obj2);
}
@Override // com.google.common.collect.Multimap
public boolean containsKey(Object obj) {
return this.map.containsKey(obj);
}
@Override // com.google.common.collect.AbstractMultimap
public boolean containsValue(Object obj) {
return obj != null && super.containsValue(obj);
}
@Override // com.google.common.collect.AbstractMultimap
Map<K, Collection<V>> createAsMap() {
throw new AssertionError("should never be called");
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ boolean equals(Object obj) {
return super.equals(obj);
}
@Override // com.google.common.collect.Multimap
public abstract ImmutableCollection<V> get(K k);
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Collection get(Object obj) {
return get((ImmutableMultimap<K, V>) obj);
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ int hashCode() {
return super.hashCode();
}
public abstract ImmutableMultimap<V, K> inverse();
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean isEmpty() {
return super.isEmpty();
}
boolean isPartialView() {
return this.map.isPartialView();
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
@Deprecated
public boolean put(K k, V v) {
throw new UnsupportedOperationException();
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
@Deprecated
public boolean putAll(K k, Iterable<? extends V> iterable) {
throw new UnsupportedOperationException();
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
@Deprecated
public boolean remove(Object obj, Object obj2) {
throw new UnsupportedOperationException();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMultimap
@Deprecated
public /* bridge */ /* synthetic */ Collection replaceValues(Object obj, Iterable iterable) {
return replaceValues((ImmutableMultimap<K, V>) obj, iterable);
}
@Override // com.google.common.collect.Multimap
public int size() {
return this.size;
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
public static <K, V> ImmutableMultimap<K, V> of(K k, V v) {
return ImmutableListMultimap.of((Object) k, (Object) v);
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public ImmutableMap<K, Collection<V>> asMap() {
return this.map;
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractMultimap
public ImmutableCollection<Map.Entry<K, V>> createEntries() {
return new EntryCollection(this);
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractMultimap
public ImmutableMultiset<K> createKeys() {
return new Keys();
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractMultimap
public ImmutableCollection<V> createValues() {
return new Values(this);
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public ImmutableCollection<Map.Entry<K, V>> entries() {
return (ImmutableCollection) super.entries();
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractMultimap
public UnmodifiableIterator<Map.Entry<K, V>> entryIterator() {
return new ImmutableMultimap<K, V>.Itr<Map.Entry<K, V>>(this) { // from class: com.google.common.collect.ImmutableMultimap.1
@Override // com.google.common.collect.ImmutableMultimap.Itr
/* bridge */ /* synthetic */ Object a(Object obj, Object obj2) {
return a((AnonymousClass1) obj, obj2);
}
@Override // com.google.common.collect.ImmutableMultimap.Itr
Map.Entry<K, V> a(K k, V v) {
return Maps.a(k, v);
}
};
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public ImmutableSet<K> keySet() {
return this.map.keySet();
}
@Override // com.google.common.collect.AbstractMultimap
public ImmutableMultiset<K> keys() {
return (ImmutableMultiset) super.keys();
}
@Override // com.google.common.collect.AbstractMultimap
@Deprecated
public boolean putAll(Multimap<? extends K, ? extends V> multimap) {
throw new UnsupportedOperationException();
}
@Override // com.google.common.collect.Multimap
@Deprecated
public ImmutableCollection<V> removeAll(Object obj) {
throw new UnsupportedOperationException();
}
@Override // com.google.common.collect.AbstractMultimap
@Deprecated
public ImmutableCollection<V> replaceValues(K k, Iterable<? extends V> iterable) {
throw new UnsupportedOperationException();
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractMultimap
public UnmodifiableIterator<V> valueIterator() {
return new ImmutableMultimap<K, V>.Itr<V>(this) { // from class: com.google.common.collect.ImmutableMultimap.2
@Override // com.google.common.collect.ImmutableMultimap.Itr
V a(K k, V v) {
return v;
}
};
}
@Override // com.google.common.collect.AbstractMultimap
public ImmutableCollection<V> values() {
return (ImmutableCollection) super.values();
}
public static <K, V> ImmutableMultimap<K, V> of(K k, V v, K k2, V v2) {
return ImmutableListMultimap.of((Object) k, (Object) v, (Object) k2, (Object) v2);
}
public static <K, V> ImmutableMultimap<K, V> of(K k, V v, K k2, V v2, K k3, V v3) {
return ImmutableListMultimap.of((Object) k, (Object) v, (Object) k2, (Object) v2, (Object) k3, (Object) v3);
}
public static <K, V> ImmutableMultimap<K, V> copyOf(Iterable<? extends Map.Entry<? extends K, ? extends V>> iterable) {
return ImmutableListMultimap.copyOf((Iterable) iterable);
}
public static <K, V> ImmutableMultimap<K, V> of(K k, V v, K k2, V v2, K k3, V v3, K k4, V v4) {
return ImmutableListMultimap.of((Object) k, (Object) v, (Object) k2, (Object) v2, (Object) k3, (Object) v3, (Object) k4, (Object) v4);
}
public static <K, V> ImmutableMultimap<K, V> of(K k, V v, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
return ImmutableListMultimap.of((Object) k, (Object) v, (Object) k2, (Object) v2, (Object) k3, (Object) v3, (Object) k4, (Object) v4, (Object) k5, (Object) v5);
}
}

View File

@@ -0,0 +1,360 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multiset;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
/* loaded from: classes.dex */
public abstract class ImmutableMultiset<E> extends ImmutableMultisetGwtSerializationDependencies<E> implements Multiset<E> {
private transient ImmutableList<E> asList;
private transient ImmutableSet<Multiset.Entry<E>> entrySet;
public static class Builder<E> extends ImmutableCollection.Builder<E> {
AbstractObjectCountMap<E> a;
boolean b;
boolean c;
public Builder() {
this(4);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableCollection.Builder
public /* bridge */ /* synthetic */ ImmutableCollection.Builder a(Object obj) {
return a((Builder<E>) obj);
}
Builder(int i) {
this.b = false;
this.c = false;
this.a = ObjectCountHashMap.h(i);
}
@Override // com.google.common.collect.ImmutableCollection.Builder
public Builder<E> a(E e) {
return a((Builder<E>) e, 1);
}
public Builder<E> a(E e, int i) {
if (i == 0) {
return this;
}
if (this.b) {
this.a = new ObjectCountHashMap(this.a);
this.c = false;
}
this.b = false;
Preconditions.a(e);
AbstractObjectCountMap<E> abstractObjectCountMap = this.a;
abstractObjectCountMap.a(e, i + abstractObjectCountMap.a(e));
return this;
}
@Override // com.google.common.collect.ImmutableCollection.Builder
public Builder<E> a(E... eArr) {
super.a((Object[]) eArr);
return this;
}
@Override // com.google.common.collect.ImmutableCollection.Builder
public Builder<E> a(Iterable<? extends E> iterable) {
if (iterable instanceof Multiset) {
for (Multiset.Entry<E> entry : Multisets.a(iterable).entrySet()) {
a((Builder<E>) entry.a(), entry.getCount());
}
} else {
super.a((Iterable) iterable);
}
return this;
}
@Override // com.google.common.collect.ImmutableCollection.Builder
public Builder<E> a(Iterator<? extends E> it) {
super.a((Iterator) it);
return this;
}
public ImmutableMultiset<E> a() {
if (this.a.f()) {
return ImmutableMultiset.of();
}
if (this.c) {
this.a = new ObjectCountHashMap(this.a);
this.c = false;
}
this.b = true;
return new RegularImmutableMultiset((ObjectCountHashMap) this.a);
}
}
private final class EntrySet extends ImmutableSet.Indexed<Multiset.Entry<E>> {
private EntrySet() {
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
if (!(obj instanceof Multiset.Entry)) {
return false;
}
Multiset.Entry entry = (Multiset.Entry) obj;
return entry.getCount() > 0 && ImmutableMultiset.this.count(entry.a()) == entry.getCount();
}
@Override // com.google.common.collect.ImmutableSet, java.util.Collection, java.util.Set
public int hashCode() {
return ImmutableMultiset.this.hashCode();
}
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return ImmutableMultiset.this.isPartialView();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return ImmutableMultiset.this.elementSet().size();
}
@Override // com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection
Object writeReplace() {
return new EntrySetSerializedForm(ImmutableMultiset.this);
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableSet.Indexed
public Multiset.Entry<E> get(int i) {
return ImmutableMultiset.this.getEntry(i);
}
}
static class EntrySetSerializedForm<E> implements Serializable {
final ImmutableMultiset<E> a;
EntrySetSerializedForm(ImmutableMultiset<E> immutableMultiset) {
this.a = immutableMultiset;
}
Object readResolve() {
return this.a.entrySet();
}
}
private static class SerializedForm implements Serializable {
final Object[] a;
final int[] b;
SerializedForm(Multiset<?> multiset) {
int size = multiset.entrySet().size();
this.a = new Object[size];
this.b = new int[size];
int i = 0;
for (Multiset.Entry<?> entry : multiset.entrySet()) {
this.a[i] = entry.a();
this.b[i] = entry.getCount();
i++;
}
}
/* JADX WARN: Multi-variable type inference failed */
Object readResolve() {
Builder builder = new Builder(this.a.length);
int i = 0;
while (true) {
Object[] objArr = this.a;
if (i >= objArr.length) {
return builder.a();
}
builder.a((Builder) objArr[i], this.b[i]);
i++;
}
}
}
ImmutableMultiset() {
}
public static <E> Builder<E> builder() {
return new Builder<>();
}
private static <E> ImmutableMultiset<E> copyFromElements(E... eArr) {
return new Builder().a((Object[]) eArr).a();
}
static <E> ImmutableMultiset<E> copyFromEntries(Collection<? extends Multiset.Entry<? extends E>> collection) {
Builder builder = new Builder(collection.size());
for (Multiset.Entry<? extends E> entry : collection) {
builder.a((Builder) entry.a(), entry.getCount());
}
return builder.a();
}
public static <E> ImmutableMultiset<E> copyOf(E[] eArr) {
return copyFromElements(eArr);
}
private final ImmutableSet<Multiset.Entry<E>> createEntrySet() {
return isEmpty() ? ImmutableSet.of() : new EntrySet();
}
public static <E> ImmutableMultiset<E> of() {
return RegularImmutableMultiset.d;
}
@Override // com.google.common.collect.Multiset
@Deprecated
public final int add(E e, int i) {
throw new UnsupportedOperationException();
}
@Override // com.google.common.collect.ImmutableCollection
public ImmutableList<E> asList() {
ImmutableList<E> immutableList = this.asList;
if (immutableList != null) {
return immutableList;
}
ImmutableList<E> asList = super.asList();
this.asList = asList;
return asList;
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return count(obj) > 0;
}
@Override // com.google.common.collect.ImmutableCollection
int copyIntoArray(Object[] objArr, int i) {
UnmodifiableIterator<Multiset.Entry<E>> it = entrySet().iterator();
while (it.hasNext()) {
Multiset.Entry<E> next = it.next();
Arrays.fill(objArr, i, next.getCount() + i, next.a());
i += next.getCount();
}
return i;
}
@Override // com.google.common.collect.Multiset
public abstract ImmutableSet<E> elementSet();
@Override // java.util.Collection, com.google.common.collect.Multiset
public boolean equals(Object obj) {
return Multisets.a(this, obj);
}
abstract Multiset.Entry<E> getEntry(int i);
@Override // java.util.Collection, com.google.common.collect.Multiset
public int hashCode() {
return Sets.a(entrySet());
}
@Override // com.google.common.collect.Multiset
@Deprecated
public final int remove(Object obj, int i) {
throw new UnsupportedOperationException();
}
@Override // com.google.common.collect.Multiset
@Deprecated
public final int setCount(E e, int i) {
throw new UnsupportedOperationException();
}
@Override // java.util.AbstractCollection
public String toString() {
return entrySet().toString();
}
@Override // com.google.common.collect.ImmutableCollection
Object writeReplace() {
return new SerializedForm(this);
}
public static <E> ImmutableMultiset<E> copyOf(Iterable<? extends E> iterable) {
if (iterable instanceof ImmutableMultiset) {
ImmutableMultiset<E> immutableMultiset = (ImmutableMultiset) iterable;
if (!immutableMultiset.isPartialView()) {
return immutableMultiset;
}
}
Builder builder = new Builder(Multisets.b(iterable));
builder.a((Iterable) iterable);
return builder.a();
}
public static <E> ImmutableMultiset<E> of(E e) {
return copyFromElements(e);
}
@Override // com.google.common.collect.Multiset
public ImmutableSet<Multiset.Entry<E>> entrySet() {
ImmutableSet<Multiset.Entry<E>> immutableSet = this.entrySet;
if (immutableSet != null) {
return immutableSet;
}
ImmutableSet<Multiset.Entry<E>> createEntrySet = createEntrySet();
this.entrySet = createEntrySet;
return createEntrySet;
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
public UnmodifiableIterator<E> iterator() {
final UnmodifiableIterator<Multiset.Entry<E>> it = entrySet().iterator();
return new UnmodifiableIterator<E>(this) { // from class: com.google.common.collect.ImmutableMultiset.1
int a;
E b;
@Override // java.util.Iterator
public boolean hasNext() {
return this.a > 0 || it.hasNext();
}
@Override // java.util.Iterator
public E next() {
if (this.a <= 0) {
Multiset.Entry entry = (Multiset.Entry) it.next();
this.b = (E) entry.a();
this.a = entry.getCount();
}
this.a--;
return this.b;
}
};
}
@Override // com.google.common.collect.Multiset
@Deprecated
public final boolean setCount(E e, int i, int i2) {
throw new UnsupportedOperationException();
}
public static <E> ImmutableMultiset<E> of(E e, E e2) {
return copyFromElements(e, e2);
}
public static <E> ImmutableMultiset<E> of(E e, E e2, E e3) {
return copyFromElements(e, e2, e3);
}
public static <E> ImmutableMultiset<E> of(E e, E e2, E e3, E e4) {
return copyFromElements(e, e2, e3, e4);
}
public static <E> ImmutableMultiset<E> of(E e, E e2, E e3, E e4, E e5) {
return copyFromElements(e, e2, e3, e4, e5);
}
public static <E> ImmutableMultiset<E> of(E e, E e2, E e3, E e4, E e5, E e6, E... eArr) {
return new Builder().a((Builder) e).a((Builder<E>) e2).a((Builder<E>) e3).a((Builder<E>) e4).a((Builder<E>) e5).a((Builder<E>) e6).a((Object[]) eArr).a();
}
public static <E> ImmutableMultiset<E> copyOf(Iterator<? extends E> it) {
return new Builder().a((Iterator) it).a();
}
}

View File

@@ -0,0 +1,7 @@
package com.google.common.collect;
/* loaded from: classes.dex */
abstract class ImmutableMultisetGwtSerializationDependencies<E> extends ImmutableCollection<E> {
ImmutableMultisetGwtSerializationDependencies() {
}
}

View File

@@ -0,0 +1,238 @@
package com.google.common.collect;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.SortedLists;
import java.io.Serializable;
import java.lang.Comparable;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
/* loaded from: classes.dex */
public class ImmutableRangeMap<K extends Comparable<?>, V> implements RangeMap<K, V>, Serializable {
private static final ImmutableRangeMap<Comparable<?>, Object> EMPTY = new ImmutableRangeMap<>(ImmutableList.of(), ImmutableList.of());
private static final long serialVersionUID = 0;
private final transient ImmutableList<Range<K>> ranges;
private final transient ImmutableList<V> values;
private static class SerializedForm<K extends Comparable<?>, V> implements Serializable {
private final ImmutableMap<Range<K>, V> a;
SerializedForm(ImmutableMap<Range<K>, V> immutableMap) {
this.a = immutableMap;
}
Object a() {
Builder builder = new Builder();
UnmodifiableIterator<Map.Entry<Range<K>, V>> it = this.a.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Range<K>, V> next = it.next();
builder.a(next.getKey(), next.getValue());
}
return builder.a();
}
Object readResolve() {
return this.a.isEmpty() ? ImmutableRangeMap.of() : a();
}
}
ImmutableRangeMap(ImmutableList<Range<K>> immutableList, ImmutableList<V> immutableList2) {
this.ranges = immutableList;
this.values = immutableList2;
}
public static <K extends Comparable<?>, V> Builder<K, V> builder() {
return new Builder<>();
}
public static <K extends Comparable<?>, V> ImmutableRangeMap<K, V> copyOf(RangeMap<K, ? extends V> rangeMap) {
if (rangeMap instanceof ImmutableRangeMap) {
return (ImmutableRangeMap) rangeMap;
}
Map<Range<K>, ? extends V> asMapOfRanges = rangeMap.asMapOfRanges();
ImmutableList.Builder builder = new ImmutableList.Builder(asMapOfRanges.size());
ImmutableList.Builder builder2 = new ImmutableList.Builder(asMapOfRanges.size());
for (Map.Entry<Range<K>, ? extends V> entry : asMapOfRanges.entrySet()) {
builder.a((ImmutableList.Builder) entry.getKey());
builder2.a((ImmutableList.Builder) entry.getValue());
}
return new ImmutableRangeMap<>(builder.a(), builder2.a());
}
public static <K extends Comparable<?>, V> ImmutableRangeMap<K, V> of() {
return (ImmutableRangeMap<K, V>) EMPTY;
}
@Deprecated
public void clear() {
throw new UnsupportedOperationException();
}
public boolean equals(Object obj) {
if (obj instanceof RangeMap) {
return asMapOfRanges().equals(((RangeMap) obj).asMapOfRanges());
}
return false;
}
public V get(K k) {
int a = SortedLists.a(this.ranges, (Function<? super E, Cut>) Range.lowerBoundFn(), Cut.c(k), SortedLists.KeyPresentBehavior.ANY_PRESENT, SortedLists.KeyAbsentBehavior.NEXT_LOWER);
if (a != -1 && this.ranges.get(a).contains(k)) {
return this.values.get(a);
}
return null;
}
public Map.Entry<Range<K>, V> getEntry(K k) {
int a = SortedLists.a(this.ranges, (Function<? super E, Cut>) Range.lowerBoundFn(), Cut.c(k), SortedLists.KeyPresentBehavior.ANY_PRESENT, SortedLists.KeyAbsentBehavior.NEXT_LOWER);
if (a == -1) {
return null;
}
Range<K> range = this.ranges.get(a);
if (range.contains(k)) {
return Maps.a(range, this.values.get(a));
}
return null;
}
public int hashCode() {
return asMapOfRanges().hashCode();
}
@Deprecated
public void put(Range<K> range, V v) {
throw new UnsupportedOperationException();
}
@Deprecated
public void putAll(RangeMap<K, V> rangeMap) {
throw new UnsupportedOperationException();
}
@Deprecated
public void putCoalescing(Range<K> range, V v) {
throw new UnsupportedOperationException();
}
@Deprecated
public void remove(Range<K> range) {
throw new UnsupportedOperationException();
}
public Range<K> span() {
if (this.ranges.isEmpty()) {
throw new NoSuchElementException();
}
return Range.create(this.ranges.get(0).lowerBound, this.ranges.get(r1.size() - 1).upperBound);
}
public String toString() {
return asMapOfRanges().toString();
}
Object writeReplace() {
return new SerializedForm(asMapOfRanges());
}
public static <K extends Comparable<?>, V> ImmutableRangeMap<K, V> of(Range<K> range, V v) {
return new ImmutableRangeMap<>(ImmutableList.of(range), ImmutableList.of(v));
}
@Override //
/* renamed from: asDescendingMapOfRanges, reason: merged with bridge method [inline-methods] */
public ImmutableMap<Range<K>, V> mo7asDescendingMapOfRanges() {
return this.ranges.isEmpty() ? ImmutableMap.of() : new ImmutableSortedMap(new RegularImmutableSortedSet(this.ranges.reverse(), Range.rangeLexOrdering().b()), this.values.reverse());
}
@Override // com.google.common.collect.RangeMap
public ImmutableMap<Range<K>, V> asMapOfRanges() {
return this.ranges.isEmpty() ? ImmutableMap.of() : new ImmutableSortedMap(new RegularImmutableSortedSet(this.ranges, Range.rangeLexOrdering()), this.values);
}
@Override //
/* renamed from: subRangeMap */
public ImmutableRangeMap<K, V> mo8subRangeMap(final Range<K> range) {
Preconditions.a(range);
if (range.isEmpty()) {
return of();
}
if (this.ranges.isEmpty() || range.encloses(span())) {
return this;
}
final int a = SortedLists.a(this.ranges, (Function<? super E, Cut<K>>) Range.upperBoundFn(), range.lowerBound, SortedLists.KeyPresentBehavior.FIRST_AFTER, SortedLists.KeyAbsentBehavior.NEXT_HIGHER);
int a2 = SortedLists.a(this.ranges, (Function<? super E, Cut<K>>) Range.lowerBoundFn(), range.upperBound, SortedLists.KeyPresentBehavior.ANY_PRESENT, SortedLists.KeyAbsentBehavior.NEXT_HIGHER);
if (a >= a2) {
return of();
}
final int i = a2 - a;
return (ImmutableRangeMap<K, V>) new ImmutableRangeMap<K, V>(this, new ImmutableList<Range<K>>() { // from class: com.google.common.collect.ImmutableRangeMap.1
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public int size() {
return i;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // java.util.List
public Range<K> get(int i2) {
Preconditions.a(i2, i);
return (i2 == 0 || i2 == i + (-1)) ? ((Range) ImmutableRangeMap.this.ranges.get(i2 + a)).intersection(range) : (Range) ImmutableRangeMap.this.ranges.get(i2 + a);
}
}, this.values.subList(a, a2)) { // from class: com.google.common.collect.ImmutableRangeMap.2
@Override // com.google.common.collect.ImmutableRangeMap
/* renamed from: asDescendingMapOfRanges */
public /* bridge */ /* synthetic */ Map mo7asDescendingMapOfRanges() {
return super.mo7asDescendingMapOfRanges();
}
@Override // com.google.common.collect.ImmutableRangeMap, com.google.common.collect.RangeMap
public /* bridge */ /* synthetic */ Map asMapOfRanges() {
return super.asMapOfRanges();
}
@Override // com.google.common.collect.ImmutableRangeMap
/* renamed from: subRangeMap, reason: merged with bridge method [inline-methods] */
public ImmutableRangeMap<K, V> mo8subRangeMap(Range<K> range2) {
return range.isConnected(range2) ? this.mo8subRangeMap((Range) range2.intersection(range)) : ImmutableRangeMap.of();
}
};
}
public static final class Builder<K extends Comparable<?>, V> {
private final List<Map.Entry<Range<K>, V>> a = Lists.a();
public Builder<K, V> a(Range<K> range, V v) {
Preconditions.a(range);
Preconditions.a(v);
Preconditions.a(!range.isEmpty(), "Range must not be empty, but was %s", range);
this.a.add(Maps.a(range, v));
return this;
}
public ImmutableRangeMap<K, V> a() {
Collections.sort(this.a, Range.rangeLexOrdering().a());
ImmutableList.Builder builder = new ImmutableList.Builder(this.a.size());
ImmutableList.Builder builder2 = new ImmutableList.Builder(this.a.size());
for (int i = 0; i < this.a.size(); i++) {
Range<K> key = this.a.get(i).getKey();
if (i > 0) {
Range<K> key2 = this.a.get(i - 1).getKey();
if (key.isConnected(key2) && !key.intersection(key2).isEmpty()) {
throw new IllegalArgumentException("Overlapping ranges: range " + key2 + " overlaps with entry " + key);
}
}
builder.a((ImmutableList.Builder) key);
builder2.a((ImmutableList.Builder) this.a.get(i).getValue());
}
return new ImmutableRangeMap<>(builder.a(), builder2.a());
}
}
}

View File

@@ -0,0 +1,550 @@
package com.google.common.collect;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.SortedLists;
import com.google.common.primitives.Ints;
import java.io.Serializable;
import java.lang.Comparable;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
/* loaded from: classes.dex */
public final class ImmutableRangeSet<C extends Comparable> extends AbstractRangeSet<C> implements Serializable {
private transient ImmutableRangeSet<C> complement;
private final transient ImmutableList<Range<C>> ranges;
private static final ImmutableRangeSet<Comparable<?>> EMPTY = new ImmutableRangeSet<>(ImmutableList.of());
private static final ImmutableRangeSet<Comparable<?>> ALL = new ImmutableRangeSet<>(ImmutableList.of(Range.all()));
private final class AsSet extends ImmutableSortedSet<C> {
private final DiscreteDomain<C> a;
private transient Integer b;
AsSet(DiscreteDomain<C> discreteDomain) {
super(Ordering.c());
this.a = discreteDomain;
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
if (obj == null) {
return false;
}
try {
return ImmutableRangeSet.this.contains((Comparable) obj);
} catch (ClassCastException unused) {
return false;
}
}
@Override // com.google.common.collect.ImmutableSortedSet
ImmutableSortedSet<C> createDescendingSet() {
return new DescendingImmutableSortedSet(this);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableSortedSet
int indexOf(Object obj) {
if (!contains(obj)) {
return -1;
}
Comparable comparable = (Comparable) obj;
long j = 0;
UnmodifiableIterator it = ImmutableRangeSet.this.ranges.iterator();
while (it.hasNext()) {
if (((Range) it.next()).contains(comparable)) {
return Ints.b(j + ContiguousSet.create(r3, this.a).indexOf(comparable));
}
j += ContiguousSet.create(r3, this.a).size();
}
throw new AssertionError("impossible");
}
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return ImmutableRangeSet.this.ranges.isPartialView();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
Integer num = this.b;
if (num == null) {
long j = 0;
UnmodifiableIterator it = ImmutableRangeSet.this.ranges.iterator();
while (it.hasNext()) {
j += ContiguousSet.create((Range) it.next(), this.a).size();
if (j >= 2147483647L) {
break;
}
}
num = Integer.valueOf(Ints.b(j));
this.b = num;
}
return num.intValue();
}
@Override // java.util.AbstractCollection
public String toString() {
return ImmutableRangeSet.this.ranges.toString();
}
@Override // com.google.common.collect.ImmutableSortedSet, com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection
Object writeReplace() {
return new AsSetSerializedForm(ImmutableRangeSet.this.ranges, this.a);
}
ImmutableSortedSet<C> a(Range<C> range) {
return ImmutableRangeSet.this.m10subRangeSet((Range) range).asSet(this.a);
}
@Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet
public UnmodifiableIterator<C> descendingIterator() {
return new AbstractIterator<C>() { // from class: com.google.common.collect.ImmutableRangeSet.AsSet.2
final Iterator<Range<C>> c;
Iterator<C> d = Iterators.a();
{
this.c = ImmutableRangeSet.this.ranges.reverse().iterator();
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.AbstractIterator
public C a() {
while (!this.d.hasNext()) {
if (!this.c.hasNext()) {
return (C) b();
}
this.d = ContiguousSet.create(this.c.next(), AsSet.this.a).descendingIterator();
}
return this.d.next();
}
};
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableSortedSet
public ImmutableSortedSet<C> headSetImpl(C c, boolean z) {
return a(Range.upTo(c, BoundType.forBoolean(z)));
}
@Override // com.google.common.collect.ImmutableSortedSet, com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
public UnmodifiableIterator<C> iterator() {
return new AbstractIterator<C>() { // from class: com.google.common.collect.ImmutableRangeSet.AsSet.1
final Iterator<Range<C>> c;
Iterator<C> d = Iterators.a();
{
this.c = ImmutableRangeSet.this.ranges.iterator();
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.AbstractIterator
public C a() {
while (!this.d.hasNext()) {
if (!this.c.hasNext()) {
return (C) b();
}
this.d = ContiguousSet.create(this.c.next(), AsSet.this.a).iterator();
}
return this.d.next();
}
};
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableSortedSet
public ImmutableSortedSet<C> subSetImpl(C c, boolean z, C c2, boolean z2) {
return (z || z2 || Range.compareOrThrow(c, c2) != 0) ? a(Range.range(c, BoundType.forBoolean(z), c2, BoundType.forBoolean(z2))) : ImmutableSortedSet.of();
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.ImmutableSortedSet
public ImmutableSortedSet<C> tailSetImpl(C c, boolean z) {
return a(Range.downTo(c, BoundType.forBoolean(z)));
}
}
private static class AsSetSerializedForm<C extends Comparable> implements Serializable {
private final ImmutableList<Range<C>> a;
private final DiscreteDomain<C> b;
AsSetSerializedForm(ImmutableList<Range<C>> immutableList, DiscreteDomain<C> discreteDomain) {
this.a = immutableList;
this.b = discreteDomain;
}
Object readResolve() {
return new ImmutableRangeSet(this.a).asSet(this.b);
}
}
private final class ComplementRanges extends ImmutableList<Range<C>> {
private final boolean a;
private final boolean b;
private final int c;
/* JADX WARN: Multi-variable type inference failed */
ComplementRanges() {
this.a = ((Range) ImmutableRangeSet.this.ranges.get(0)).hasLowerBound();
this.b = ((Range) Iterables.b(ImmutableRangeSet.this.ranges)).hasUpperBound();
int size = ImmutableRangeSet.this.ranges.size() - 1;
size = this.a ? size + 1 : size;
this.c = this.b ? size + 1 : size;
}
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public int size() {
return this.c;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // java.util.List
public Range<C> get(int i) {
Preconditions.a(i, this.c);
return Range.create(this.a ? i == 0 ? Cut.g() : ((Range) ImmutableRangeSet.this.ranges.get(i - 1)).upperBound : ((Range) ImmutableRangeSet.this.ranges.get(i)).upperBound, (this.b && i == this.c + (-1)) ? Cut.f() : ((Range) ImmutableRangeSet.this.ranges.get(i + (!this.a ? 1 : 0))).lowerBound);
}
}
private static final class SerializedForm<C extends Comparable> implements Serializable {
private final ImmutableList<Range<C>> a;
SerializedForm(ImmutableList<Range<C>> immutableList) {
this.a = immutableList;
}
Object readResolve() {
return this.a.isEmpty() ? ImmutableRangeSet.of() : this.a.equals(ImmutableList.of(Range.all())) ? ImmutableRangeSet.all() : new ImmutableRangeSet(this.a);
}
}
ImmutableRangeSet(ImmutableList<Range<C>> immutableList) {
this.ranges = immutableList;
}
static <C extends Comparable> ImmutableRangeSet<C> all() {
return ALL;
}
public static <C extends Comparable<?>> Builder<C> builder() {
return new Builder<>();
}
public static <C extends Comparable> ImmutableRangeSet<C> copyOf(RangeSet<C> rangeSet) {
Preconditions.a(rangeSet);
if (rangeSet.isEmpty()) {
return of();
}
if (rangeSet.encloses(Range.all())) {
return all();
}
if (rangeSet instanceof ImmutableRangeSet) {
ImmutableRangeSet<C> immutableRangeSet = (ImmutableRangeSet) rangeSet;
if (!immutableRangeSet.isPartialView()) {
return immutableRangeSet;
}
}
return new ImmutableRangeSet<>(ImmutableList.copyOf((Collection) rangeSet.asRanges()));
}
private ImmutableList<Range<C>> intersectRanges(final Range<C> range) {
if (this.ranges.isEmpty() || range.isEmpty()) {
return ImmutableList.of();
}
if (range.encloses(span())) {
return this.ranges;
}
final int a = range.hasLowerBound() ? SortedLists.a(this.ranges, (Function<? super E, Cut<C>>) Range.upperBoundFn(), range.lowerBound, SortedLists.KeyPresentBehavior.FIRST_AFTER, SortedLists.KeyAbsentBehavior.NEXT_HIGHER) : 0;
final int a2 = (range.hasUpperBound() ? SortedLists.a(this.ranges, (Function<? super E, Cut<C>>) Range.lowerBoundFn(), range.upperBound, SortedLists.KeyPresentBehavior.FIRST_PRESENT, SortedLists.KeyAbsentBehavior.NEXT_HIGHER) : this.ranges.size()) - a;
return a2 == 0 ? ImmutableList.of() : (ImmutableList<Range<C>>) new ImmutableList<Range<C>>() { // from class: com.google.common.collect.ImmutableRangeSet.1
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public int size() {
return a2;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // java.util.List
public Range<C> get(int i) {
Preconditions.a(i, a2);
return (i == 0 || i == a2 + (-1)) ? ((Range) ImmutableRangeSet.this.ranges.get(i + a)).intersection(range) : (Range) ImmutableRangeSet.this.ranges.get(i + a);
}
};
}
public static <C extends Comparable> ImmutableRangeSet<C> of() {
return EMPTY;
}
public static <C extends Comparable<?>> ImmutableRangeSet<C> unionOf(Iterable<Range<C>> iterable) {
return copyOf(TreeRangeSet.create(iterable));
}
@Override // com.google.common.collect.AbstractRangeSet
@Deprecated
public void add(Range<C> range) {
throw new UnsupportedOperationException();
}
@Override // com.google.common.collect.AbstractRangeSet
@Deprecated
public void addAll(RangeSet<C> rangeSet) {
throw new UnsupportedOperationException();
}
public ImmutableSortedSet<C> asSet(DiscreteDomain<C> discreteDomain) {
Preconditions.a(discreteDomain);
if (isEmpty()) {
return ImmutableSortedSet.of();
}
Range<C> canonical = span().canonical(discreteDomain);
if (!canonical.hasLowerBound()) {
throw new IllegalArgumentException("Neither the DiscreteDomain nor this range set are bounded below");
}
if (!canonical.hasUpperBound()) {
try {
discreteDomain.a();
} catch (NoSuchElementException unused) {
throw new IllegalArgumentException("Neither the DiscreteDomain nor this range set are bounded above");
}
}
return new AsSet(discreteDomain);
}
@Override // com.google.common.collect.AbstractRangeSet
public /* bridge */ /* synthetic */ void clear() {
super.clear();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractRangeSet
public /* bridge */ /* synthetic */ boolean contains(Comparable comparable) {
return super.contains(comparable);
}
public ImmutableRangeSet<C> difference(RangeSet<C> rangeSet) {
TreeRangeSet create = TreeRangeSet.create(this);
create.removeAll(rangeSet);
return copyOf(create);
}
@Override // com.google.common.collect.AbstractRangeSet, com.google.common.collect.RangeSet
public boolean encloses(Range<C> range) {
int a = SortedLists.a(this.ranges, Range.lowerBoundFn(), range.lowerBound, Ordering.c(), SortedLists.KeyPresentBehavior.ANY_PRESENT, SortedLists.KeyAbsentBehavior.NEXT_LOWER);
return a != -1 && this.ranges.get(a).encloses(range);
}
@Override // com.google.common.collect.AbstractRangeSet
public /* bridge */ /* synthetic */ boolean enclosesAll(RangeSet rangeSet) {
return super.enclosesAll(rangeSet);
}
@Override // com.google.common.collect.AbstractRangeSet
public /* bridge */ /* synthetic */ boolean equals(Object obj) {
return super.equals(obj);
}
public ImmutableRangeSet<C> intersection(RangeSet<C> rangeSet) {
TreeRangeSet create = TreeRangeSet.create(this);
create.removeAll(rangeSet.complement());
return copyOf(create);
}
@Override // com.google.common.collect.AbstractRangeSet
public boolean intersects(Range<C> range) {
int a = SortedLists.a(this.ranges, Range.lowerBoundFn(), range.lowerBound, Ordering.c(), SortedLists.KeyPresentBehavior.ANY_PRESENT, SortedLists.KeyAbsentBehavior.NEXT_HIGHER);
if (a < this.ranges.size() && this.ranges.get(a).isConnected(range) && !this.ranges.get(a).intersection(range).isEmpty()) {
return true;
}
if (a > 0) {
int i = a - 1;
if (this.ranges.get(i).isConnected(range) && !this.ranges.get(i).intersection(range).isEmpty()) {
return true;
}
}
return false;
}
@Override // com.google.common.collect.AbstractRangeSet, com.google.common.collect.RangeSet
public boolean isEmpty() {
return this.ranges.isEmpty();
}
boolean isPartialView() {
return this.ranges.isPartialView();
}
@Override // com.google.common.collect.AbstractRangeSet
public Range<C> rangeContaining(C c) {
int a = SortedLists.a(this.ranges, Range.lowerBoundFn(), Cut.c(c), Ordering.c(), SortedLists.KeyPresentBehavior.ANY_PRESENT, SortedLists.KeyAbsentBehavior.NEXT_LOWER);
if (a == -1) {
return null;
}
Range<C> range = this.ranges.get(a);
if (range.contains(c)) {
return range;
}
return null;
}
@Override // com.google.common.collect.AbstractRangeSet
@Deprecated
public void remove(Range<C> range) {
throw new UnsupportedOperationException();
}
@Override // com.google.common.collect.AbstractRangeSet, com.google.common.collect.RangeSet
@Deprecated
public void removeAll(RangeSet<C> rangeSet) {
throw new UnsupportedOperationException();
}
public Range<C> span() {
if (this.ranges.isEmpty()) {
throw new NoSuchElementException();
}
return Range.create(this.ranges.get(0).lowerBound, this.ranges.get(r1.size() - 1).upperBound);
}
public ImmutableRangeSet<C> union(RangeSet<C> rangeSet) {
return unionOf(Iterables.a((Iterable) asRanges(), (Iterable) rangeSet.asRanges()));
}
Object writeReplace() {
return new SerializedForm(this.ranges);
}
public static class Builder<C extends Comparable<?>> {
private final List<Range<C>> a = Lists.a();
public Builder<C> a(Range<C> range) {
Preconditions.a(!range.isEmpty(), "range must not be empty, but was %s", range);
this.a.add(range);
return this;
}
public Builder<C> a(Iterable<Range<C>> iterable) {
Iterator<Range<C>> it = iterable.iterator();
while (it.hasNext()) {
a(it.next());
}
return this;
}
public ImmutableRangeSet<C> a() {
ImmutableList.Builder builder = new ImmutableList.Builder(this.a.size());
Collections.sort(this.a, Range.rangeLexOrdering());
PeekingIterator f = Iterators.f(this.a.iterator());
while (f.hasNext()) {
Range range = (Range) f.next();
while (f.hasNext()) {
Range<C> range2 = (Range) f.peek();
if (range.isConnected(range2)) {
Preconditions.a(range.intersection(range2).isEmpty(), "Overlapping ranges not permitted but found %s overlapping %s", range, range2);
range = range.span((Range) f.next());
}
}
builder.a((ImmutableList.Builder) range);
}
ImmutableList a = builder.a();
if (a.isEmpty()) {
return ImmutableRangeSet.of();
}
if (a.size() == 1 && ((Range) Iterables.c(a)).equals(Range.all())) {
return ImmutableRangeSet.all();
}
return new ImmutableRangeSet<>(a);
}
}
public static <C extends Comparable> ImmutableRangeSet<C> of(Range<C> range) {
Preconditions.a(range);
return range.isEmpty() ? of() : range.equals(Range.all()) ? all() : new ImmutableRangeSet<>(ImmutableList.of(range));
}
@Override // com.google.common.collect.AbstractRangeSet
@Deprecated
public void addAll(Iterable<Range<C>> iterable) {
throw new UnsupportedOperationException();
}
/* renamed from: asDescendingSetOfRanges, reason: merged with bridge method [inline-methods] */
public ImmutableSet<Range<C>> m9asDescendingSetOfRanges() {
return this.ranges.isEmpty() ? ImmutableSet.of() : new RegularImmutableSortedSet(this.ranges.reverse(), Range.rangeLexOrdering().b());
}
@Override // com.google.common.collect.RangeSet
public ImmutableSet<Range<C>> asRanges() {
return this.ranges.isEmpty() ? ImmutableSet.of() : new RegularImmutableSortedSet(this.ranges, Range.rangeLexOrdering());
}
@Override // com.google.common.collect.RangeSet
public ImmutableRangeSet<C> complement() {
ImmutableRangeSet<C> immutableRangeSet = this.complement;
if (immutableRangeSet != null) {
return immutableRangeSet;
}
if (this.ranges.isEmpty()) {
ImmutableRangeSet<C> all = all();
this.complement = all;
return all;
}
if (this.ranges.size() == 1 && this.ranges.get(0).equals(Range.all())) {
ImmutableRangeSet<C> of = of();
this.complement = of;
return of;
}
ImmutableRangeSet<C> immutableRangeSet2 = new ImmutableRangeSet<>(new ComplementRanges(), this);
this.complement = immutableRangeSet2;
return immutableRangeSet2;
}
@Override // com.google.common.collect.AbstractRangeSet
public /* bridge */ /* synthetic */ boolean enclosesAll(Iterable iterable) {
return super.enclosesAll(iterable);
}
@Override // com.google.common.collect.AbstractRangeSet
@Deprecated
public void removeAll(Iterable<Range<C>> iterable) {
throw new UnsupportedOperationException();
}
/* renamed from: subRangeSet, reason: merged with bridge method [inline-methods] */
public ImmutableRangeSet<C> m10subRangeSet(Range<C> range) {
if (!isEmpty()) {
Range<C> span = span();
if (range.encloses(span)) {
return this;
}
if (range.isConnected(span)) {
return new ImmutableRangeSet<>(intersectRanges(range));
}
}
return of();
}
private ImmutableRangeSet(ImmutableList<Range<C>> immutableList, ImmutableRangeSet<C> immutableRangeSet) {
this.ranges = immutableList;
this.complement = immutableRangeSet;
}
public static <C extends Comparable<?>> ImmutableRangeSet<C> copyOf(Iterable<Range<C>> iterable) {
Builder builder = new Builder();
builder.a(iterable);
return builder.a();
}
}

View File

@@ -0,0 +1,289 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableCollection;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import java.util.SortedSet;
/* loaded from: classes.dex */
public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements Set<E> {
private static final int CUTOFF = 751619276;
private static final double DESIRED_LOAD_FACTOR = 0.7d;
static final int MAX_TABLE_SIZE = 1073741824;
private transient ImmutableList<E> asList;
public static class Builder<E> extends ImmutableCollection.ArrayBasedBuilder<E> {
public Builder() {
this(4);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableCollection.Builder
public /* bridge */ /* synthetic */ ImmutableCollection.Builder a(Object obj) {
return a((Builder<E>) obj);
}
Builder(int i) {
super(i);
}
@Override // com.google.common.collect.ImmutableCollection.ArrayBasedBuilder, com.google.common.collect.ImmutableCollection.Builder
public Builder<E> a(E e) {
super.a((Builder<E>) e);
return this;
}
@Override // com.google.common.collect.ImmutableCollection.ArrayBasedBuilder, com.google.common.collect.ImmutableCollection.Builder
public Builder<E> a(E... eArr) {
super.a((Object[]) eArr);
return this;
}
@Override // com.google.common.collect.ImmutableCollection.Builder
public Builder<E> a(Iterator<? extends E> it) {
super.a((Iterator) it);
return this;
}
public ImmutableSet<E> a() {
ImmutableSet<E> construct = ImmutableSet.construct(this.b, this.a);
this.b = construct.size();
this.c = true;
return construct;
}
}
static abstract class Indexed<E> extends ImmutableSet<E> {
Indexed() {
}
@Override // com.google.common.collect.ImmutableSet
ImmutableList<E> createAsList() {
return new ImmutableList<E>() { // from class: com.google.common.collect.ImmutableSet.Indexed.1
@Override // java.util.List
public E get(int i) {
return (E) Indexed.this.get(i);
}
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return Indexed.this.isPartialView();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public int size() {
return Indexed.this.size();
}
};
}
abstract E get(int i);
@Override // com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
public UnmodifiableIterator<E> iterator() {
return asList().iterator();
}
}
private static class SerializedForm implements Serializable {
final Object[] a;
SerializedForm(Object[] objArr) {
this.a = objArr;
}
Object readResolve() {
return ImmutableSet.copyOf(this.a);
}
}
ImmutableSet() {
}
public static <E> Builder<E> builder() {
return new Builder<>();
}
static int chooseTableSize(int i) {
if (i >= CUTOFF) {
Preconditions.a(i < MAX_TABLE_SIZE, "collection too large");
return MAX_TABLE_SIZE;
}
int highestOneBit = Integer.highestOneBit(i - 1) << 1;
while (highestOneBit * DESIRED_LOAD_FACTOR < i) {
highestOneBit <<= 1;
}
return highestOneBit;
}
/* JADX INFO: Access modifiers changed from: private */
public static <E> ImmutableSet<E> construct(int i, Object... objArr) {
if (i == 0) {
return of();
}
if (i == 1) {
return of(objArr[0]);
}
int chooseTableSize = chooseTableSize(i);
Object[] objArr2 = new Object[chooseTableSize];
int i2 = chooseTableSize - 1;
int i3 = 0;
int i4 = 0;
for (int i5 = 0; i5 < i; i5++) {
Object obj = objArr[i5];
ObjectArrays.a(obj, i5);
int hashCode = obj.hashCode();
int a = Hashing.a(hashCode);
while (true) {
int i6 = a & i2;
Object obj2 = objArr2[i6];
if (obj2 == null) {
objArr[i4] = obj;
objArr2[i6] = obj;
i3 += hashCode;
i4++;
break;
}
if (obj2.equals(obj)) {
break;
}
a++;
}
}
Arrays.fill(objArr, i4, i, (Object) null);
if (i4 == 1) {
return new SingletonImmutableSet(objArr[0], i3);
}
if (chooseTableSize(i4) < chooseTableSize / 2) {
return construct(i4, objArr);
}
if (i4 < objArr.length / 2) {
objArr = Arrays.copyOf(objArr, i4);
}
return new RegularImmutableSet(objArr, i3, objArr2, i2, i4);
}
public static <E> ImmutableSet<E> copyOf(Collection<? extends E> collection) {
if ((collection instanceof ImmutableSet) && !(collection instanceof SortedSet)) {
ImmutableSet<E> immutableSet = (ImmutableSet) collection;
if (!immutableSet.isPartialView()) {
return immutableSet;
}
}
Object[] array = collection.toArray();
return construct(array.length, array);
}
public static <E> ImmutableSet<E> of() {
return RegularImmutableSet.f;
}
@Override // com.google.common.collect.ImmutableCollection
public ImmutableList<E> asList() {
ImmutableList<E> immutableList = this.asList;
if (immutableList != null) {
return immutableList;
}
ImmutableList<E> createAsList = createAsList();
this.asList = createAsList;
return createAsList;
}
ImmutableList<E> createAsList() {
return ImmutableList.asImmutableList(toArray());
}
@Override // java.util.Collection, java.util.Set
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if ((obj instanceof ImmutableSet) && isHashCodeFast() && ((ImmutableSet) obj).isHashCodeFast() && hashCode() != obj.hashCode()) {
return false;
}
return Sets.a(this, obj);
}
@Override // java.util.Collection, java.util.Set
public int hashCode() {
return Sets.a(this);
}
boolean isHashCodeFast() {
return false;
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
public abstract UnmodifiableIterator<E> iterator();
@Override // com.google.common.collect.ImmutableCollection
Object writeReplace() {
return new SerializedForm(toArray());
}
public static <E> ImmutableSet<E> of(E e) {
return new SingletonImmutableSet(e);
}
public static <E> ImmutableSet<E> of(E e, E e2) {
return construct(2, e, e2);
}
public static <E> ImmutableSet<E> of(E e, E e2, E e3) {
return construct(3, e, e2, e3);
}
public static <E> ImmutableSet<E> of(E e, E e2, E e3, E e4) {
return construct(4, e, e2, e3, e4);
}
public static <E> ImmutableSet<E> copyOf(Iterable<? extends E> iterable) {
if (iterable instanceof Collection) {
return copyOf((Collection) iterable);
}
return copyOf(iterable.iterator());
}
public static <E> ImmutableSet<E> of(E e, E e2, E e3, E e4, E e5) {
return construct(5, e, e2, e3, e4, e5);
}
@SafeVarargs
public static <E> ImmutableSet<E> of(E e, E e2, E e3, E e4, E e5, E e6, E... eArr) {
Object[] objArr = new Object[eArr.length + 6];
objArr[0] = e;
objArr[1] = e2;
objArr[2] = e3;
objArr[3] = e4;
objArr[4] = e5;
objArr[5] = e6;
System.arraycopy(eArr, 0, objArr, 6, eArr.length);
return construct(objArr.length, objArr);
}
public static <E> ImmutableSet<E> copyOf(Iterator<? extends E> it) {
if (!it.hasNext()) {
return of();
}
E next = it.next();
if (!it.hasNext()) {
return of((Object) next);
}
return new Builder().a((Builder) next).a((Iterator) it).a();
}
public static <E> ImmutableSet<E> copyOf(E[] eArr) {
int length = eArr.length;
if (length == 0) {
return of();
}
if (length != 1) {
return construct(eArr.length, (Object[]) eArr.clone());
}
return of((Object) eArr[0]);
}
}

View File

@@ -0,0 +1,356 @@
package com.google.common.collect;
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Serialization;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Collection;
import java.util.Comparator;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
public class ImmutableSetMultimap<K, V> extends ImmutableMultimap<K, V> implements SetMultimap<K, V> {
private static final long serialVersionUID = 0;
private final transient ImmutableSet<V> emptySet;
private transient ImmutableSet<Map.Entry<K, V>> entries;
private transient ImmutableSetMultimap<V, K> inverse;
public static final class Builder<K, V> extends ImmutableMultimap.Builder<K, V> {
public Builder() {
super(MultimapBuilder.a().c().b());
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultimap.Builder
public /* bridge */ /* synthetic */ ImmutableMultimap.Builder a(Object obj, Object obj2) {
a((Builder<K, V>) obj, obj2);
return this;
}
@Override // com.google.common.collect.ImmutableMultimap.Builder
public /* bridge */ /* synthetic */ ImmutableMultimap.Builder a(Map.Entry entry) {
a(entry);
return this;
}
@Override // com.google.common.collect.ImmutableMultimap.Builder
public Builder<K, V> a(K k, V v) {
Multimap<K, V> multimap = this.a;
Preconditions.a(k);
Preconditions.a(v);
multimap.put(k, v);
return this;
}
@Override // com.google.common.collect.ImmutableMultimap.Builder
public Builder<K, V> a(Map.Entry<? extends K, ? extends V> entry) {
Multimap<K, V> multimap = this.a;
K key = entry.getKey();
Preconditions.a(key);
V value = entry.getValue();
Preconditions.a(value);
multimap.put(key, value);
return this;
}
@Override // com.google.common.collect.ImmutableMultimap.Builder
public Builder<K, V> a(Iterable<? extends Map.Entry<? extends K, ? extends V>> iterable) {
super.a((Iterable) iterable);
return this;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultimap.Builder
public ImmutableSetMultimap<K, V> a() {
if (this.b != null) {
AbstractListMultimap b = MultimapBuilder.a().c().b();
for (Map.Entry entry : Ordering.a(this.b).a().a(this.a.asMap().entrySet())) {
b.putAll(entry.getKey(), (Iterable) entry.getValue());
}
this.a = b;
}
return ImmutableSetMultimap.copyOf(this.a, this.c);
}
}
private static final class EntrySet<K, V> extends ImmutableSet<Map.Entry<K, V>> {
private final transient ImmutableSetMultimap<K, V> a;
EntrySet(ImmutableSetMultimap<K, V> immutableSetMultimap) {
this.a = immutableSetMultimap;
}
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
return this.a.containsEntry(entry.getKey(), entry.getValue());
}
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return false;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return this.a.size();
}
@Override // com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
public UnmodifiableIterator<Map.Entry<K, V>> iterator() {
return this.a.entryIterator();
}
}
ImmutableSetMultimap(ImmutableMap<K, ImmutableSet<V>> immutableMap, int i, Comparator<? super V> comparator) {
super(immutableMap, i);
this.emptySet = emptySet(comparator);
}
public static <K, V> Builder<K, V> builder() {
return new Builder<>();
}
public static <K, V> ImmutableSetMultimap<K, V> copyOf(Multimap<? extends K, ? extends V> multimap) {
return copyOf(multimap, null);
}
private static <V> ImmutableSet<V> emptySet(Comparator<? super V> comparator) {
return comparator == null ? ImmutableSet.of() : ImmutableSortedSet.emptySet(comparator);
}
/* JADX WARN: Multi-variable type inference failed */
private ImmutableSetMultimap<V, K> invert() {
Builder builder = builder();
UnmodifiableIterator it = entries().iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
builder.a((Builder) entry.getValue(), entry.getKey());
}
ImmutableSetMultimap<V, K> a = builder.a();
a.inverse = this;
return a;
}
public static <K, V> ImmutableSetMultimap<K, V> of() {
return EmptyImmutableSetMultimap.a;
}
/* JADX WARN: Multi-variable type inference failed */
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
objectInputStream.defaultReadObject();
Comparator comparator = (Comparator) objectInputStream.readObject();
int readInt = objectInputStream.readInt();
if (readInt < 0) {
throw new InvalidObjectException("Invalid key count " + readInt);
}
ImmutableMap.Builder builder = ImmutableMap.builder();
int i = 0;
for (int i2 = 0; i2 < readInt; i2++) {
Object readObject = objectInputStream.readObject();
int readInt2 = objectInputStream.readInt();
if (readInt2 <= 0) {
throw new InvalidObjectException("Invalid value count " + readInt2);
}
ImmutableSet.Builder valuesBuilder = valuesBuilder(comparator);
for (int i3 = 0; i3 < readInt2; i3++) {
valuesBuilder.a((ImmutableSet.Builder) objectInputStream.readObject());
}
ImmutableSet a = valuesBuilder.a();
if (a.size() != readInt2) {
throw new InvalidObjectException("Duplicate key-value pairs exist for key " + readObject);
}
builder.a(readObject, a);
i += readInt2;
}
try {
ImmutableMultimap.FieldSettersHolder.a.a((Serialization.FieldSetter<ImmutableMultimap>) this, (Object) builder.a());
ImmutableMultimap.FieldSettersHolder.b.a((Serialization.FieldSetter<ImmutableMultimap>) this, i);
ImmutableMultimap.FieldSettersHolder.c.a((Serialization.FieldSetter<ImmutableSetMultimap>) this, (Object) emptySet(comparator));
} catch (IllegalArgumentException e) {
throw ((InvalidObjectException) new InvalidObjectException(e.getMessage()).initCause(e));
}
}
private static <V> ImmutableSet<V> valueSet(Comparator<? super V> comparator, Collection<? extends V> collection) {
return comparator == null ? ImmutableSet.copyOf((Collection) collection) : ImmutableSortedSet.copyOf((Comparator) comparator, (Collection) collection);
}
private static <V> ImmutableSet.Builder<V> valuesBuilder(Comparator<? super V> comparator) {
return comparator == null ? new ImmutableSet.Builder<>() : new ImmutableSortedSet.Builder(comparator);
}
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
objectOutputStream.defaultWriteObject();
objectOutputStream.writeObject(valueComparator());
Serialization.a(this, objectOutputStream);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ ImmutableCollection get(Object obj) {
return get((ImmutableSetMultimap<K, V>) obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.AbstractMultimap
@Deprecated
public /* bridge */ /* synthetic */ ImmutableCollection replaceValues(Object obj, Iterable iterable) {
return replaceValues((ImmutableSetMultimap<K, V>) obj, iterable);
}
Comparator<? super V> valueComparator() {
ImmutableSet<V> immutableSet = this.emptySet;
if (immutableSet instanceof ImmutableSortedSet) {
return ((ImmutableSortedSet) immutableSet).comparator();
}
return null;
}
/* JADX INFO: Access modifiers changed from: private */
public static <K, V> ImmutableSetMultimap<K, V> copyOf(Multimap<? extends K, ? extends V> multimap, Comparator<? super V> comparator) {
Preconditions.a(multimap);
if (multimap.isEmpty() && comparator == null) {
return of();
}
if (multimap instanceof ImmutableSetMultimap) {
ImmutableSetMultimap<K, V> immutableSetMultimap = (ImmutableSetMultimap) multimap;
if (!immutableSetMultimap.isPartialView()) {
return immutableSetMultimap;
}
}
ImmutableMap.Builder builder = new ImmutableMap.Builder(multimap.asMap().size());
int i = 0;
for (Map.Entry<? extends K, Collection<? extends V>> entry : multimap.asMap().entrySet()) {
K key = entry.getKey();
ImmutableSet valueSet = valueSet(comparator, entry.getValue());
if (!valueSet.isEmpty()) {
builder.a(key, valueSet);
i += valueSet.size();
}
}
return new ImmutableSetMultimap<>(builder.a(), i, comparator);
}
public static <K, V> ImmutableSetMultimap<K, V> of(K k, V v) {
Builder builder = builder();
builder.a((Builder) k, (K) v);
return builder.a();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Collection get(Object obj) {
return get((ImmutableSetMultimap<K, V>) obj);
}
@Override // com.google.common.collect.ImmutableMultimap
public ImmutableSetMultimap<V, K> inverse() {
ImmutableSetMultimap<V, K> immutableSetMultimap = this.inverse;
if (immutableSetMultimap != null) {
return immutableSetMultimap;
}
ImmutableSetMultimap<V, K> invert = invert();
this.inverse = invert;
return invert;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.AbstractMultimap
@Deprecated
public /* bridge */ /* synthetic */ Collection replaceValues(Object obj, Iterable iterable) {
return replaceValues((ImmutableSetMultimap<K, V>) obj, iterable);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Set get(Object obj) {
return get((ImmutableSetMultimap<K, V>) obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.AbstractMultimap
@Deprecated
public /* bridge */ /* synthetic */ Set replaceValues(Object obj, Iterable iterable) {
return replaceValues((ImmutableSetMultimap<K, V>) obj, iterable);
}
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public ImmutableSet<Map.Entry<K, V>> entries() {
ImmutableSet<Map.Entry<K, V>> immutableSet = this.entries;
if (immutableSet != null) {
return immutableSet;
}
EntrySet entrySet = new EntrySet(this);
this.entries = entrySet;
return entrySet;
}
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.Multimap
public ImmutableSet<V> get(K k) {
return (ImmutableSet) MoreObjects.a((ImmutableSet) this.map.get(k), this.emptySet);
}
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.Multimap
@Deprecated
public ImmutableSet<V> removeAll(Object obj) {
throw new UnsupportedOperationException();
}
@Override // com.google.common.collect.ImmutableMultimap, com.google.common.collect.AbstractMultimap
@Deprecated
public ImmutableSet<V> replaceValues(K k, Iterable<? extends V> iterable) {
throw new UnsupportedOperationException();
}
public static <K, V> ImmutableSetMultimap<K, V> of(K k, V v, K k2, V v2) {
Builder builder = builder();
builder.a((Builder) k, (K) v);
builder.a((Builder) k2, (K) v2);
return builder.a();
}
public static <K, V> ImmutableSetMultimap<K, V> of(K k, V v, K k2, V v2, K k3, V v3) {
Builder builder = builder();
builder.a((Builder) k, (K) v);
builder.a((Builder) k2, (K) v2);
builder.a((Builder) k3, (K) v3);
return builder.a();
}
public static <K, V> ImmutableSetMultimap<K, V> of(K k, V v, K k2, V v2, K k3, V v3, K k4, V v4) {
Builder builder = builder();
builder.a((Builder) k, (K) v);
builder.a((Builder) k2, (K) v2);
builder.a((Builder) k3, (K) v3);
builder.a((Builder) k4, (K) v4);
return builder.a();
}
public static <K, V> ImmutableSetMultimap<K, V> copyOf(Iterable<? extends Map.Entry<? extends K, ? extends V>> iterable) {
Builder builder = new Builder();
builder.a((Iterable) iterable);
return builder.a();
}
public static <K, V> ImmutableSetMultimap<K, V> of(K k, V v, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
Builder builder = builder();
builder.a((Builder) k, (K) v);
builder.a((Builder) k2, (K) v2);
builder.a((Builder) k3, (K) v3);
builder.a((Builder) k4, (K) v4);
builder.a((Builder) k5, (K) v5);
return builder.a();
}
}

View File

@@ -0,0 +1,561 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableMap;
import java.util.AbstractMap;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Map;
import java.util.NavigableMap;
import java.util.SortedMap;
/* loaded from: classes.dex */
public final class ImmutableSortedMap<K, V> extends ImmutableSortedMapFauxverideShim<K, V> implements NavigableMap<K, V> {
private static final long serialVersionUID = 0;
private transient ImmutableSortedMap<K, V> descendingMap;
private final transient RegularImmutableSortedSet<K> keySet;
private final transient ImmutableList<V> valueList;
private static final Comparator<Comparable> NATURAL_ORDER = Ordering.c();
private static final ImmutableSortedMap<Comparable, Object> NATURAL_EMPTY_MAP = new ImmutableSortedMap<>(ImmutableSortedSet.emptySet(Ordering.c()), ImmutableList.of());
public static class Builder<K, V> extends ImmutableMap.Builder<K, V> {
private transient Object[] e;
private transient Object[] f;
private final Comparator<? super K> g;
public Builder(Comparator<? super K> comparator) {
this(comparator, 4);
}
private Builder(Comparator<? super K> comparator, int i) {
Preconditions.a(comparator);
this.g = comparator;
this.e = new Object[i];
this.f = new Object[i];
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMap.Builder
public /* bridge */ /* synthetic */ ImmutableMap.Builder a(Object obj, Object obj2) {
a((Builder<K, V>) obj, obj2);
return this;
}
@Override // com.google.common.collect.ImmutableMap.Builder
public /* bridge */ /* synthetic */ ImmutableMap.Builder a(Map.Entry entry) {
a(entry);
return this;
}
@Override // com.google.common.collect.ImmutableMap.Builder
public /* bridge */ /* synthetic */ ImmutableMap.Builder a(Iterable iterable) {
a(iterable);
return this;
}
@Override // com.google.common.collect.ImmutableMap.Builder
public /* bridge */ /* synthetic */ ImmutableMap.Builder a(Map map) {
a(map);
return this;
}
private void a(int i) {
Object[] objArr = this.e;
if (i > objArr.length) {
int a = ImmutableCollection.Builder.a(objArr.length, i);
this.e = Arrays.copyOf(this.e, a);
this.f = Arrays.copyOf(this.f, a);
}
}
@Override // com.google.common.collect.ImmutableMap.Builder
public Builder<K, V> a(K k, V v) {
a(this.c + 1);
CollectPreconditions.a(k, v);
Object[] objArr = this.e;
int i = this.c;
objArr[i] = k;
this.f[i] = v;
this.c = i + 1;
return this;
}
@Override // com.google.common.collect.ImmutableMap.Builder
public Builder<K, V> a(Map.Entry<? extends K, ? extends V> entry) {
super.a((Map.Entry) entry);
return this;
}
@Override // com.google.common.collect.ImmutableMap.Builder
public Builder<K, V> a(Map<? extends K, ? extends V> map) {
super.a((Map) map);
return this;
}
@Override // com.google.common.collect.ImmutableMap.Builder
public Builder<K, V> a(Iterable<? extends Map.Entry<? extends K, ? extends V>> iterable) {
super.a((Iterable) iterable);
return this;
}
@Override // com.google.common.collect.ImmutableMap.Builder
public ImmutableSortedMap<K, V> a() {
int i = this.c;
if (i == 0) {
return ImmutableSortedMap.emptyMap(this.g);
}
if (i == 1) {
return ImmutableSortedMap.of(this.g, this.e[0], this.f[0]);
}
Object[] copyOf = Arrays.copyOf(this.e, i);
Arrays.sort(copyOf, this.g);
Object[] objArr = new Object[this.c];
for (int i2 = 0; i2 < this.c; i2++) {
if (i2 > 0) {
int i3 = i2 - 1;
if (this.g.compare(copyOf[i3], copyOf[i2]) == 0) {
throw new IllegalArgumentException("keys required to be distinct but compared as equal: " + copyOf[i3] + " and " + copyOf[i2]);
}
}
objArr[Arrays.binarySearch(copyOf, this.e[i2], this.g)] = this.f[i2];
}
return new ImmutableSortedMap<>(new RegularImmutableSortedSet(ImmutableList.asImmutableList(copyOf), this.g), ImmutableList.asImmutableList(objArr));
}
}
private static class SerializedForm extends ImmutableMap.SerializedForm {
private final Comparator<Object> c;
SerializedForm(ImmutableSortedMap<?, ?> immutableSortedMap) {
super(immutableSortedMap);
this.c = immutableSortedMap.comparator();
}
@Override // com.google.common.collect.ImmutableMap.SerializedForm
Object readResolve() {
return a(new Builder(this.c));
}
}
ImmutableSortedMap(RegularImmutableSortedSet<K> regularImmutableSortedSet, ImmutableList<V> immutableList) {
this(regularImmutableSortedSet, immutableList, null);
}
public static <K, V> ImmutableSortedMap<K, V> copyOf(Map<? extends K, ? extends V> map) {
return copyOfInternal(map, (Ordering) NATURAL_ORDER);
}
private static <K, V> ImmutableSortedMap<K, V> copyOfInternal(Map<? extends K, ? extends V> map, Comparator<? super K> comparator) {
boolean z = false;
if (map instanceof SortedMap) {
Comparator<? super K> comparator2 = ((SortedMap) map).comparator();
if (comparator2 != null) {
z = comparator.equals(comparator2);
} else if (comparator == NATURAL_ORDER) {
z = true;
}
}
if (z && (map instanceof ImmutableSortedMap)) {
ImmutableSortedMap<K, V> immutableSortedMap = (ImmutableSortedMap) map;
if (!immutableSortedMap.isPartialView()) {
return immutableSortedMap;
}
}
return fromEntries(comparator, z, map.entrySet());
}
public static <K, V> ImmutableSortedMap<K, V> copyOfSorted(SortedMap<K, ? extends V> sortedMap) {
Comparator<? super K> comparator = sortedMap.comparator();
if (comparator == null) {
comparator = NATURAL_ORDER;
}
if (sortedMap instanceof ImmutableSortedMap) {
ImmutableSortedMap<K, V> immutableSortedMap = (ImmutableSortedMap) sortedMap;
if (!immutableSortedMap.isPartialView()) {
return immutableSortedMap;
}
}
return fromEntries(comparator, true, sortedMap.entrySet());
}
static <K, V> ImmutableSortedMap<K, V> emptyMap(Comparator<? super K> comparator) {
return Ordering.c().equals(comparator) ? of() : new ImmutableSortedMap<>(ImmutableSortedSet.emptySet(comparator), ImmutableList.of());
}
private static <K, V> ImmutableSortedMap<K, V> fromEntries(Comparator<? super K> comparator, boolean z, Iterable<? extends Map.Entry<? extends K, ? extends V>> iterable) {
Map.Entry[] entryArr = (Map.Entry[]) Iterables.a((Iterable) iterable, (Object[]) ImmutableMap.EMPTY_ENTRY_ARRAY);
return fromEntries(comparator, z, entryArr, entryArr.length);
}
private ImmutableSortedMap<K, V> getSubMap(int i, int i2) {
return (i == 0 && i2 == size()) ? this : i == i2 ? emptyMap(comparator()) : new ImmutableSortedMap<>(this.keySet.a(i, i2), this.valueList.subList(i, i2));
}
public static <K extends Comparable<?>, V> Builder<K, V> naturalOrder() {
return new Builder<>(Ordering.c());
}
public static <K, V> ImmutableSortedMap<K, V> of() {
return (ImmutableSortedMap<K, V>) NATURAL_EMPTY_MAP;
}
private static <K extends Comparable<? super K>, V> ImmutableSortedMap<K, V> ofEntries(Map.Entry<K, V>... entryArr) {
return fromEntries(Ordering.c(), false, entryArr, entryArr.length);
}
public static <K, V> Builder<K, V> orderedBy(Comparator<K> comparator) {
return new Builder<>(comparator);
}
public static <K extends Comparable<?>, V> Builder<K, V> reverseOrder() {
return new Builder<>(Ordering.c().b());
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> ceilingEntry(K k) {
return tailMap((ImmutableSortedMap<K, V>) k, true).firstEntry();
}
@Override // java.util.NavigableMap
public K ceilingKey(K k) {
return (K) Maps.a(ceilingEntry(k));
}
@Override // java.util.SortedMap
public Comparator<? super K> comparator() {
return keySet().comparator();
}
@Override // com.google.common.collect.ImmutableMap
ImmutableSet<Map.Entry<K, V>> createEntrySet() {
return isEmpty() ? ImmutableSet.of() : new ImmutableMapEntrySet<K, V>() { // from class: com.google.common.collect.ImmutableSortedMap.1EntrySet
@Override // com.google.common.collect.ImmutableMapEntrySet
ImmutableMap<K, V> a() {
return ImmutableSortedMap.this;
}
@Override // com.google.common.collect.ImmutableSet
ImmutableList<Map.Entry<K, V>> createAsList() {
return new ImmutableList<Map.Entry<K, V>>() { // from class: com.google.common.collect.ImmutableSortedMap.1EntrySet.1
@Override // com.google.common.collect.ImmutableCollection
boolean isPartialView() {
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public int size() {
return ImmutableSortedMap.this.size();
}
@Override // java.util.List
public Map.Entry<K, V> get(int i) {
return new AbstractMap.SimpleImmutableEntry(ImmutableSortedMap.this.keySet.asList().get(i), ImmutableSortedMap.this.valueList.get(i));
}
};
}
@Override // com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
public UnmodifiableIterator<Map.Entry<K, V>> iterator() {
return asList().iterator();
}
};
}
@Override // com.google.common.collect.ImmutableMap
ImmutableSet<K> createKeySet() {
throw new AssertionError("should never be called");
}
@Override // com.google.common.collect.ImmutableMap
ImmutableCollection<V> createValues() {
throw new AssertionError("should never be called");
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> firstEntry() {
if (isEmpty()) {
return null;
}
return entrySet().asList().get(0);
}
@Override // java.util.SortedMap
public K firstKey() {
return keySet().first();
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> floorEntry(K k) {
return headMap((ImmutableSortedMap<K, V>) k, true).lastEntry();
}
@Override // java.util.NavigableMap
public K floorKey(K k) {
return (K) Maps.a(floorEntry(k));
}
@Override // com.google.common.collect.ImmutableMap, java.util.Map
public V get(Object obj) {
int indexOf = this.keySet.indexOf(obj);
if (indexOf == -1) {
return null;
}
return this.valueList.get(indexOf);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // java.util.NavigableMap
public /* bridge */ /* synthetic */ NavigableMap headMap(Object obj, boolean z) {
return headMap((ImmutableSortedMap<K, V>) obj, z);
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> higherEntry(K k) {
return tailMap((ImmutableSortedMap<K, V>) k, false).firstEntry();
}
@Override // java.util.NavigableMap
public K higherKey(K k) {
return (K) Maps.a(higherEntry(k));
}
@Override // com.google.common.collect.ImmutableMap
boolean isPartialView() {
return this.keySet.isPartialView() || this.valueList.isPartialView();
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> lastEntry() {
if (isEmpty()) {
return null;
}
return entrySet().asList().get(size() - 1);
}
@Override // java.util.SortedMap
public K lastKey() {
return keySet().last();
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> lowerEntry(K k) {
return headMap((ImmutableSortedMap<K, V>) k, false).lastEntry();
}
@Override // java.util.NavigableMap
public K lowerKey(K k) {
return (K) Maps.a(lowerEntry(k));
}
@Override // java.util.NavigableMap
@Deprecated
public final Map.Entry<K, V> pollFirstEntry() {
throw new UnsupportedOperationException();
}
@Override // java.util.NavigableMap
@Deprecated
public final Map.Entry<K, V> pollLastEntry() {
throw new UnsupportedOperationException();
}
@Override // java.util.Map
public int size() {
return this.valueList.size();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // java.util.NavigableMap
public /* bridge */ /* synthetic */ NavigableMap subMap(Object obj, boolean z, Object obj2, boolean z2) {
return subMap((boolean) obj, z, (boolean) obj2, z2);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // java.util.NavigableMap
public /* bridge */ /* synthetic */ NavigableMap tailMap(Object obj, boolean z) {
return tailMap((ImmutableSortedMap<K, V>) obj, z);
}
@Override // com.google.common.collect.ImmutableMap
Object writeReplace() {
return new SerializedForm(this);
}
ImmutableSortedMap(RegularImmutableSortedSet<K> regularImmutableSortedSet, ImmutableList<V> immutableList, ImmutableSortedMap<K, V> immutableSortedMap) {
this.keySet = regularImmutableSortedSet;
this.valueList = immutableList;
this.descendingMap = immutableSortedMap;
}
/* JADX WARN: Incorrect types in method signature: <K::Ljava/lang/Comparable<-TK;>;V:Ljava/lang/Object;>(TK;TV;)Lcom/google/common/collect/ImmutableSortedMap<TK;TV;>; */
public static ImmutableSortedMap of(Comparable comparable, Object obj) {
return of(Ordering.c(), comparable, obj);
}
@Override // java.util.NavigableMap
public ImmutableSortedSet<K> descendingKeySet() {
return this.keySet.descendingSet();
}
@Override // java.util.NavigableMap
public ImmutableSortedMap<K, V> descendingMap() {
ImmutableSortedMap<K, V> immutableSortedMap = this.descendingMap;
return immutableSortedMap == null ? isEmpty() ? emptyMap(Ordering.a(comparator()).b()) : new ImmutableSortedMap<>((RegularImmutableSortedSet) this.keySet.descendingSet(), this.valueList.reverse(), this) : immutableSortedMap;
}
@Override // com.google.common.collect.ImmutableMap, java.util.Map
public ImmutableSet<Map.Entry<K, V>> entrySet() {
return super.entrySet();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // java.util.NavigableMap, java.util.SortedMap
public /* bridge */ /* synthetic */ SortedMap headMap(Object obj) {
return headMap((ImmutableSortedMap<K, V>) obj);
}
@Override // java.util.NavigableMap
public ImmutableSortedSet<K> navigableKeySet() {
return this.keySet;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // java.util.NavigableMap, java.util.SortedMap
public /* bridge */ /* synthetic */ SortedMap tailMap(Object obj) {
return tailMap((ImmutableSortedMap<K, V>) obj);
}
@Override // com.google.common.collect.ImmutableMap, java.util.Map
public ImmutableCollection<V> values() {
return this.valueList;
}
public static <K, V> ImmutableSortedMap<K, V> copyOf(Map<? extends K, ? extends V> map, Comparator<? super K> comparator) {
Preconditions.a(comparator);
return copyOfInternal(map, comparator);
}
private static <K, V> ImmutableSortedMap<K, V> fromEntries(final Comparator<? super K> comparator, boolean z, Map.Entry<K, V>[] entryArr, int i) {
if (i == 0) {
return emptyMap(comparator);
}
if (i != 1) {
Object[] objArr = new Object[i];
Object[] objArr2 = new Object[i];
if (z) {
for (int i2 = 0; i2 < i; i2++) {
K key = entryArr[i2].getKey();
V value = entryArr[i2].getValue();
CollectPreconditions.a(key, value);
objArr[i2] = key;
objArr2[i2] = value;
}
} else {
Arrays.sort(entryArr, 0, i, new Comparator<Map.Entry<K, V>>() { // from class: com.google.common.collect.ImmutableSortedMap.1
@Override // java.util.Comparator
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public int compare(Map.Entry<K, V> entry, Map.Entry<K, V> entry2) {
return comparator.compare(entry.getKey(), entry2.getKey());
}
});
K key2 = entryArr[0].getKey();
objArr[0] = key2;
objArr2[0] = entryArr[0].getValue();
Object obj = key2;
int i3 = 1;
while (i3 < i) {
Object key3 = entryArr[i3].getKey();
V value2 = entryArr[i3].getValue();
CollectPreconditions.a(key3, value2);
objArr[i3] = key3;
objArr2[i3] = value2;
ImmutableMap.checkNoConflict(comparator.compare(obj, key3) != 0, "key", entryArr[i3 - 1], entryArr[i3]);
i3++;
obj = key3;
}
}
return new ImmutableSortedMap<>(new RegularImmutableSortedSet(ImmutableList.asImmutableList(objArr), comparator), ImmutableList.asImmutableList(objArr2));
}
return of(comparator, entryArr[0].getKey(), entryArr[0].getValue());
}
/* JADX INFO: Access modifiers changed from: private */
public static <K, V> ImmutableSortedMap<K, V> of(Comparator<? super K> comparator, K k, V v) {
ImmutableList of = ImmutableList.of(k);
Preconditions.a(comparator);
return new ImmutableSortedMap<>(new RegularImmutableSortedSet(of, comparator), ImmutableList.of(v));
}
@Override // java.util.NavigableMap, java.util.SortedMap
public ImmutableSortedMap<K, V> headMap(K k) {
return headMap((ImmutableSortedMap<K, V>) k, false);
}
@Override // com.google.common.collect.ImmutableMap, java.util.Map
public ImmutableSortedSet<K> keySet() {
return this.keySet;
}
@Override // java.util.NavigableMap, java.util.SortedMap
public ImmutableSortedMap<K, V> subMap(K k, K k2) {
return subMap((boolean) k, true, (boolean) k2, false);
}
@Override // java.util.NavigableMap, java.util.SortedMap
public ImmutableSortedMap<K, V> tailMap(K k) {
return tailMap((ImmutableSortedMap<K, V>) k, true);
}
public static <K, V> ImmutableSortedMap<K, V> copyOf(Iterable<? extends Map.Entry<? extends K, ? extends V>> iterable) {
return copyOf(iterable, (Ordering) NATURAL_ORDER);
}
@Override // java.util.NavigableMap
public ImmutableSortedMap<K, V> headMap(K k, boolean z) {
RegularImmutableSortedSet<K> regularImmutableSortedSet = this.keySet;
Preconditions.a(k);
return getSubMap(0, regularImmutableSortedSet.a((RegularImmutableSortedSet<K>) k, z));
}
/* JADX WARN: Multi-variable type inference failed */
@Override // java.util.NavigableMap
public ImmutableSortedMap<K, V> subMap(K k, boolean z, K k2, boolean z2) {
Preconditions.a(k);
Preconditions.a(k2);
Preconditions.a(comparator().compare(k, k2) <= 0, "expected fromKey <= toKey but %s > %s", k, k2);
return headMap((ImmutableSortedMap<K, V>) k2, z2).tailMap((ImmutableSortedMap<K, V>) k, z);
}
@Override // java.util.NavigableMap
public ImmutableSortedMap<K, V> tailMap(K k, boolean z) {
RegularImmutableSortedSet<K> regularImmutableSortedSet = this.keySet;
Preconditions.a(k);
return getSubMap(regularImmutableSortedSet.b(k, z), size());
}
public static <K, V> ImmutableSortedMap<K, V> copyOf(Iterable<? extends Map.Entry<? extends K, ? extends V>> iterable, Comparator<? super K> comparator) {
Preconditions.a(comparator);
return fromEntries(comparator, false, iterable);
}
/* JADX WARN: Incorrect types in method signature: <K::Ljava/lang/Comparable<-TK;>;V:Ljava/lang/Object;>(TK;TV;TK;TV;)Lcom/google/common/collect/ImmutableSortedMap<TK;TV;>; */
public static ImmutableSortedMap of(Comparable comparable, Object obj, Comparable comparable2, Object obj2) {
return ofEntries(ImmutableMap.entryOf(comparable, obj), ImmutableMap.entryOf(comparable2, obj2));
}
/* JADX WARN: Incorrect types in method signature: <K::Ljava/lang/Comparable<-TK;>;V:Ljava/lang/Object;>(TK;TV;TK;TV;TK;TV;)Lcom/google/common/collect/ImmutableSortedMap<TK;TV;>; */
public static ImmutableSortedMap of(Comparable comparable, Object obj, Comparable comparable2, Object obj2, Comparable comparable3, Object obj3) {
return ofEntries(ImmutableMap.entryOf(comparable, obj), ImmutableMap.entryOf(comparable2, obj2), ImmutableMap.entryOf(comparable3, obj3));
}
/* JADX WARN: Incorrect types in method signature: <K::Ljava/lang/Comparable<-TK;>;V:Ljava/lang/Object;>(TK;TV;TK;TV;TK;TV;TK;TV;)Lcom/google/common/collect/ImmutableSortedMap<TK;TV;>; */
public static ImmutableSortedMap of(Comparable comparable, Object obj, Comparable comparable2, Object obj2, Comparable comparable3, Object obj3, Comparable comparable4, Object obj4) {
return ofEntries(ImmutableMap.entryOf(comparable, obj), ImmutableMap.entryOf(comparable2, obj2), ImmutableMap.entryOf(comparable3, obj3), ImmutableMap.entryOf(comparable4, obj4));
}
/* JADX WARN: Incorrect types in method signature: <K::Ljava/lang/Comparable<-TK;>;V:Ljava/lang/Object;>(TK;TV;TK;TV;TK;TV;TK;TV;TK;TV;)Lcom/google/common/collect/ImmutableSortedMap<TK;TV;>; */
public static ImmutableSortedMap of(Comparable comparable, Object obj, Comparable comparable2, Object obj2, Comparable comparable3, Object obj3, Comparable comparable4, Object obj4, Comparable comparable5, Object obj5) {
return ofEntries(ImmutableMap.entryOf(comparable, obj), ImmutableMap.entryOf(comparable2, obj2), ImmutableMap.entryOf(comparable3, obj3), ImmutableMap.entryOf(comparable4, obj4), ImmutableMap.entryOf(comparable5, obj5));
}
}

View File

@@ -0,0 +1,39 @@
package com.google.common.collect;
import com.google.common.collect.ImmutableSortedMap;
/* loaded from: classes.dex */
abstract class ImmutableSortedMapFauxverideShim<K, V> extends ImmutableMap<K, V> {
ImmutableSortedMapFauxverideShim() {
}
@Deprecated
public static <K, V> ImmutableSortedMap.Builder<K, V> builder() {
throw new UnsupportedOperationException();
}
@Deprecated
public static <K, V> ImmutableSortedMap<K, V> of(K k, V v) {
throw new UnsupportedOperationException();
}
@Deprecated
public static <K, V> ImmutableSortedMap<K, V> of(K k, V v, K k2, V v2) {
throw new UnsupportedOperationException();
}
@Deprecated
public static <K, V> ImmutableSortedMap<K, V> of(K k, V v, K k2, V v2, K k3, V v3) {
throw new UnsupportedOperationException();
}
@Deprecated
public static <K, V> ImmutableSortedMap<K, V> of(K k, V v, K k2, V v2, K k3, V v3, K k4, V v4) {
throw new UnsupportedOperationException();
}
@Deprecated
public static <K, V> ImmutableSortedMap<K, V> of(K k, V v, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,318 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMultiset;
import com.google.common.collect.Multiset;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
/* loaded from: classes.dex */
public abstract class ImmutableSortedMultiset<E> extends ImmutableSortedMultisetFauxverideShim<E> implements SortedMultiset<E> {
transient ImmutableSortedMultiset<E> descendingMultiset;
public static class Builder<E> extends ImmutableMultiset.Builder<E> {
SortedMultiset<E> d;
public Builder(Comparator<? super E> comparator) {
super(0);
Preconditions.a(comparator);
this.d = TreeMultiset.create(comparator);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultiset.Builder, com.google.common.collect.ImmutableCollection.Builder
public /* bridge */ /* synthetic */ ImmutableCollection.Builder a(Object obj) {
a((Builder<E>) obj);
return this;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultiset.Builder, com.google.common.collect.ImmutableCollection.Builder
public /* bridge */ /* synthetic */ ImmutableMultiset.Builder a(Object obj) {
a((Builder<E>) obj);
return this;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultiset.Builder, com.google.common.collect.ImmutableCollection.Builder
public /* bridge */ /* synthetic */ ImmutableMultiset.Builder a(Object[] objArr) {
a(objArr);
return this;
}
@Override // com.google.common.collect.ImmutableMultiset.Builder, com.google.common.collect.ImmutableCollection.Builder
public /* bridge */ /* synthetic */ ImmutableMultiset.Builder a(Iterable iterable) {
a(iterable);
return this;
}
@Override // com.google.common.collect.ImmutableMultiset.Builder, com.google.common.collect.ImmutableCollection.Builder
public /* bridge */ /* synthetic */ ImmutableMultiset.Builder a(Iterator it) {
a(it);
return this;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableMultiset.Builder
public /* bridge */ /* synthetic */ ImmutableMultiset.Builder a(Object obj, int i) {
a((Builder<E>) obj, i);
return this;
}
@Override // com.google.common.collect.ImmutableMultiset.Builder, com.google.common.collect.ImmutableCollection.Builder
public Builder<E> a(E e) {
Preconditions.a(e);
this.d.add(e);
return this;
}
@Override // com.google.common.collect.ImmutableMultiset.Builder
public Builder<E> a(E e, int i) {
Preconditions.a(e);
this.d.add(e, i);
return this;
}
@Override // com.google.common.collect.ImmutableMultiset.Builder, com.google.common.collect.ImmutableCollection.Builder
public Builder<E> a(E... eArr) {
Collections.addAll(this.d, eArr);
return this;
}
@Override // com.google.common.collect.ImmutableMultiset.Builder, com.google.common.collect.ImmutableCollection.Builder
public Builder<E> a(Iterable<? extends E> iterable) {
if (iterable instanceof Multiset) {
for (Multiset.Entry<E> entry : ((Multiset) iterable).entrySet()) {
a((Builder<E>) entry.a(), entry.getCount());
}
} else {
Iterator<? extends E> it = iterable.iterator();
while (it.hasNext()) {
a((Builder<E>) it.next());
}
}
return this;
}
@Override // com.google.common.collect.ImmutableMultiset.Builder, com.google.common.collect.ImmutableCollection.Builder
public Builder<E> a(Iterator<? extends E> it) {
while (it.hasNext()) {
a((Builder<E>) it.next());
}
return this;
}
@Override // com.google.common.collect.ImmutableMultiset.Builder
public ImmutableSortedMultiset<E> a() {
return ImmutableSortedMultiset.copyOfSorted(this.d);
}
}
private static final class SerializedForm<E> implements Serializable {
final Comparator<? super E> a;
final E[] b;
final int[] c;
SerializedForm(SortedMultiset<E> sortedMultiset) {
this.a = sortedMultiset.comparator();
int size = sortedMultiset.entrySet().size();
this.b = (E[]) new Object[size];
this.c = new int[size];
int i = 0;
for (Multiset.Entry<E> entry : sortedMultiset.entrySet()) {
this.b[i] = entry.a();
this.c[i] = entry.getCount();
i++;
}
}
Object readResolve() {
int length = this.b.length;
Builder builder = new Builder(this.a);
for (int i = 0; i < length; i++) {
builder.a((Builder) this.b[i], this.c[i]);
}
return builder.a();
}
}
ImmutableSortedMultiset() {
}
/* JADX WARN: Incorrect types in method signature: <E::Ljava/lang/Comparable<-TE;>;>([TE;)Lcom/google/common/collect/ImmutableSortedMultiset<TE;>; */
public static ImmutableSortedMultiset copyOf(Comparable[] comparableArr) {
return copyOf(Ordering.c(), Arrays.asList(comparableArr));
}
public static <E> ImmutableSortedMultiset<E> copyOfSorted(SortedMultiset<E> sortedMultiset) {
return copyOfSortedEntries(sortedMultiset.comparator(), Lists.a(sortedMultiset.entrySet()));
}
private static <E> ImmutableSortedMultiset<E> copyOfSortedEntries(Comparator<? super E> comparator, Collection<Multiset.Entry<E>> collection) {
if (collection.isEmpty()) {
return emptyMultiset(comparator);
}
ImmutableList.Builder builder = new ImmutableList.Builder(collection.size());
long[] jArr = new long[collection.size() + 1];
Iterator<Multiset.Entry<E>> it = collection.iterator();
int i = 0;
while (it.hasNext()) {
builder.a((ImmutableList.Builder) it.next().a());
int i2 = i + 1;
jArr[i2] = jArr[i] + r5.getCount();
i = i2;
}
return new RegularImmutableSortedMultiset(new RegularImmutableSortedSet(builder.a(), comparator), jArr, 0, collection.size());
}
static <E> ImmutableSortedMultiset<E> emptyMultiset(Comparator<? super E> comparator) {
return Ordering.c().equals(comparator) ? (ImmutableSortedMultiset<E>) RegularImmutableSortedMultiset.f : new RegularImmutableSortedMultiset(comparator);
}
public static <E extends Comparable<?>> Builder<E> naturalOrder() {
return new Builder<>(Ordering.c());
}
public static <E> ImmutableSortedMultiset<E> of() {
return (ImmutableSortedMultiset<E>) RegularImmutableSortedMultiset.f;
}
public static <E> Builder<E> orderedBy(Comparator<E> comparator) {
return new Builder<>(comparator);
}
public static <E extends Comparable<?>> Builder<E> reverseOrder() {
return new Builder<>(Ordering.c().b());
}
@Override // com.google.common.collect.SortedMultiset, com.google.common.collect.SortedIterable
public final Comparator<? super E> comparator() {
return elementSet().comparator();
}
@Override // com.google.common.collect.ImmutableMultiset, com.google.common.collect.Multiset
public abstract ImmutableSortedSet<E> elementSet();
public abstract ImmutableSortedMultiset<E> headMultiset(E e, BoundType boundType);
/* JADX WARN: Multi-variable type inference failed */
public /* bridge */ /* synthetic */ SortedMultiset headMultiset(Object obj, BoundType boundType) {
return headMultiset((ImmutableSortedMultiset<E>) obj, boundType);
}
@Override // com.google.common.collect.SortedMultiset
@Deprecated
public final Multiset.Entry<E> pollFirstEntry() {
throw new UnsupportedOperationException();
}
@Override // com.google.common.collect.SortedMultiset
@Deprecated
public final Multiset.Entry<E> pollLastEntry() {
throw new UnsupportedOperationException();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.SortedMultiset
public /* bridge */ /* synthetic */ SortedMultiset subMultiset(Object obj, BoundType boundType, Object obj2, BoundType boundType2) {
return subMultiset((BoundType) obj, boundType, (BoundType) obj2, boundType2);
}
public abstract ImmutableSortedMultiset<E> tailMultiset(E e, BoundType boundType);
/* JADX WARN: Multi-variable type inference failed */
public /* bridge */ /* synthetic */ SortedMultiset tailMultiset(Object obj, BoundType boundType) {
return tailMultiset((ImmutableSortedMultiset<E>) obj, boundType);
}
@Override // com.google.common.collect.ImmutableMultiset, com.google.common.collect.ImmutableCollection
Object writeReplace() {
return new SerializedForm(this);
}
public static <E> ImmutableSortedMultiset<E> copyOf(Iterable<? extends E> iterable) {
return copyOf(Ordering.c(), iterable);
}
/* JADX WARN: Incorrect types in method signature: <E::Ljava/lang/Comparable<-TE;>;>(TE;)Lcom/google/common/collect/ImmutableSortedMultiset<TE;>; */
public static ImmutableSortedMultiset of(Comparable comparable) {
return new RegularImmutableSortedMultiset((RegularImmutableSortedSet) ImmutableSortedSet.of(comparable), new long[]{0, 1}, 0, 1);
}
@Override // com.google.common.collect.SortedMultiset
public ImmutableSortedMultiset<E> descendingMultiset() {
ImmutableSortedMultiset<E> immutableSortedMultiset = this.descendingMultiset;
if (immutableSortedMultiset == null) {
immutableSortedMultiset = isEmpty() ? emptyMultiset(Ordering.a(comparator()).b()) : new DescendingImmutableSortedMultiset<>(this);
this.descendingMultiset = immutableSortedMultiset;
}
return immutableSortedMultiset;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.SortedMultiset
public ImmutableSortedMultiset<E> subMultiset(E e, BoundType boundType, E e2, BoundType boundType2) {
Preconditions.a(comparator().compare(e, e2) <= 0, "Expected lowerBound <= upperBound but %s > %s", e, e2);
return tailMultiset((ImmutableSortedMultiset<E>) e, boundType).headMultiset((ImmutableSortedMultiset<E>) e2, boundType2);
}
public static <E> ImmutableSortedMultiset<E> copyOf(Iterator<? extends E> it) {
return copyOf(Ordering.c(), it);
}
/* JADX WARN: Incorrect types in method signature: <E::Ljava/lang/Comparable<-TE;>;>(TE;TE;)Lcom/google/common/collect/ImmutableSortedMultiset<TE;>; */
public static ImmutableSortedMultiset of(Comparable comparable, Comparable comparable2) {
return copyOf(Ordering.c(), Arrays.asList(comparable, comparable2));
}
public static <E> ImmutableSortedMultiset<E> copyOf(Comparator<? super E> comparator, Iterator<? extends E> it) {
Preconditions.a(comparator);
Builder builder = new Builder(comparator);
builder.a((Iterator) it);
return builder.a();
}
/* JADX WARN: Incorrect types in method signature: <E::Ljava/lang/Comparable<-TE;>;>(TE;TE;TE;)Lcom/google/common/collect/ImmutableSortedMultiset<TE;>; */
public static ImmutableSortedMultiset of(Comparable comparable, Comparable comparable2, Comparable comparable3) {
return copyOf(Ordering.c(), Arrays.asList(comparable, comparable2, comparable3));
}
/* JADX WARN: Incorrect types in method signature: <E::Ljava/lang/Comparable<-TE;>;>(TE;TE;TE;TE;)Lcom/google/common/collect/ImmutableSortedMultiset<TE;>; */
public static ImmutableSortedMultiset of(Comparable comparable, Comparable comparable2, Comparable comparable3, Comparable comparable4) {
return copyOf(Ordering.c(), Arrays.asList(comparable, comparable2, comparable3, comparable4));
}
public static <E> ImmutableSortedMultiset<E> copyOf(Comparator<? super E> comparator, Iterable<? extends E> iterable) {
if (iterable instanceof ImmutableSortedMultiset) {
ImmutableSortedMultiset<E> immutableSortedMultiset = (ImmutableSortedMultiset) iterable;
if (comparator.equals(immutableSortedMultiset.comparator())) {
return immutableSortedMultiset.isPartialView() ? copyOfSortedEntries(comparator, immutableSortedMultiset.entrySet().asList()) : immutableSortedMultiset;
}
}
ArrayList a = Lists.a(iterable);
Preconditions.a(comparator);
TreeMultiset create = TreeMultiset.create(comparator);
Iterables.a((Collection) create, (Iterable) a);
return copyOfSortedEntries(comparator, create.entrySet());
}
/* JADX WARN: Incorrect types in method signature: <E::Ljava/lang/Comparable<-TE;>;>(TE;TE;TE;TE;TE;)Lcom/google/common/collect/ImmutableSortedMultiset<TE;>; */
public static ImmutableSortedMultiset of(Comparable comparable, Comparable comparable2, Comparable comparable3, Comparable comparable4, Comparable comparable5) {
return copyOf(Ordering.c(), Arrays.asList(comparable, comparable2, comparable3, comparable4, comparable5));
}
/* JADX WARN: Incorrect types in method signature: <E::Ljava/lang/Comparable<-TE;>;>(TE;TE;TE;TE;TE;TE;[TE;)Lcom/google/common/collect/ImmutableSortedMultiset<TE;>; */
public static ImmutableSortedMultiset of(Comparable comparable, Comparable comparable2, Comparable comparable3, Comparable comparable4, Comparable comparable5, Comparable comparable6, Comparable... comparableArr) {
ArrayList b = Lists.b(comparableArr.length + 6);
Collections.addAll(b, comparable, comparable2, comparable3, comparable4, comparable5, comparable6);
Collections.addAll(b, comparableArr);
return copyOf(Ordering.c(), b);
}
}

View File

@@ -0,0 +1,49 @@
package com.google.common.collect;
import com.google.common.collect.ImmutableSortedMultiset;
/* loaded from: classes.dex */
abstract class ImmutableSortedMultisetFauxverideShim<E> extends ImmutableMultiset<E> {
ImmutableSortedMultisetFauxverideShim() {
}
@Deprecated
public static <E> ImmutableSortedMultiset.Builder<E> builder() {
throw new UnsupportedOperationException();
}
@Deprecated
public static <E> ImmutableSortedMultiset<E> copyOf(E[] eArr) {
throw new UnsupportedOperationException();
}
@Deprecated
public static <E> ImmutableSortedMultiset<E> of(E e) {
throw new UnsupportedOperationException();
}
@Deprecated
public static <E> ImmutableSortedMultiset<E> of(E e, E e2) {
throw new UnsupportedOperationException();
}
@Deprecated
public static <E> ImmutableSortedMultiset<E> of(E e, E e2, E e3) {
throw new UnsupportedOperationException();
}
@Deprecated
public static <E> ImmutableSortedMultiset<E> of(E e, E e2, E e3, E e4) {
throw new UnsupportedOperationException();
}
@Deprecated
public static <E> ImmutableSortedMultiset<E> of(E e, E e2, E e3, E e4, E e5) {
throw new UnsupportedOperationException();
}
@Deprecated
public static <E> ImmutableSortedMultiset<E> of(E e, E e2, E e3, E e4, E e5, E e6, E... eArr) {
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,364 @@
package com.google.common.collect;
import android.Manifest;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableSet;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.NavigableSet;
import java.util.SortedSet;
/* loaded from: classes.dex */
public abstract class ImmutableSortedSet<E> extends ImmutableSortedSetFauxverideShim<E> implements NavigableSet<E>, SortedIterable<E> {
final transient Comparator<? super E> comparator;
transient ImmutableSortedSet<E> descendingSet;
public static final class Builder<E> extends ImmutableSet.Builder<E> {
private final Comparator<? super E> d;
public Builder(Comparator<? super E> comparator) {
Preconditions.a(comparator);
this.d = comparator;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableSet.Builder, com.google.common.collect.ImmutableCollection.Builder
public /* bridge */ /* synthetic */ ImmutableCollection.Builder a(Object obj) {
a((Builder<E>) obj);
return this;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ImmutableSet.Builder, com.google.common.collect.ImmutableCollection.ArrayBasedBuilder, com.google.common.collect.ImmutableCollection.Builder
public /* bridge */ /* synthetic */ ImmutableSet.Builder a(Object obj) {
a((Builder<E>) obj);
return this;
}
@Override // com.google.common.collect.ImmutableSet.Builder, com.google.common.collect.ImmutableCollection.Builder
public /* bridge */ /* synthetic */ ImmutableSet.Builder a(Iterator it) {
a(it);
return this;
}
@Override // com.google.common.collect.ImmutableSet.Builder, com.google.common.collect.ImmutableCollection.Builder
public Builder<E> a(E e) {
super.a((Builder<E>) e);
return this;
}
@Override // com.google.common.collect.ImmutableSet.Builder, com.google.common.collect.ImmutableCollection.ArrayBasedBuilder, com.google.common.collect.ImmutableCollection.Builder
public Builder<E> a(E... eArr) {
super.a((Object[]) eArr);
return this;
}
@Override // com.google.common.collect.ImmutableSet.Builder, com.google.common.collect.ImmutableCollection.Builder
public Builder<E> a(Iterator<? extends E> it) {
super.a((Iterator) it);
return this;
}
@Override // com.google.common.collect.ImmutableSet.Builder
public ImmutableSortedSet<E> a() {
ImmutableSortedSet<E> construct = ImmutableSortedSet.construct(this.d, this.b, this.a);
this.b = construct.size();
this.c = true;
return construct;
}
}
private static class SerializedForm<E> implements Serializable {
final Comparator<? super E> a;
final Object[] b;
public SerializedForm(Comparator<? super E> comparator, Object[] objArr) {
this.a = comparator;
this.b = objArr;
}
/* JADX WARN: Multi-variable type inference failed */
Object readResolve() {
Builder builder = new Builder(this.a);
builder.a(this.b);
return builder.a();
}
}
ImmutableSortedSet(Comparator<? super E> comparator) {
this.comparator = comparator;
}
/* JADX WARN: Multi-variable type inference failed */
static <E> ImmutableSortedSet<E> construct(Comparator<? super E> comparator, int i, E... eArr) {
if (i == 0) {
return emptySet(comparator);
}
ObjectArrays.a((Object[]) eArr, i);
Arrays.sort(eArr, 0, i, comparator);
int i2 = 1;
for (int i3 = 1; i3 < i; i3++) {
Manifest manifest = (Object) eArr[i3];
if (comparator.compare(manifest, (Object) eArr[i2 - 1]) != 0) {
eArr[i2] = manifest;
i2++;
}
}
Arrays.fill(eArr, i2, i, (Object) null);
if (i2 < eArr.length / 2) {
eArr = (E[]) Arrays.copyOf(eArr, i2);
}
return new RegularImmutableSortedSet(ImmutableList.asImmutableList(eArr, i2), comparator);
}
/* JADX WARN: Incorrect types in method signature: <E::Ljava/lang/Comparable<-TE;>;>([TE;)Lcom/google/common/collect/ImmutableSortedSet<TE;>; */
public static ImmutableSortedSet copyOf(Comparable[] comparableArr) {
return construct(Ordering.c(), comparableArr.length, (Object[]) comparableArr.clone());
}
public static <E> ImmutableSortedSet<E> copyOfSorted(SortedSet<E> sortedSet) {
Comparator a = SortedIterables.a(sortedSet);
ImmutableList copyOf = ImmutableList.copyOf((Collection) sortedSet);
return copyOf.isEmpty() ? emptySet(a) : new RegularImmutableSortedSet(copyOf, a);
}
static <E> RegularImmutableSortedSet<E> emptySet(Comparator<? super E> comparator) {
return Ordering.c().equals(comparator) ? (RegularImmutableSortedSet<E>) RegularImmutableSortedSet.b : new RegularImmutableSortedSet<>(ImmutableList.of(), comparator);
}
public static <E extends Comparable<?>> Builder<E> naturalOrder() {
return new Builder<>(Ordering.c());
}
public static <E> ImmutableSortedSet<E> of() {
return RegularImmutableSortedSet.b;
}
public static <E> Builder<E> orderedBy(Comparator<E> comparator) {
return new Builder<>(comparator);
}
private void readObject(ObjectInputStream objectInputStream) throws InvalidObjectException {
throw new InvalidObjectException("Use SerializedForm");
}
public static <E extends Comparable<?>> Builder<E> reverseOrder() {
return new Builder<>(Collections.reverseOrder());
}
public E ceiling(E e) {
return (E) Iterables.a(tailSet((ImmutableSortedSet<E>) e, true), (Object) null);
}
@Override // java.util.SortedSet, com.google.common.collect.SortedIterable
public Comparator<? super E> comparator() {
return this.comparator;
}
abstract ImmutableSortedSet<E> createDescendingSet();
@Override // java.util.NavigableSet
public abstract UnmodifiableIterator<E> descendingIterator();
public E first() {
return iterator().next();
}
public E floor(E e) {
return (E) Iterators.b(headSet((ImmutableSortedSet<E>) e, true).descendingIterator(), (Object) null);
}
/* JADX WARN: Multi-variable type inference failed */
public /* bridge */ /* synthetic */ NavigableSet headSet(Object obj, boolean z) {
return headSet((ImmutableSortedSet<E>) obj, z);
}
abstract ImmutableSortedSet<E> headSetImpl(E e, boolean z);
public E higher(E e) {
return (E) Iterables.a(tailSet((ImmutableSortedSet<E>) e, false), (Object) null);
}
abstract int indexOf(Object obj);
@Override // com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
public abstract UnmodifiableIterator<E> iterator();
public E last() {
return descendingIterator().next();
}
public E lower(E e) {
return (E) Iterators.b(headSet((ImmutableSortedSet<E>) e, false).descendingIterator(), (Object) null);
}
@Override // java.util.NavigableSet
@Deprecated
public final E pollFirst() {
throw new UnsupportedOperationException();
}
@Override // java.util.NavigableSet
@Deprecated
public final E pollLast() {
throw new UnsupportedOperationException();
}
/* JADX WARN: Multi-variable type inference failed */
public /* bridge */ /* synthetic */ NavigableSet subSet(Object obj, boolean z, Object obj2, boolean z2) {
return subSet((boolean) obj, z, (boolean) obj2, z2);
}
abstract ImmutableSortedSet<E> subSetImpl(E e, boolean z, E e2, boolean z2);
/* JADX WARN: Multi-variable type inference failed */
public /* bridge */ /* synthetic */ NavigableSet tailSet(Object obj, boolean z) {
return tailSet((ImmutableSortedSet<E>) obj, z);
}
abstract ImmutableSortedSet<E> tailSetImpl(E e, boolean z);
int unsafeCompare(Object obj, Object obj2) {
return unsafeCompare(this.comparator, obj, obj2);
}
@Override // com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection
Object writeReplace() {
return new SerializedForm(this.comparator, toArray());
}
public static <E> ImmutableSortedSet<E> copyOf(Iterable<? extends E> iterable) {
return copyOf(Ordering.c(), iterable);
}
/* JADX WARN: Incorrect types in method signature: <E::Ljava/lang/Comparable<-TE;>;>(TE;)Lcom/google/common/collect/ImmutableSortedSet<TE;>; */
public static ImmutableSortedSet of(Comparable comparable) {
return new RegularImmutableSortedSet(ImmutableList.of(comparable), Ordering.c());
}
static int unsafeCompare(Comparator<?> comparator, Object obj, Object obj2) {
return comparator.compare(obj, obj2);
}
@Override // java.util.NavigableSet
public ImmutableSortedSet<E> descendingSet() {
ImmutableSortedSet<E> immutableSortedSet = this.descendingSet;
if (immutableSortedSet != null) {
return immutableSortedSet;
}
ImmutableSortedSet<E> createDescendingSet = createDescendingSet();
this.descendingSet = createDescendingSet;
createDescendingSet.descendingSet = this;
return createDescendingSet;
}
/* JADX WARN: Multi-variable type inference failed */
public /* bridge */ /* synthetic */ SortedSet headSet(Object obj) {
return headSet((ImmutableSortedSet<E>) obj);
}
/* JADX WARN: Multi-variable type inference failed */
public /* bridge */ /* synthetic */ SortedSet tailSet(Object obj) {
return tailSet((ImmutableSortedSet<E>) obj);
}
/* JADX WARN: Incorrect types in method signature: <E::Ljava/lang/Comparable<-TE;>;>(TE;TE;)Lcom/google/common/collect/ImmutableSortedSet<TE;>; */
public static ImmutableSortedSet of(Comparable comparable, Comparable comparable2) {
return construct(Ordering.c(), 2, comparable, comparable2);
}
public ImmutableSortedSet<E> headSet(E e) {
return headSet((ImmutableSortedSet<E>) e, false);
}
@Override // java.util.NavigableSet, java.util.SortedSet
public ImmutableSortedSet<E> subSet(E e, E e2) {
return subSet((boolean) e, true, (boolean) e2, false);
}
public ImmutableSortedSet<E> tailSet(E e) {
return tailSet((ImmutableSortedSet<E>) e, true);
}
public static <E> ImmutableSortedSet<E> copyOf(Collection<? extends E> collection) {
return copyOf((Comparator) Ordering.c(), (Collection) collection);
}
/* JADX WARN: Incorrect types in method signature: <E::Ljava/lang/Comparable<-TE;>;>(TE;TE;TE;)Lcom/google/common/collect/ImmutableSortedSet<TE;>; */
public static ImmutableSortedSet of(Comparable comparable, Comparable comparable2, Comparable comparable3) {
return construct(Ordering.c(), 3, comparable, comparable2, comparable3);
}
public ImmutableSortedSet<E> headSet(E e, boolean z) {
Preconditions.a(e);
return headSetImpl(e, z);
}
public ImmutableSortedSet<E> subSet(E e, boolean z, E e2, boolean z2) {
Preconditions.a(e);
Preconditions.a(e2);
Preconditions.a(this.comparator.compare(e, e2) <= 0);
return subSetImpl(e, z, e2, z2);
}
public ImmutableSortedSet<E> tailSet(E e, boolean z) {
Preconditions.a(e);
return tailSetImpl(e, z);
}
/* JADX WARN: Incorrect types in method signature: <E::Ljava/lang/Comparable<-TE;>;>(TE;TE;TE;TE;)Lcom/google/common/collect/ImmutableSortedSet<TE;>; */
public static ImmutableSortedSet of(Comparable comparable, Comparable comparable2, Comparable comparable3, Comparable comparable4) {
return construct(Ordering.c(), 4, comparable, comparable2, comparable3, comparable4);
}
public static <E> ImmutableSortedSet<E> copyOf(Iterator<? extends E> it) {
return copyOf(Ordering.c(), it);
}
/* JADX WARN: Incorrect types in method signature: <E::Ljava/lang/Comparable<-TE;>;>(TE;TE;TE;TE;TE;)Lcom/google/common/collect/ImmutableSortedSet<TE;>; */
public static ImmutableSortedSet of(Comparable comparable, Comparable comparable2, Comparable comparable3, Comparable comparable4, Comparable comparable5) {
return construct(Ordering.c(), 5, comparable, comparable2, comparable3, comparable4, comparable5);
}
/* JADX WARN: Incorrect types in method signature: <E::Ljava/lang/Comparable<-TE;>;>(TE;TE;TE;TE;TE;TE;[TE;)Lcom/google/common/collect/ImmutableSortedSet<TE;>; */
public static ImmutableSortedSet of(Comparable comparable, Comparable comparable2, Comparable comparable3, Comparable comparable4, Comparable comparable5, Comparable comparable6, Comparable... comparableArr) {
Comparable[] comparableArr2 = new Comparable[comparableArr.length + 6];
comparableArr2[0] = comparable;
comparableArr2[1] = comparable2;
comparableArr2[2] = comparable3;
comparableArr2[3] = comparable4;
comparableArr2[4] = comparable5;
comparableArr2[5] = comparable6;
System.arraycopy(comparableArr, 0, comparableArr2, 6, comparableArr.length);
return construct(Ordering.c(), comparableArr2.length, comparableArr2);
}
public static <E> ImmutableSortedSet<E> copyOf(Comparator<? super E> comparator, Iterator<? extends E> it) {
Builder builder = new Builder(comparator);
builder.a((Iterator) it);
return builder.a();
}
public static <E> ImmutableSortedSet<E> copyOf(Comparator<? super E> comparator, Iterable<? extends E> iterable) {
Preconditions.a(comparator);
if (SortedIterables.a(comparator, iterable) && (iterable instanceof ImmutableSortedSet)) {
ImmutableSortedSet<E> immutableSortedSet = (ImmutableSortedSet) iterable;
if (!immutableSortedSet.isPartialView()) {
return immutableSortedSet;
}
}
Object[] e = Iterables.e(iterable);
return construct(comparator, e.length, e);
}
public static <E> ImmutableSortedSet<E> copyOf(Comparator<? super E> comparator, Collection<? extends E> collection) {
return copyOf((Comparator) comparator, (Iterable) collection);
}
}

View File

@@ -0,0 +1,49 @@
package com.google.common.collect;
import com.google.common.collect.ImmutableSortedSet;
/* loaded from: classes.dex */
abstract class ImmutableSortedSetFauxverideShim<E> extends ImmutableSet<E> {
ImmutableSortedSetFauxverideShim() {
}
@Deprecated
public static <E> ImmutableSortedSet.Builder<E> builder() {
throw new UnsupportedOperationException();
}
@Deprecated
public static <E> ImmutableSortedSet<E> copyOf(E[] eArr) {
throw new UnsupportedOperationException();
}
@Deprecated
public static <E> ImmutableSortedSet<E> of(E e) {
throw new UnsupportedOperationException();
}
@Deprecated
public static <E> ImmutableSortedSet<E> of(E e, E e2) {
throw new UnsupportedOperationException();
}
@Deprecated
public static <E> ImmutableSortedSet<E> of(E e, E e2, E e3) {
throw new UnsupportedOperationException();
}
@Deprecated
public static <E> ImmutableSortedSet<E> of(E e, E e2, E e3, E e4) {
throw new UnsupportedOperationException();
}
@Deprecated
public static <E> ImmutableSortedSet<E> of(E e, E e2, E e3, E e4, E e5) {
throw new UnsupportedOperationException();
}
@Deprecated
public static <E> ImmutableSortedSet<E> of(E e, E e2, E e3, E e4, E e5, E e6, E... eArr) {
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,267 @@
package com.google.common.collect;
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Table;
import com.google.common.collect.Tables;
import java.io.Serializable;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
public abstract class ImmutableTable<R, C, V> extends AbstractTable<R, C, V> implements Serializable {
public static final class Builder<R, C, V> {
private final List<Table.Cell<R, C, V>> a = Lists.a();
private Comparator<? super R> b;
private Comparator<? super C> c;
public Builder<R, C, V> a(R r, C c, V v) {
this.a.add(ImmutableTable.cellOf(r, c, v));
return this;
}
public Builder<R, C, V> a(Table.Cell<? extends R, ? extends C, ? extends V> cell) {
if (cell instanceof Tables.ImmutableCell) {
Preconditions.a(cell.b());
Preconditions.a(cell.a());
Preconditions.a(cell.getValue());
this.a.add(cell);
} else {
a(cell.b(), cell.a(), cell.getValue());
}
return this;
}
public ImmutableTable<R, C, V> a() {
int size = this.a.size();
if (size == 0) {
return ImmutableTable.of();
}
if (size != 1) {
return RegularImmutableTable.a((List) this.a, (Comparator) this.b, (Comparator) this.c);
}
return new SingletonImmutableTable((Table.Cell) Iterables.c(this.a));
}
}
static final class SerializedForm implements Serializable {
private final Object[] a;
private final Object[] b;
private final Object[] c;
private final int[] d;
private final int[] e;
private SerializedForm(Object[] objArr, Object[] objArr2, Object[] objArr3, int[] iArr, int[] iArr2) {
this.a = objArr;
this.b = objArr2;
this.c = objArr3;
this.d = iArr;
this.e = iArr2;
}
static SerializedForm a(ImmutableTable<?, ?, ?> immutableTable, int[] iArr, int[] iArr2) {
return new SerializedForm(immutableTable.rowKeySet().toArray(), immutableTable.columnKeySet().toArray(), immutableTable.values().toArray(), iArr, iArr2);
}
Object readResolve() {
Object[] objArr = this.c;
if (objArr.length == 0) {
return ImmutableTable.of();
}
int i = 0;
if (objArr.length == 1) {
return ImmutableTable.of(this.a[0], this.b[0], objArr[0]);
}
ImmutableList.Builder builder = new ImmutableList.Builder(objArr.length);
while (true) {
Object[] objArr2 = this.c;
if (i >= objArr2.length) {
return RegularImmutableTable.a(builder.a(), ImmutableSet.copyOf(this.a), ImmutableSet.copyOf(this.b));
}
builder.a((ImmutableList.Builder) ImmutableTable.cellOf(this.a[this.d[i]], this.b[this.e[i]], objArr2[i]));
i++;
}
}
}
ImmutableTable() {
}
public static <R, C, V> Builder<R, C, V> builder() {
return new Builder<>();
}
static <R, C, V> Table.Cell<R, C, V> cellOf(R r, C c, V v) {
Preconditions.a(r);
Preconditions.a(c);
Preconditions.a(v);
return Tables.a(r, c, v);
}
public static <R, C, V> ImmutableTable<R, C, V> copyOf(Table<? extends R, ? extends C, ? extends V> table) {
return table instanceof ImmutableTable ? (ImmutableTable) table : copyOf(table.cellSet());
}
public static <R, C, V> ImmutableTable<R, C, V> of() {
return (ImmutableTable<R, C, V>) SparseImmutableTable.e;
}
@Override // com.google.common.collect.AbstractTable
@Deprecated
public final void clear() {
throw new UnsupportedOperationException();
}
/* JADX WARN: Multi-variable type inference failed */
/* renamed from: column, reason: collision with other method in class */
public /* bridge */ /* synthetic */ Map mo11column(Object obj) {
return column((ImmutableTable<R, C, V>) obj);
}
@Override // com.google.common.collect.Table
public abstract ImmutableMap<C, Map<R, V>> columnMap();
@Override // com.google.common.collect.AbstractTable
public boolean contains(Object obj, Object obj2) {
return get(obj, obj2) != null;
}
@Override // com.google.common.collect.AbstractTable
public /* bridge */ /* synthetic */ boolean containsColumn(Object obj) {
return super.containsColumn(obj);
}
@Override // com.google.common.collect.AbstractTable
public /* bridge */ /* synthetic */ boolean containsRow(Object obj) {
return super.containsRow(obj);
}
@Override // com.google.common.collect.AbstractTable
public boolean containsValue(Object obj) {
return values().contains(obj);
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractTable
public abstract ImmutableSet<Table.Cell<R, C, V>> createCellSet();
abstract SerializedForm createSerializedForm();
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractTable
public abstract ImmutableCollection<V> createValues();
@Override // com.google.common.collect.AbstractTable
public /* bridge */ /* synthetic */ boolean equals(Object obj) {
return super.equals(obj);
}
@Override // com.google.common.collect.AbstractTable
public /* bridge */ /* synthetic */ Object get(Object obj, Object obj2) {
return super.get(obj, obj2);
}
@Override // com.google.common.collect.AbstractTable
public /* bridge */ /* synthetic */ int hashCode() {
return super.hashCode();
}
@Override // com.google.common.collect.AbstractTable
public /* bridge */ /* synthetic */ boolean isEmpty() {
return super.isEmpty();
}
@Override // com.google.common.collect.AbstractTable
@Deprecated
public final V put(R r, C c, V v) {
throw new UnsupportedOperationException();
}
@Override // com.google.common.collect.AbstractTable
@Deprecated
public final void putAll(Table<? extends R, ? extends C, ? extends V> table) {
throw new UnsupportedOperationException();
}
@Override // com.google.common.collect.AbstractTable
@Deprecated
public final V remove(Object obj, Object obj2) {
throw new UnsupportedOperationException();
}
/* JADX WARN: Multi-variable type inference failed */
/* renamed from: row, reason: collision with other method in class */
public /* bridge */ /* synthetic */ Map m12row(Object obj) {
return row((ImmutableTable<R, C, V>) obj);
}
@Override // com.google.common.collect.Table
public abstract ImmutableMap<R, Map<C, V>> rowMap();
@Override // com.google.common.collect.AbstractTable
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
@Override // com.google.common.collect.AbstractTable
final Iterator<V> valuesIterator() {
throw new AssertionError("should never be called");
}
final Object writeReplace() {
return createSerializedForm();
}
public static <R, C, V> ImmutableTable<R, C, V> of(R r, C c, V v) {
return new SingletonImmutableTable(r, c, v);
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractTable
public final UnmodifiableIterator<Table.Cell<R, C, V>> cellIterator() {
throw new AssertionError("should never be called");
}
@Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table
public ImmutableSet<Table.Cell<R, C, V>> cellSet() {
return (ImmutableSet) super.cellSet();
}
public ImmutableMap<R, V> column(C c) {
Preconditions.a(c);
return (ImmutableMap) MoreObjects.a((ImmutableMap) columnMap().get(c), ImmutableMap.of());
}
@Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table
public ImmutableSet<C> columnKeySet() {
return columnMap().keySet();
}
public ImmutableMap<C, V> row(R r) {
Preconditions.a(r);
return (ImmutableMap) MoreObjects.a((ImmutableMap) rowMap().get(r), ImmutableMap.of());
}
@Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table
public ImmutableSet<R> rowKeySet() {
return rowMap().keySet();
}
@Override // com.google.common.collect.AbstractTable
public ImmutableCollection<V> values() {
return (ImmutableCollection) super.values();
}
private static <R, C, V> ImmutableTable<R, C, V> copyOf(Iterable<? extends Table.Cell<? extends R, ? extends C, ? extends V>> iterable) {
Builder builder = builder();
Iterator<? extends Table.Cell<? extends R, ? extends C, ? extends V>> it = iterable.iterator();
while (it.hasNext()) {
builder.a(it.next());
}
return builder.a();
}
}

View File

@@ -0,0 +1,147 @@
package com.google.common.collect;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
/* loaded from: classes.dex */
public final class Iterables {
static <T> T[] a(Iterable<? extends T> iterable, T[] tArr) {
return (T[]) a(iterable).toArray(tArr);
}
public static <T> Iterable<T> b(final Iterable<T> iterable, final Predicate<? super T> predicate) {
Preconditions.a(iterable);
Preconditions.a(predicate);
return new FluentIterable<T>() { // from class: com.google.common.collect.Iterables.4
@Override // java.lang.Iterable
public Iterator<T> iterator() {
return Iterators.b((Iterator) iterable.iterator(), predicate);
}
};
}
public static <T> T c(Iterable<T> iterable) {
return (T) Iterators.e(iterable.iterator());
}
public static boolean d(Iterable<?> iterable) {
return iterable instanceof Collection ? ((Collection) iterable).isEmpty() : !iterable.iterator().hasNext();
}
static Object[] e(Iterable<?> iterable) {
return a(iterable).toArray();
}
public static String f(Iterable<?> iterable) {
return Iterators.i(iterable.iterator());
}
private static <E> Collection<E> a(Iterable<E> iterable) {
return iterable instanceof Collection ? (Collection) iterable : Lists.a(iterable.iterator());
}
public static <T> T b(Iterable<T> iterable) {
if (iterable instanceof List) {
List list = (List) iterable;
if (!list.isEmpty()) {
return (T) a(list);
}
throw new NoSuchElementException();
}
return (T) Iterators.d(iterable.iterator());
}
public static <T> boolean a(Collection<T> collection, Iterable<? extends T> iterable) {
if (iterable instanceof Collection) {
return collection.addAll(Collections2.a(iterable));
}
Preconditions.a(iterable);
return Iterators.a(collection, iterable.iterator());
}
public static <T> Iterable<T> a(Iterable<? extends T> iterable, Iterable<? extends T> iterable2) {
return FluentIterable.a(iterable, iterable2);
}
public static <T> boolean a(Iterable<T> iterable, Predicate<? super T> predicate) {
return Iterators.a(iterable.iterator(), predicate);
}
public static <F, T> Iterable<T> a(final Iterable<F> iterable, final Function<? super F, ? extends T> function) {
Preconditions.a(iterable);
Preconditions.a(function);
return new FluentIterable<T>() { // from class: com.google.common.collect.Iterables.6
@Override // java.lang.Iterable
public Iterator<T> iterator() {
return Iterators.a(iterable.iterator(), function);
}
};
}
public static <T> T a(Iterable<? extends T> iterable, T t) {
return (T) Iterators.b(iterable.iterator(), t);
}
private static <T> T a(List<T> list) {
return list.get(list.size() - 1);
}
public static <T> Iterable<T> a(final Iterable<T> iterable, final int i) {
Preconditions.a(iterable);
Preconditions.a(i >= 0, "number to skip cannot be negative");
if (iterable instanceof List) {
final List list = (List) iterable;
return new FluentIterable<T>() { // from class: com.google.common.collect.Iterables.7
@Override // java.lang.Iterable
public Iterator<T> iterator() {
int min = Math.min(list.size(), i);
List list2 = list;
return list2.subList(min, list2.size()).iterator();
}
};
}
return new FluentIterable<T>() { // from class: com.google.common.collect.Iterables.8
@Override // java.lang.Iterable
public Iterator<T> iterator() {
final Iterator<T> it = iterable.iterator();
Iterators.a((Iterator<?>) it, i);
return new Iterator<T>(this) { // from class: com.google.common.collect.Iterables.8.1
boolean a = true;
@Override // java.util.Iterator
public boolean hasNext() {
return it.hasNext();
}
@Override // java.util.Iterator
public T next() {
T t = (T) it.next();
this.a = false;
return t;
}
@Override // java.util.Iterator
public void remove() {
CollectPreconditions.a(!this.a);
it.remove();
}
};
}
};
}
static <T> Function<Iterable<? extends T>, Iterator<? extends T>> a() {
return new Function<Iterable<? extends T>, Iterator<? extends T>>() { // from class: com.google.common.collect.Iterables.13
@Override // com.google.common.base.Function
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public Iterator<? extends T> apply(Iterable<? extends T> iterable) {
return iterable.iterator();
}
};
}
}

View File

@@ -0,0 +1,419 @@
package com.google.common.collect;
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.primitives.Ints;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Queue;
/* loaded from: classes.dex */
public final class Iterators {
private static final class ArrayItr<T> extends AbstractIndexedListIterator<T> {
static final UnmodifiableListIterator<Object> e = new ArrayItr(new Object[0], 0, 0, 0);
private final T[] c;
private final int d;
ArrayItr(T[] tArr, int i, int i2, int i3) {
super(i2, i3);
this.c = tArr;
this.d = i;
}
@Override // com.google.common.collect.AbstractIndexedListIterator
protected T a(int i) {
return this.c[this.d + i];
}
}
private static class ConcatenatedIterator<T> extends MultitransformedIterator<Iterator<? extends T>, T> {
public ConcatenatedIterator(Iterator<? extends Iterator<? extends T>> it) {
super(c(it));
}
/* JADX INFO: Access modifiers changed from: private */
public static <T> Iterator<Iterator<? extends T>> c(Iterator<? extends Iterator<? extends T>> it) {
return new MultitransformedIterator<Iterator<? extends T>, Iterator<? extends T>>(it) { // from class: com.google.common.collect.Iterators.ConcatenatedIterator.1
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.MultitransformedIterator
public Iterator<? extends Iterator<? extends T>> a(Iterator<? extends T> it2) {
if (it2 instanceof ConcatenatedIterator) {
ConcatenatedIterator concatenatedIterator = (ConcatenatedIterator) it2;
if (!concatenatedIterator.b.hasNext()) {
return ConcatenatedIterator.c(concatenatedIterator.a);
}
}
return Iterators.a(it2);
}
};
}
@Override // com.google.common.collect.MultitransformedIterator
/* bridge */ /* synthetic */ Iterator a(Object obj) {
Iterator<? extends T> it = (Iterator) obj;
a((Iterator) it);
return it;
}
Iterator<? extends T> a(Iterator<? extends T> it) {
return it;
}
}
private enum EmptyModifiableIterator implements Iterator<Object> {
INSTANCE;
@Override // java.util.Iterator
public boolean hasNext() {
return false;
}
@Override // java.util.Iterator
public Object next() {
throw new NoSuchElementException();
}
@Override // java.util.Iterator
public void remove() {
CollectPreconditions.a(false);
}
}
private static class MergingIterator<T> extends UnmodifiableIterator<T> {
final Queue<PeekingIterator<T>> a;
public MergingIterator(Iterable<? extends Iterator<? extends T>> iterable, final Comparator<? super T> comparator) {
this.a = new PriorityQueue(2, new Comparator<PeekingIterator<T>>(this) { // from class: com.google.common.collect.Iterators.MergingIterator.1
@Override // java.util.Comparator
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public int compare(PeekingIterator<T> peekingIterator, PeekingIterator<T> peekingIterator2) {
return comparator.compare(peekingIterator.peek(), peekingIterator2.peek());
}
});
for (Iterator<? extends T> it : iterable) {
if (it.hasNext()) {
this.a.add(Iterators.f(it));
}
}
}
@Override // java.util.Iterator
public boolean hasNext() {
return !this.a.isEmpty();
}
@Override // java.util.Iterator
public T next() {
PeekingIterator<T> remove = this.a.remove();
T next = remove.next();
if (remove.hasNext()) {
this.a.add(remove);
}
return next;
}
}
private static class PeekingImpl<E> implements PeekingIterator<E> {
private final Iterator<? extends E> a;
private boolean b;
private E c;
public PeekingImpl(Iterator<? extends E> it) {
Preconditions.a(it);
this.a = it;
}
@Override // java.util.Iterator
public boolean hasNext() {
return this.b || this.a.hasNext();
}
@Override // com.google.common.collect.PeekingIterator, java.util.Iterator
public E next() {
if (!this.b) {
return this.a.next();
}
E e = this.c;
this.b = false;
this.c = null;
return e;
}
@Override // com.google.common.collect.PeekingIterator
public E peek() {
if (!this.b) {
this.c = this.a.next();
this.b = true;
}
return this.c;
}
@Override // java.util.Iterator
public void remove() {
Preconditions.b(!this.b, "Can't remove after you've peeked at next");
this.a.remove();
}
}
static <T> UnmodifiableIterator<T> a() {
return b();
}
static <T> UnmodifiableListIterator<T> b() {
return (UnmodifiableListIterator<T>) ArrayItr.e;
}
static <T> Iterator<T> c() {
return EmptyModifiableIterator.INSTANCE;
}
public static <T> T d(Iterator<T> it) {
T next;
do {
next = it.next();
} while (it.hasNext());
return next;
}
public static <T> T e(Iterator<T> it) {
T next = it.next();
if (!it.hasNext()) {
return next;
}
StringBuilder sb = new StringBuilder();
sb.append("expected one element but was: <");
sb.append(next);
for (int i = 0; i < 4 && it.hasNext(); i++) {
sb.append(", ");
sb.append(it.next());
}
if (it.hasNext()) {
sb.append(", ...");
}
sb.append('>');
throw new IllegalArgumentException(sb.toString());
}
public static <T> PeekingIterator<T> f(Iterator<? extends T> it) {
return it instanceof PeekingImpl ? (PeekingImpl) it : new PeekingImpl(it);
}
static <T> T g(Iterator<T> it) {
if (!it.hasNext()) {
return null;
}
T next = it.next();
it.remove();
return next;
}
public static int h(Iterator<?> it) {
long j = 0;
while (it.hasNext()) {
it.next();
j++;
}
return Ints.b(j);
}
public static String i(Iterator<?> it) {
StringBuilder sb = new StringBuilder();
sb.append('[');
boolean z = true;
while (it.hasNext()) {
if (!z) {
sb.append(", ");
}
z = false;
sb.append(it.next());
}
sb.append(']');
return sb.toString();
}
public static <T> UnmodifiableIterator<T> j(final Iterator<? extends T> it) {
Preconditions.a(it);
return it instanceof UnmodifiableIterator ? (UnmodifiableIterator) it : new UnmodifiableIterator<T>() { // from class: com.google.common.collect.Iterators.1
@Override // java.util.Iterator
public boolean hasNext() {
return it.hasNext();
}
@Override // java.util.Iterator
public T next() {
return (T) it.next();
}
};
}
public static boolean a(Iterator<?> it, Object obj) {
if (obj == null) {
while (it.hasNext()) {
if (it.next() == null) {
return true;
}
}
return false;
}
while (it.hasNext()) {
if (obj.equals(it.next())) {
return true;
}
}
return false;
}
public static boolean b(Iterator<?> it, Collection<?> collection) {
Preconditions.a(collection);
boolean z = false;
while (it.hasNext()) {
if (!collection.contains(it.next())) {
it.remove();
z = true;
}
}
return z;
}
public static <T> Iterator<T> c(Iterator<? extends Iterator<? extends T>> it) {
return new ConcatenatedIterator(it);
}
public static boolean a(Iterator<?> it, Collection<?> collection) {
Preconditions.a(collection);
boolean z = false;
while (it.hasNext()) {
if (collection.contains(it.next())) {
it.remove();
z = true;
}
}
return z;
}
public static <T> UnmodifiableIterator<T> b(final Iterator<T> it, final Predicate<? super T> predicate) {
Preconditions.a(it);
Preconditions.a(predicate);
return new AbstractIterator<T>() { // from class: com.google.common.collect.Iterators.4
@Override // com.google.common.collect.AbstractIterator
protected T a() {
while (it.hasNext()) {
T t = (T) it.next();
if (predicate.apply(t)) {
return t;
}
}
return b();
}
};
}
public static <T> T b(Iterator<? extends T> it, T t) {
return it.hasNext() ? it.next() : t;
}
public static boolean a(Iterator<?> it, Iterator<?> it2) {
while (it.hasNext()) {
if (!it2.hasNext() || !Objects.a(it.next(), it2.next())) {
return false;
}
}
return !it2.hasNext();
}
static void b(Iterator<?> it) {
Preconditions.a(it);
while (it.hasNext()) {
it.next();
it.remove();
}
}
public static <T> boolean a(Collection<T> collection, Iterator<? extends T> it) {
Preconditions.a(collection);
Preconditions.a(it);
boolean z = false;
while (it.hasNext()) {
z |= collection.add(it.next());
}
return z;
}
public static <T> boolean a(Iterator<T> it, Predicate<? super T> predicate) {
Preconditions.a(predicate);
while (it.hasNext()) {
if (!predicate.apply(it.next())) {
return false;
}
}
return true;
}
public static <F, T> Iterator<T> a(Iterator<F> it, final Function<? super F, ? extends T> function) {
Preconditions.a(function);
return new TransformedIterator<F, T>(it) { // from class: com.google.common.collect.Iterators.5
@Override // com.google.common.collect.TransformedIterator
T a(F f) {
return (T) function.apply(f);
}
};
}
public static int a(Iterator<?> it, int i) {
Preconditions.a(it);
int i2 = 0;
Preconditions.a(i >= 0, "numberToAdvance must be nonnegative");
while (i2 < i && it.hasNext()) {
it.next();
i2++;
}
return i2;
}
static <T> UnmodifiableListIterator<T> a(T[] tArr, int i, int i2, int i3) {
Preconditions.a(i2 >= 0);
Preconditions.b(i, i + i2, tArr.length);
Preconditions.b(i3, i2);
if (i2 == 0) {
return b();
}
return new ArrayItr(tArr, i, i2, i3);
}
public static <T> UnmodifiableIterator<T> a(final T t) {
return new UnmodifiableIterator<T>() { // from class: com.google.common.collect.Iterators.8
boolean a;
@Override // java.util.Iterator
public boolean hasNext() {
return !this.a;
}
@Override // java.util.Iterator
public T next() {
if (this.a) {
throw new NoSuchElementException();
}
this.a = true;
return (T) t;
}
};
}
public static <T> UnmodifiableIterator<T> a(Iterable<? extends Iterator<? extends T>> iterable, Comparator<? super T> comparator) {
Preconditions.a(iterable, "iterators");
Preconditions.a(comparator, "comparator");
return new MergingIterator(iterable, comparator);
}
static <T> ListIterator<T> a(Iterator<T> it) {
return (ListIterator) it;
}
}

View File

@@ -0,0 +1,515 @@
package com.google.common.collect;
import com.google.common.base.Objects;
import com.google.common.collect.Sets;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Arrays;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
/* loaded from: classes.dex */
public final class LinkedHashMultimap<K, V> extends LinkedHashMultimapGwtSerializationDependencies<K, V> {
private static final int DEFAULT_KEY_CAPACITY = 16;
private static final int DEFAULT_VALUE_SET_CAPACITY = 2;
static final double VALUE_SET_LOAD_FACTOR = 1.0d;
private static final long serialVersionUID = 1;
private transient ValueEntry<K, V> multimapHeaderEntry;
transient int valueSetCapacity;
static final class ValueEntry<K, V> extends ImmutableEntry<K, V> implements ValueSetLink<K, V> {
final int c;
ValueEntry<K, V> d;
ValueSetLink<K, V> e;
ValueSetLink<K, V> f;
ValueEntry<K, V> g;
ValueEntry<K, V> h;
ValueEntry(K k, V v, int i, ValueEntry<K, V> valueEntry) {
super(k, v);
this.c = i;
this.d = valueEntry;
}
boolean a(Object obj, int i) {
return this.c == i && Objects.a(getValue(), obj);
}
@Override // com.google.common.collect.LinkedHashMultimap.ValueSetLink
public ValueSetLink<K, V> b() {
return this.f;
}
public ValueEntry<K, V> c() {
return this.g;
}
public ValueEntry<K, V> d() {
return this.h;
}
@Override // com.google.common.collect.LinkedHashMultimap.ValueSetLink
public ValueSetLink<K, V> a() {
return this.e;
}
@Override // com.google.common.collect.LinkedHashMultimap.ValueSetLink
public void b(ValueSetLink<K, V> valueSetLink) {
this.e = valueSetLink;
}
@Override // com.google.common.collect.LinkedHashMultimap.ValueSetLink
public void a(ValueSetLink<K, V> valueSetLink) {
this.f = valueSetLink;
}
public void b(ValueEntry<K, V> valueEntry) {
this.h = valueEntry;
}
public void a(ValueEntry<K, V> valueEntry) {
this.g = valueEntry;
}
}
final class ValueSet extends Sets.ImprovedAbstractSet<V> implements ValueSetLink<K, V> {
private final K a;
ValueEntry<K, V>[] b;
private int c = 0;
private int d = 0;
private ValueSetLink<K, V> e = this;
private ValueSetLink<K, V> f = this;
ValueSet(K k, int i) {
this.a = k;
this.b = new ValueEntry[Hashing.a(i, LinkedHashMultimap.VALUE_SET_LOAD_FACTOR)];
}
private int c() {
return this.b.length - 1;
}
private void d() {
if (Hashing.a(this.c, this.b.length, LinkedHashMultimap.VALUE_SET_LOAD_FACTOR)) {
ValueEntry<K, V>[] valueEntryArr = new ValueEntry[this.b.length * 2];
this.b = valueEntryArr;
int length = valueEntryArr.length - 1;
for (ValueSetLink<K, V> valueSetLink = this.e; valueSetLink != this; valueSetLink = valueSetLink.b()) {
ValueEntry<K, V> valueEntry = (ValueEntry) valueSetLink;
int i = valueEntry.c & length;
valueEntry.d = valueEntryArr[i];
valueEntryArr[i] = valueEntry;
}
}
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean add(V v) {
int a = Hashing.a(v);
int c = c() & a;
ValueEntry<K, V> valueEntry = this.b[c];
for (ValueEntry<K, V> valueEntry2 = valueEntry; valueEntry2 != null; valueEntry2 = valueEntry2.d) {
if (valueEntry2.a(v, a)) {
return false;
}
}
ValueEntry<K, V> valueEntry3 = new ValueEntry<>(this.a, v, a, valueEntry);
LinkedHashMultimap.succeedsInValueSet(this.f, valueEntry3);
LinkedHashMultimap.succeedsInValueSet(valueEntry3, this);
LinkedHashMultimap.succeedsInMultimap(LinkedHashMultimap.this.multimapHeaderEntry.c(), valueEntry3);
LinkedHashMultimap.succeedsInMultimap(valueEntry3, LinkedHashMultimap.this.multimapHeaderEntry);
this.b[c] = valueEntry3;
this.c++;
this.d++;
d();
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
Arrays.fill(this.b, (Object) null);
this.c = 0;
for (ValueSetLink<K, V> valueSetLink = this.e; valueSetLink != this; valueSetLink = valueSetLink.b()) {
LinkedHashMultimap.deleteFromMultimap((ValueEntry) valueSetLink);
}
LinkedHashMultimap.succeedsInValueSet(this, this);
this.d++;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
int a = Hashing.a(obj);
for (ValueEntry<K, V> valueEntry = this.b[c() & a]; valueEntry != null; valueEntry = valueEntry.d) {
if (valueEntry.a(obj, a)) {
return true;
}
}
return false;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<V> iterator() {
return new Iterator<V>() { // from class: com.google.common.collect.LinkedHashMultimap.ValueSet.1
ValueSetLink<K, V> a;
ValueEntry<K, V> b;
int c;
{
this.a = ValueSet.this.e;
this.c = ValueSet.this.d;
}
private void a() {
if (ValueSet.this.d != this.c) {
throw new ConcurrentModificationException();
}
}
@Override // java.util.Iterator
public boolean hasNext() {
a();
return this.a != ValueSet.this;
}
@Override // java.util.Iterator
public V next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
ValueEntry<K, V> valueEntry = (ValueEntry) this.a;
V value = valueEntry.getValue();
this.b = valueEntry;
this.a = valueEntry.b();
return value;
}
@Override // java.util.Iterator
public void remove() {
a();
CollectPreconditions.a(this.b != null);
ValueSet.this.remove(this.b.getValue());
this.c = ValueSet.this.d;
this.b = null;
}
};
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
int a = Hashing.a(obj);
int c = c() & a;
ValueEntry<K, V> valueEntry = this.b[c];
ValueEntry<K, V> valueEntry2 = null;
while (true) {
ValueEntry<K, V> valueEntry3 = valueEntry2;
valueEntry2 = valueEntry;
if (valueEntry2 == null) {
return false;
}
if (valueEntry2.a(obj, a)) {
if (valueEntry3 == null) {
this.b[c] = valueEntry2.d;
} else {
valueEntry3.d = valueEntry2.d;
}
LinkedHashMultimap.deleteFromValueSet(valueEntry2);
LinkedHashMultimap.deleteFromMultimap(valueEntry2);
this.c--;
this.d++;
return true;
}
valueEntry = valueEntry2.d;
}
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return this.c;
}
@Override // com.google.common.collect.LinkedHashMultimap.ValueSetLink
public ValueSetLink<K, V> a() {
return this.f;
}
@Override // com.google.common.collect.LinkedHashMultimap.ValueSetLink
public ValueSetLink<K, V> b() {
return this.e;
}
@Override // com.google.common.collect.LinkedHashMultimap.ValueSetLink
public void a(ValueSetLink<K, V> valueSetLink) {
this.e = valueSetLink;
}
@Override // com.google.common.collect.LinkedHashMultimap.ValueSetLink
public void b(ValueSetLink<K, V> valueSetLink) {
this.f = valueSetLink;
}
}
private interface ValueSetLink<K, V> {
ValueSetLink<K, V> a();
void a(ValueSetLink<K, V> valueSetLink);
ValueSetLink<K, V> b();
void b(ValueSetLink<K, V> valueSetLink);
}
private LinkedHashMultimap(int i, int i2) {
super(new LinkedHashMap(i));
this.valueSetCapacity = 2;
CollectPreconditions.a(i2, "expectedValuesPerKey");
this.valueSetCapacity = i2;
this.multimapHeaderEntry = new ValueEntry<>(null, null, 0, null);
ValueEntry<K, V> valueEntry = this.multimapHeaderEntry;
succeedsInMultimap(valueEntry, valueEntry);
}
public static <K, V> LinkedHashMultimap<K, V> create() {
return new LinkedHashMultimap<>(16, 2);
}
/* JADX INFO: Access modifiers changed from: private */
public static <K, V> void deleteFromMultimap(ValueEntry<K, V> valueEntry) {
succeedsInMultimap(valueEntry.c(), valueEntry.d());
}
/* JADX INFO: Access modifiers changed from: private */
public static <K, V> void deleteFromValueSet(ValueSetLink<K, V> valueSetLink) {
succeedsInValueSet(valueSetLink.a(), valueSetLink.b());
}
/* JADX WARN: Multi-variable type inference failed */
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
objectInputStream.defaultReadObject();
this.multimapHeaderEntry = new ValueEntry<>(null, null, 0, null);
ValueEntry<K, V> valueEntry = this.multimapHeaderEntry;
succeedsInMultimap(valueEntry, valueEntry);
this.valueSetCapacity = 2;
int readInt = objectInputStream.readInt();
LinkedHashMap linkedHashMap = new LinkedHashMap();
for (int i = 0; i < readInt; i++) {
Object readObject = objectInputStream.readObject();
linkedHashMap.put(readObject, createCollection(readObject));
}
int readInt2 = objectInputStream.readInt();
for (int i2 = 0; i2 < readInt2; i2++) {
Object readObject2 = objectInputStream.readObject();
((Collection) linkedHashMap.get(readObject2)).add(objectInputStream.readObject());
}
setMap(linkedHashMap);
}
/* JADX INFO: Access modifiers changed from: private */
public static <K, V> void succeedsInMultimap(ValueEntry<K, V> valueEntry, ValueEntry<K, V> valueEntry2) {
valueEntry.b((ValueEntry) valueEntry2);
valueEntry2.a((ValueEntry) valueEntry);
}
/* JADX INFO: Access modifiers changed from: private */
public static <K, V> void succeedsInValueSet(ValueSetLink<K, V> valueSetLink, ValueSetLink<K, V> valueSetLink2) {
valueSetLink.a(valueSetLink2);
valueSetLink2.b(valueSetLink);
}
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
objectOutputStream.defaultWriteObject();
objectOutputStream.writeInt(keySet().size());
Iterator<K> it = keySet().iterator();
while (it.hasNext()) {
objectOutputStream.writeObject(it.next());
}
objectOutputStream.writeInt(size());
for (Map.Entry<K, V> entry : entries()) {
objectOutputStream.writeObject(entry.getKey());
objectOutputStream.writeObject(entry.getValue());
}
}
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Map asMap() {
return super.asMap();
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public void clear() {
super.clear();
ValueEntry<K, V> valueEntry = this.multimapHeaderEntry;
succeedsInMultimap(valueEntry, valueEntry);
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean containsEntry(Object obj, Object obj2) {
return super.containsEntry(obj, obj2);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean containsKey(Object obj) {
return super.containsKey(obj);
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ boolean containsValue(Object obj) {
return super.containsValue(obj);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap
Iterator<Map.Entry<K, V>> entryIterator() {
return new Iterator<Map.Entry<K, V>>() { // from class: com.google.common.collect.LinkedHashMultimap.1
ValueEntry<K, V> a;
ValueEntry<K, V> b;
{
this.a = LinkedHashMultimap.this.multimapHeaderEntry.h;
}
@Override // java.util.Iterator
public boolean hasNext() {
return this.a != LinkedHashMultimap.this.multimapHeaderEntry;
}
@Override // java.util.Iterator
public void remove() {
CollectPreconditions.a(this.b != null);
LinkedHashMultimap.this.remove(this.b.getKey(), this.b.getValue());
this.b = null;
}
@Override // java.util.Iterator
public Map.Entry<K, V> next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
ValueEntry<K, V> valueEntry = this.a;
this.b = valueEntry;
this.a = valueEntry.h;
return valueEntry;
}
};
}
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ boolean equals(Object obj) {
return super.equals(obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Set get(Object obj) {
return super.get((LinkedHashMultimap<K, V>) obj);
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ int hashCode() {
return super.hashCode();
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean isEmpty() {
return super.isEmpty();
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public Set<K> keySet() {
return super.keySet();
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ Multiset keys() {
return super.keys();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean put(Object obj, Object obj2) {
return super.put(obj, obj2);
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ boolean putAll(Multimap multimap) {
return super.putAll(multimap);
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean remove(Object obj, Object obj2) {
return super.remove(obj, obj2);
}
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Set removeAll(Object obj) {
return super.removeAll(obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ Collection replaceValues(Object obj, Iterable iterable) {
return replaceValues((LinkedHashMultimap<K, V>) obj, iterable);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ int size() {
return super.size();
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap
Iterator<V> valueIterator() {
return Maps.b(entryIterator());
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap
public Collection<V> values() {
return super.values();
}
public static <K, V> LinkedHashMultimap<K, V> create(int i, int i2) {
return new LinkedHashMultimap<>(Maps.a(i), Maps.a(i2));
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap
public Set<V> createCollection() {
return new LinkedHashSet(this.valueSetCapacity);
}
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public Set<Map.Entry<K, V>> entries() {
return super.entries();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean putAll(Object obj, Iterable iterable) {
return super.putAll(obj, iterable);
}
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap
public Set<V> replaceValues(K k, Iterable<? extends V> iterable) {
return super.replaceValues((LinkedHashMultimap<K, V>) k, (Iterable) iterable);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap
Collection<V> createCollection(K k) {
return new ValueSet(k, this.valueSetCapacity);
}
public static <K, V> LinkedHashMultimap<K, V> create(Multimap<? extends K, ? extends V> multimap) {
LinkedHashMultimap<K, V> create = create(multimap.keySet().size(), 2);
create.putAll(multimap);
return create;
}
}

View File

@@ -0,0 +1,11 @@
package com.google.common.collect;
import java.util.Collection;
import java.util.Map;
/* loaded from: classes.dex */
abstract class LinkedHashMultimapGwtSerializationDependencies<K, V> extends AbstractSetMultimap<K, V> {
LinkedHashMultimapGwtSerializationDependencies(Map<K, Collection<V>> map) {
super(map);
}
}

View File

@@ -0,0 +1,156 @@
package com.google.common.collect;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
/* loaded from: classes.dex */
public final class LinkedHashMultiset<E> extends AbstractMapBasedMultiset<E> {
private static final long serialVersionUID = 0;
private LinkedHashMultiset() {
super(new ObjectCountLinkedHashMap());
}
public static <E> LinkedHashMultiset<E> create() {
return new LinkedHashMultiset<>();
}
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
objectInputStream.defaultReadObject();
int a = Serialization.a(objectInputStream);
setBackingMap(new ObjectCountLinkedHashMap());
Serialization.a(this, objectInputStream, a);
}
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
objectOutputStream.defaultWriteObject();
Serialization.a(this, objectOutputStream);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ int add(Object obj, int i) {
return super.add(obj, i);
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public /* bridge */ /* synthetic */ boolean addAll(Collection collection) {
return super.addAll(collection);
}
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public /* bridge */ /* synthetic */ void clear() {
super.clear();
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ boolean contains(Object obj) {
return super.contains(obj);
}
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ int count(Object obj) {
return super.count(obj);
}
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset
public /* bridge */ /* synthetic */ Set createEntrySet() {
return super.createEntrySet();
}
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ Set elementSet() {
return super.elementSet();
}
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ Set entrySet() {
return super.entrySet();
}
@Override // com.google.common.collect.AbstractMultiset, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ boolean equals(Object obj) {
return super.equals(obj);
}
@Override // com.google.common.collect.AbstractMultiset, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ int hashCode() {
return super.hashCode();
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public /* bridge */ /* synthetic */ boolean isEmpty() {
return super.isEmpty();
}
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public /* bridge */ /* synthetic */ Iterator iterator() {
return super.iterator();
}
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ int remove(Object obj, int i) {
return super.remove(obj, i);
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public /* bridge */ /* synthetic */ boolean removeAll(Collection collection) {
return super.removeAll(collection);
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection
public /* bridge */ /* synthetic */ boolean retainAll(Collection collection) {
return super.retainAll(collection);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ int setCount(Object obj, int i) {
return super.setCount(obj, i);
}
@Override // com.google.common.collect.AbstractMapBasedMultiset, com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ int size() {
return super.size();
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
private LinkedHashMultiset(int i) {
super(new ObjectCountLinkedHashMap(i));
}
public static <E> LinkedHashMultiset<E> create(int i) {
return new LinkedHashMultiset<>(i);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ boolean add(Object obj) {
return super.add(obj);
}
@Override // com.google.common.collect.AbstractMultiset, java.util.AbstractCollection, java.util.Collection, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ boolean remove(Object obj) {
return super.remove(obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMultiset, com.google.common.collect.Multiset
public /* bridge */ /* synthetic */ boolean setCount(Object obj, int i, int i2) {
return super.setCount(obj, i, i2);
}
public static <E> LinkedHashMultiset<E> create(Iterable<? extends E> iterable) {
LinkedHashMultiset<E> create = create(Multisets.b(iterable));
Iterables.a((Collection) create, (Iterable) iterable);
return create;
}
}

View File

@@ -0,0 +1,746 @@
package com.google.common.collect;
import com.google.common.base.Preconditions;
import com.google.common.collect.Multimaps;
import com.google.common.collect.Sets;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.AbstractSequentialList;
import java.util.Collection;
import java.util.Collections;
import java.util.ConcurrentModificationException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
/* loaded from: classes.dex */
public class LinkedListMultimap<K, V> extends AbstractMultimap<K, V> implements ListMultimap<K, V>, Serializable {
private static final long serialVersionUID = 0;
private transient Node<K, V> head;
private transient Map<K, KeyList<K, V>> keyToKeyList;
private transient int modCount;
private transient int size;
private transient Node<K, V> tail;
private class DistinctKeyIterator implements Iterator<K> {
final Set<K> a;
Node<K, V> b;
Node<K, V> c;
int d;
private DistinctKeyIterator() {
this.a = Sets.a(LinkedListMultimap.this.keySet().size());
this.b = LinkedListMultimap.this.head;
this.d = LinkedListMultimap.this.modCount;
}
private void a() {
if (LinkedListMultimap.this.modCount != this.d) {
throw new ConcurrentModificationException();
}
}
@Override // java.util.Iterator
public boolean hasNext() {
a();
return this.b != null;
}
@Override // java.util.Iterator
public K next() {
Node<K, V> node;
a();
LinkedListMultimap.checkElement(this.b);
this.c = this.b;
this.a.add(this.c.a);
do {
this.b = this.b.c;
node = this.b;
if (node == null) {
break;
}
} while (!this.a.add(node.a));
return this.c.a;
}
@Override // java.util.Iterator
public void remove() {
a();
CollectPreconditions.a(this.c != null);
LinkedListMultimap.this.removeAllNodes(this.c.a);
this.c = null;
this.d = LinkedListMultimap.this.modCount;
}
}
private static class KeyList<K, V> {
Node<K, V> a;
Node<K, V> b;
int c;
KeyList(Node<K, V> node) {
this.a = node;
this.b = node;
node.f = null;
node.e = null;
this.c = 1;
}
}
private static final class Node<K, V> extends AbstractMapEntry<K, V> {
final K a;
V b;
Node<K, V> c;
Node<K, V> d;
Node<K, V> e;
Node<K, V> f;
Node(K k, V v) {
this.a = k;
this.b = v;
}
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public K getKey() {
return this.a;
}
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public V getValue() {
return this.b;
}
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public V setValue(V v) {
V v2 = this.b;
this.b = v;
return v2;
}
}
private class NodeIterator implements ListIterator<Map.Entry<K, V>> {
int a;
Node<K, V> b;
Node<K, V> c;
Node<K, V> d;
int e;
NodeIterator(int i) {
this.e = LinkedListMultimap.this.modCount;
int size = LinkedListMultimap.this.size();
Preconditions.b(i, size);
if (i < size / 2) {
this.b = LinkedListMultimap.this.head;
while (true) {
int i2 = i - 1;
if (i <= 0) {
break;
}
next();
i = i2;
}
} else {
this.d = LinkedListMultimap.this.tail;
this.a = size;
while (true) {
int i3 = i + 1;
if (i >= size) {
break;
}
previous();
i = i3;
}
}
this.c = null;
}
private void a() {
if (LinkedListMultimap.this.modCount != this.e) {
throw new ConcurrentModificationException();
}
}
@Override // java.util.ListIterator
public /* bridge */ /* synthetic */ void add(Object obj) {
a((Map.Entry) obj);
throw null;
}
public void b(Map.Entry<K, V> entry) {
throw new UnsupportedOperationException();
}
@Override // java.util.ListIterator, java.util.Iterator
public boolean hasNext() {
a();
return this.b != null;
}
@Override // java.util.ListIterator
public boolean hasPrevious() {
a();
return this.d != null;
}
@Override // java.util.ListIterator
public int nextIndex() {
return this.a;
}
@Override // java.util.ListIterator
public int previousIndex() {
return this.a - 1;
}
@Override // java.util.ListIterator, java.util.Iterator
public void remove() {
a();
CollectPreconditions.a(this.c != null);
Node<K, V> node = this.c;
if (node != this.b) {
this.d = node.d;
this.a--;
} else {
this.b = node.c;
}
LinkedListMultimap.this.removeNode(this.c);
this.c = null;
this.e = LinkedListMultimap.this.modCount;
}
@Override // java.util.ListIterator
public /* bridge */ /* synthetic */ void set(Object obj) {
b((Map.Entry) obj);
throw null;
}
@Override // java.util.ListIterator, java.util.Iterator
public Node<K, V> next() {
a();
LinkedListMultimap.checkElement(this.b);
Node<K, V> node = this.b;
this.c = node;
this.d = node;
this.b = node.c;
this.a++;
return this.c;
}
@Override // java.util.ListIterator
public Node<K, V> previous() {
a();
LinkedListMultimap.checkElement(this.d);
Node<K, V> node = this.d;
this.c = node;
this.b = node;
this.d = node.d;
this.a--;
return this.c;
}
public void a(Map.Entry<K, V> entry) {
throw new UnsupportedOperationException();
}
void a(V v) {
Preconditions.b(this.c != null);
this.c.b = v;
}
}
LinkedListMultimap() {
this.keyToKeyList = Maps.b();
}
/* JADX INFO: Access modifiers changed from: private */
public Node<K, V> addNode(K k, V v, Node<K, V> node) {
Node<K, V> node2 = new Node<>(k, v);
if (this.head == null) {
this.tail = node2;
this.head = node2;
this.keyToKeyList.put(k, new KeyList<>(node2));
this.modCount++;
} else if (node == null) {
Node<K, V> node3 = this.tail;
node3.c = node2;
node2.d = node3;
this.tail = node2;
KeyList<K, V> keyList = this.keyToKeyList.get(k);
if (keyList == null) {
this.keyToKeyList.put(k, new KeyList<>(node2));
this.modCount++;
} else {
keyList.c++;
Node<K, V> node4 = keyList.b;
node4.e = node2;
node2.f = node4;
keyList.b = node2;
}
} else {
this.keyToKeyList.get(k).c++;
node2.d = node.d;
node2.f = node.f;
node2.c = node;
node2.e = node;
Node<K, V> node5 = node.f;
if (node5 == null) {
this.keyToKeyList.get(k).a = node2;
} else {
node5.e = node2;
}
Node<K, V> node6 = node.d;
if (node6 == null) {
this.head = node2;
} else {
node6.c = node2;
}
node.d = node2;
node.f = node2;
}
this.size++;
return node2;
}
/* JADX INFO: Access modifiers changed from: private */
public static void checkElement(Object obj) {
if (obj == null) {
throw new NoSuchElementException();
}
}
public static <K, V> LinkedListMultimap<K, V> create() {
return new LinkedListMultimap<>();
}
private List<V> getCopy(Object obj) {
return Collections.unmodifiableList(Lists.a(new ValueForKeyIterator(obj)));
}
/* JADX WARN: Multi-variable type inference failed */
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
objectInputStream.defaultReadObject();
this.keyToKeyList = Maps.c();
int readInt = objectInputStream.readInt();
for (int i = 0; i < readInt; i++) {
put(objectInputStream.readObject(), objectInputStream.readObject());
}
}
/* JADX INFO: Access modifiers changed from: private */
public void removeAllNodes(Object obj) {
Iterators.b(new ValueForKeyIterator(obj));
}
/* JADX INFO: Access modifiers changed from: private */
public void removeNode(Node<K, V> node) {
Node<K, V> node2 = node.d;
if (node2 != null) {
node2.c = node.c;
} else {
this.head = node.c;
}
Node<K, V> node3 = node.c;
if (node3 != null) {
node3.d = node.d;
} else {
this.tail = node.d;
}
if (node.f == null && node.e == null) {
this.keyToKeyList.remove(node.a).c = 0;
this.modCount++;
} else {
KeyList<K, V> keyList = this.keyToKeyList.get(node.a);
keyList.c--;
Node<K, V> node4 = node.f;
if (node4 == null) {
keyList.a = node.e;
} else {
node4.e = node.e;
}
Node<K, V> node5 = node.e;
if (node5 == null) {
keyList.b = node.f;
} else {
node5.f = node.f;
}
}
this.size--;
}
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
objectOutputStream.defaultWriteObject();
objectOutputStream.writeInt(size());
for (Map.Entry<K, V> entry : entries()) {
objectOutputStream.writeObject(entry.getKey());
objectOutputStream.writeObject(entry.getValue());
}
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Map asMap() {
return super.asMap();
}
@Override // com.google.common.collect.Multimap
public void clear() {
this.head = null;
this.tail = null;
this.keyToKeyList.clear();
this.size = 0;
this.modCount++;
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean containsEntry(Object obj, Object obj2) {
return super.containsEntry(obj, obj2);
}
@Override // com.google.common.collect.Multimap
public boolean containsKey(Object obj) {
return this.keyToKeyList.containsKey(obj);
}
@Override // com.google.common.collect.AbstractMultimap
public boolean containsValue(Object obj) {
return values().contains(obj);
}
@Override // com.google.common.collect.AbstractMultimap
Map<K, Collection<V>> createAsMap() {
return new Multimaps.AsMap(this);
}
@Override // com.google.common.collect.AbstractMultimap
Set<K> createKeySet() {
return new Sets.ImprovedAbstractSet<K>() { // from class: com.google.common.collect.LinkedListMultimap.1KeySetImpl
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return LinkedListMultimap.this.containsKey(obj);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<K> iterator() {
return new DistinctKeyIterator();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
return !LinkedListMultimap.this.removeAll(obj).isEmpty();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return LinkedListMultimap.this.keyToKeyList.size();
}
};
}
@Override // com.google.common.collect.AbstractMultimap
Iterator<Map.Entry<K, V>> entryIterator() {
throw new AssertionError("should never be called");
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ boolean equals(Object obj) {
return super.equals(obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Collection get(Object obj) {
return get((LinkedListMultimap<K, V>) obj);
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ int hashCode() {
return super.hashCode();
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public boolean isEmpty() {
return this.head == null;
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Set keySet() {
return super.keySet();
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ Multiset keys() {
return super.keys();
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public boolean put(K k, V v) {
addNode(k, v, null);
return true;
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ boolean putAll(Multimap multimap) {
return super.putAll(multimap);
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean remove(Object obj, Object obj2) {
return super.remove(obj, obj2);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ Collection replaceValues(Object obj, Iterable iterable) {
return replaceValues((LinkedListMultimap<K, V>) obj, iterable);
}
@Override // com.google.common.collect.Multimap
public int size() {
return this.size;
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
public static <K, V> LinkedListMultimap<K, V> create(int i) {
return new LinkedListMultimap<>(i);
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractMultimap
public List<Map.Entry<K, V>> createEntries() {
return new AbstractSequentialList<Map.Entry<K, V>>() { // from class: com.google.common.collect.LinkedListMultimap.1EntriesImpl
@Override // java.util.AbstractSequentialList, java.util.AbstractList, java.util.List
public ListIterator<Map.Entry<K, V>> listIterator(int i) {
return new NodeIterator(i);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public int size() {
return LinkedListMultimap.this.size;
}
};
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractMultimap
public List<V> createValues() {
return new AbstractSequentialList<V>() { // from class: com.google.common.collect.LinkedListMultimap.1ValuesImpl
@Override // java.util.AbstractSequentialList, java.util.AbstractList, java.util.List
public ListIterator<V> listIterator(int i) {
final NodeIterator nodeIterator = new NodeIterator(i);
return new TransformedListIterator<Map.Entry<K, V>, V>(this, nodeIterator) { // from class: com.google.common.collect.LinkedListMultimap.1ValuesImpl.1
@Override // com.google.common.collect.TransformedListIterator, java.util.ListIterator
public void set(V v) {
nodeIterator.a((NodeIterator) v);
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.TransformedIterator
public V a(Map.Entry<K, V> entry) {
return entry.getValue();
}
};
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public int size() {
return LinkedListMultimap.this.size;
}
};
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public List<Map.Entry<K, V>> entries() {
return (List) super.entries();
}
@Override // com.google.common.collect.Multimap
public List<V> get(final K k) {
return new AbstractSequentialList<V>() { // from class: com.google.common.collect.LinkedListMultimap.1
@Override // java.util.AbstractSequentialList, java.util.AbstractList, java.util.List
public ListIterator<V> listIterator(int i) {
return new ValueForKeyIterator(k, i);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public int size() {
KeyList keyList = (KeyList) LinkedListMultimap.this.keyToKeyList.get(k);
if (keyList == null) {
return 0;
}
return keyList.c;
}
};
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean putAll(Object obj, Iterable iterable) {
return super.putAll(obj, iterable);
}
@Override // com.google.common.collect.Multimap
public List<V> removeAll(Object obj) {
List<V> copy = getCopy(obj);
removeAllNodes(obj);
return copy;
}
@Override // com.google.common.collect.AbstractMultimap
public List<V> replaceValues(K k, Iterable<? extends V> iterable) {
List<V> copy = getCopy(k);
ValueForKeyIterator valueForKeyIterator = new ValueForKeyIterator(k);
Iterator<? extends V> it = iterable.iterator();
while (valueForKeyIterator.hasNext() && it.hasNext()) {
valueForKeyIterator.next();
valueForKeyIterator.set(it.next());
}
while (valueForKeyIterator.hasNext()) {
valueForKeyIterator.next();
valueForKeyIterator.remove();
}
while (it.hasNext()) {
valueForKeyIterator.add(it.next());
}
return copy;
}
@Override // com.google.common.collect.AbstractMultimap
public List<V> values() {
return (List) super.values();
}
private LinkedListMultimap(int i) {
this.keyToKeyList = new HashMap(i);
}
public static <K, V> LinkedListMultimap<K, V> create(Multimap<? extends K, ? extends V> multimap) {
return new LinkedListMultimap<>(multimap);
}
private class ValueForKeyIterator implements ListIterator<V> {
final Object a;
int b;
Node<K, V> c;
Node<K, V> d;
Node<K, V> e;
ValueForKeyIterator(Object obj) {
this.a = obj;
KeyList keyList = (KeyList) LinkedListMultimap.this.keyToKeyList.get(obj);
this.c = keyList == null ? null : keyList.a;
}
@Override // java.util.ListIterator
public void add(V v) {
this.e = LinkedListMultimap.this.addNode(this.a, v, this.c);
this.b++;
this.d = null;
}
@Override // java.util.ListIterator, java.util.Iterator
public boolean hasNext() {
return this.c != null;
}
@Override // java.util.ListIterator
public boolean hasPrevious() {
return this.e != null;
}
@Override // java.util.ListIterator, java.util.Iterator
public V next() {
LinkedListMultimap.checkElement(this.c);
Node<K, V> node = this.c;
this.d = node;
this.e = node;
this.c = node.e;
this.b++;
return this.d.b;
}
@Override // java.util.ListIterator
public int nextIndex() {
return this.b;
}
@Override // java.util.ListIterator
public V previous() {
LinkedListMultimap.checkElement(this.e);
Node<K, V> node = this.e;
this.d = node;
this.c = node;
this.e = node.f;
this.b--;
return this.d.b;
}
@Override // java.util.ListIterator
public int previousIndex() {
return this.b - 1;
}
@Override // java.util.ListIterator, java.util.Iterator
public void remove() {
CollectPreconditions.a(this.d != null);
Node<K, V> node = this.d;
if (node != this.c) {
this.e = node.f;
this.b--;
} else {
this.c = node.e;
}
LinkedListMultimap.this.removeNode(this.d);
this.d = null;
}
@Override // java.util.ListIterator
public void set(V v) {
Preconditions.b(this.d != null);
this.d.b = v;
}
public ValueForKeyIterator(Object obj, int i) {
KeyList keyList = (KeyList) LinkedListMultimap.this.keyToKeyList.get(obj);
int i2 = keyList == null ? 0 : keyList.c;
Preconditions.b(i, i2);
if (i >= i2 / 2) {
this.e = keyList == null ? null : keyList.b;
this.b = i2;
while (true) {
int i3 = i + 1;
if (i >= i2) {
break;
}
previous();
i = i3;
}
} else {
this.c = keyList == null ? null : keyList.a;
while (true) {
int i4 = i - 1;
if (i <= 0) {
break;
}
next();
i = i4;
}
}
this.a = obj;
this.d = null;
}
}
private LinkedListMultimap(Multimap<? extends K, ? extends V> multimap) {
this(multimap.keySet().size());
putAll(multimap);
}
}

View File

@@ -0,0 +1,5 @@
package com.google.common.collect;
/* loaded from: classes.dex */
public interface ListMultimap<K, V> extends Multimap<K, V> {
}

View File

@@ -0,0 +1,227 @@
package com.google.common.collect;
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.common.primitives.Ints;
import java.io.Serializable;
import java.util.AbstractList;
import java.util.AbstractSequentialList;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.RandomAccess;
/* loaded from: classes.dex */
public final class Lists {
private static class TransformingRandomAccessList<F, T> extends AbstractList<T> implements RandomAccess, Serializable {
final List<F> a;
final Function<? super F, ? extends T> b;
TransformingRandomAccessList(List<F> list, Function<? super F, ? extends T> function) {
Preconditions.a(list);
this.a = list;
Preconditions.a(function);
this.b = function;
}
@Override // java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List
public void clear() {
this.a.clear();
}
@Override // java.util.AbstractList, java.util.List
public T get(int i) {
return this.b.apply(this.a.get(i));
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public boolean isEmpty() {
return this.a.isEmpty();
}
@Override // java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.List
public Iterator<T> iterator() {
return listIterator();
}
@Override // java.util.AbstractList, java.util.List
public ListIterator<T> listIterator(int i) {
return new TransformedListIterator<F, T>(this.a.listIterator(i)) { // from class: com.google.common.collect.Lists.TransformingRandomAccessList.1
@Override // com.google.common.collect.TransformedIterator
T a(F f) {
return TransformingRandomAccessList.this.b.apply(f);
}
};
}
@Override // java.util.AbstractList, java.util.List
public T remove(int i) {
return this.b.apply(this.a.remove(i));
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public int size() {
return this.a.size();
}
}
private static class TransformingSequentialList<F, T> extends AbstractSequentialList<T> implements Serializable {
final List<F> a;
final Function<? super F, ? extends T> b;
TransformingSequentialList(List<F> list, Function<? super F, ? extends T> function) {
Preconditions.a(list);
this.a = list;
Preconditions.a(function);
this.b = function;
}
@Override // java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List
public void clear() {
this.a.clear();
}
@Override // java.util.AbstractSequentialList, java.util.AbstractList, java.util.List
public ListIterator<T> listIterator(int i) {
return new TransformedListIterator<F, T>(this.a.listIterator(i)) { // from class: com.google.common.collect.Lists.TransformingSequentialList.1
@Override // com.google.common.collect.TransformedIterator
T a(F f) {
return TransformingSequentialList.this.b.apply(f);
}
};
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public int size() {
return this.a.size();
}
}
public static <E> ArrayList<E> a() {
return new ArrayList<>();
}
public static <E> ArrayList<E> b(int i) {
CollectPreconditions.a(i, "initialArraySize");
return new ArrayList<>(i);
}
public static <E> ArrayList<E> c(int i) {
return new ArrayList<>(a(i));
}
static int d(List<?> list, Object obj) {
if (list instanceof RandomAccess) {
return e(list, obj);
}
ListIterator<?> listIterator = list.listIterator(list.size());
while (listIterator.hasPrevious()) {
if (Objects.a(obj, listIterator.previous())) {
return listIterator.nextIndex();
}
}
return -1;
}
private static int e(List<?> list, Object obj) {
if (obj == null) {
for (int size = list.size() - 1; size >= 0; size--) {
if (list.get(size) == null) {
return size;
}
}
return -1;
}
for (int size2 = list.size() - 1; size2 >= 0; size2--) {
if (obj.equals(list.get(size2))) {
return size2;
}
}
return -1;
}
static int a(int i) {
CollectPreconditions.a(i, "arraySize");
return Ints.b(i + 5 + (i / 10));
}
private static int c(List<?> list, Object obj) {
int size = list.size();
int i = 0;
if (obj == null) {
while (i < size) {
if (list.get(i) == null) {
return i;
}
i++;
}
return -1;
}
while (i < size) {
if (obj.equals(list.get(i))) {
return i;
}
i++;
}
return -1;
}
static int b(List<?> list, Object obj) {
if (list instanceof RandomAccess) {
return c(list, obj);
}
ListIterator<?> listIterator = list.listIterator();
while (listIterator.hasNext()) {
if (Objects.a(obj, listIterator.next())) {
return listIterator.previousIndex();
}
}
return -1;
}
public static <E> ArrayList<E> a(Iterable<? extends E> iterable) {
Preconditions.a(iterable);
if (iterable instanceof Collection) {
return new ArrayList<>(Collections2.a(iterable));
}
return a(iterable.iterator());
}
public static <E> ArrayList<E> a(Iterator<? extends E> it) {
ArrayList<E> a = a();
Iterators.a(a, it);
return a;
}
public static <F, T> List<T> a(List<F> list, Function<? super F, ? extends T> function) {
return list instanceof RandomAccess ? new TransformingRandomAccessList(list, function) : new TransformingSequentialList(list, function);
}
static boolean a(List<?> list, Object obj) {
Preconditions.a(list);
if (obj == list) {
return true;
}
if (!(obj instanceof List)) {
return false;
}
List list2 = (List) obj;
int size = list.size();
if (size != list2.size()) {
return false;
}
if (!(list instanceof RandomAccess) || !(list2 instanceof RandomAccess)) {
return Iterators.a(list.iterator(), (Iterator<?>) list2.iterator());
}
for (int i = 0; i < size; i++) {
if (!Objects.a(list.get(i), list2.get(i))) {
return false;
}
}
return true;
}
}

View File

@@ -0,0 +1,122 @@
package com.google.common.collect;
import com.google.common.base.Ascii;
import com.google.common.base.Equivalence;
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.collect.MapMakerInternalMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/* loaded from: classes.dex */
public final class MapMaker {
boolean a;
int b = -1;
int c = -1;
MapMakerInternalMap.Strength d;
MapMakerInternalMap.Strength e;
Equivalence<Object> f;
MapMaker a(Equivalence<Object> equivalence) {
Preconditions.b(this.f == null, "key equivalence was already set to %s", this.f);
Preconditions.a(equivalence);
this.f = equivalence;
this.a = true;
return this;
}
public MapMaker b(int i) {
Preconditions.b(this.b == -1, "initial capacity was already set to %s", this.b);
Preconditions.a(i >= 0);
this.b = i;
return this;
}
Equivalence<Object> c() {
return (Equivalence) MoreObjects.a(this.f, d().c());
}
MapMakerInternalMap.Strength d() {
return (MapMakerInternalMap.Strength) MoreObjects.a(this.d, MapMakerInternalMap.Strength.STRONG);
}
MapMakerInternalMap.Strength e() {
return (MapMakerInternalMap.Strength) MoreObjects.a(this.e, MapMakerInternalMap.Strength.STRONG);
}
public <K, V> ConcurrentMap<K, V> f() {
return !this.a ? new ConcurrentHashMap(b(), 0.75f, a()) : MapMakerInternalMap.a(this);
}
public MapMaker g() {
a(MapMakerInternalMap.Strength.WEAK);
return this;
}
public String toString() {
MoreObjects.ToStringHelper a = MoreObjects.a(this);
int i = this.b;
if (i != -1) {
a.a("initialCapacity", i);
}
int i2 = this.c;
if (i2 != -1) {
a.a("concurrencyLevel", i2);
}
MapMakerInternalMap.Strength strength = this.d;
if (strength != null) {
a.a("keyStrength", Ascii.a(strength.toString()));
}
MapMakerInternalMap.Strength strength2 = this.e;
if (strength2 != null) {
a.a("valueStrength", Ascii.a(strength2.toString()));
}
if (this.f != null) {
a.a("keyEquivalence");
}
return a.toString();
}
public MapMaker a(int i) {
Preconditions.b(this.c == -1, "concurrency level was already set to %s", this.c);
Preconditions.a(i > 0);
this.c = i;
return this;
}
int b() {
int i = this.b;
if (i == -1) {
return 16;
}
return i;
}
MapMaker b(MapMakerInternalMap.Strength strength) {
Preconditions.b(this.e == null, "Value strength was already set to %s", this.e);
Preconditions.a(strength);
this.e = strength;
if (strength != MapMakerInternalMap.Strength.STRONG) {
this.a = true;
}
return this;
}
int a() {
int i = this.c;
if (i == -1) {
return 4;
}
return i;
}
MapMaker a(MapMakerInternalMap.Strength strength) {
Preconditions.b(this.d == null, "Key strength was already set to %s", this.d);
Preconditions.a(strength);
this.d = strength;
if (strength != MapMakerInternalMap.Strength.STRONG) {
this.a = true;
}
return this;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,942 @@
package com.google.common.collect;
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
import java.util.AbstractCollection;
import java.util.AbstractMap;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NavigableMap;
import java.util.NavigableSet;
import java.util.Set;
import java.util.SortedMap;
import java.util.SortedSet;
/* loaded from: classes.dex */
public final class Maps {
static abstract class DescendingMap<K, V> extends ForwardingMap<K, V> implements NavigableMap<K, V> {
private transient Comparator<? super K> a;
private transient Set<Map.Entry<K, V>> b;
private transient NavigableSet<K> c;
DescendingMap() {
}
private static <T> Ordering<T> a(Comparator<T> comparator) {
return Ordering.a(comparator).b();
}
abstract Iterator<Map.Entry<K, V>> b();
abstract NavigableMap<K, V> c();
@Override // java.util.NavigableMap
public Map.Entry<K, V> ceilingEntry(K k) {
return c().floorEntry(k);
}
@Override // java.util.NavigableMap
public K ceilingKey(K k) {
return c().floorKey(k);
}
@Override // java.util.SortedMap
public Comparator<? super K> comparator() {
Comparator<? super K> comparator = this.a;
if (comparator != null) {
return comparator;
}
Comparator<? super K> comparator2 = c().comparator();
if (comparator2 == null) {
comparator2 = Ordering.c();
}
Ordering a = a(comparator2);
this.a = a;
return a;
}
@Override // java.util.NavigableMap
public NavigableSet<K> descendingKeySet() {
return c().navigableKeySet();
}
@Override // java.util.NavigableMap
public NavigableMap<K, V> descendingMap() {
return c();
}
@Override // com.google.common.collect.ForwardingMap, java.util.Map
public Set<Map.Entry<K, V>> entrySet() {
Set<Map.Entry<K, V>> set = this.b;
if (set != null) {
return set;
}
Set<Map.Entry<K, V>> a = a();
this.b = a;
return a;
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> firstEntry() {
return c().lastEntry();
}
@Override // java.util.SortedMap
public K firstKey() {
return c().lastKey();
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> floorEntry(K k) {
return c().ceilingEntry(k);
}
@Override // java.util.NavigableMap
public K floorKey(K k) {
return c().ceilingKey(k);
}
@Override // java.util.NavigableMap
public NavigableMap<K, V> headMap(K k, boolean z) {
return c().tailMap(k, z).descendingMap();
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> higherEntry(K k) {
return c().lowerEntry(k);
}
@Override // java.util.NavigableMap
public K higherKey(K k) {
return c().lowerKey(k);
}
@Override // com.google.common.collect.ForwardingMap, java.util.Map
public Set<K> keySet() {
return navigableKeySet();
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> lastEntry() {
return c().firstEntry();
}
@Override // java.util.SortedMap
public K lastKey() {
return c().firstKey();
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> lowerEntry(K k) {
return c().higherEntry(k);
}
@Override // java.util.NavigableMap
public K lowerKey(K k) {
return c().higherKey(k);
}
@Override // java.util.NavigableMap
public NavigableSet<K> navigableKeySet() {
NavigableSet<K> navigableSet = this.c;
if (navigableSet != null) {
return navigableSet;
}
NavigableKeySet navigableKeySet = new NavigableKeySet(this);
this.c = navigableKeySet;
return navigableKeySet;
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> pollFirstEntry() {
return c().pollLastEntry();
}
@Override // java.util.NavigableMap
public Map.Entry<K, V> pollLastEntry() {
return c().pollFirstEntry();
}
@Override // java.util.NavigableMap
public NavigableMap<K, V> subMap(K k, boolean z, K k2, boolean z2) {
return c().subMap(k2, z2, k, z).descendingMap();
}
@Override // java.util.NavigableMap
public NavigableMap<K, V> tailMap(K k, boolean z) {
return c().headMap(k, z).descendingMap();
}
@Override // com.google.common.collect.ForwardingObject
public String toString() {
return standardToString();
}
@Override // com.google.common.collect.ForwardingMap, java.util.Map
public Collection<V> values() {
return new Values(this);
}
Set<Map.Entry<K, V>> a() {
return new EntrySet<K, V>() { // from class: com.google.common.collect.Maps.DescendingMap.1EntrySetImpl
@Override // com.google.common.collect.Maps.EntrySet
Map<K, V> c() {
return DescendingMap.this;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<Map.Entry<K, V>> iterator() {
return DescendingMap.this.b();
}
};
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.ForwardingMap, com.google.common.collect.ForwardingObject
public final Map<K, V> delegate() {
return c();
}
@Override // java.util.NavigableMap, java.util.SortedMap
public SortedMap<K, V> headMap(K k) {
return headMap(k, false);
}
@Override // java.util.NavigableMap, java.util.SortedMap
public SortedMap<K, V> subMap(K k, K k2) {
return subMap(k, true, k2, false);
}
@Override // java.util.NavigableMap, java.util.SortedMap
public SortedMap<K, V> tailMap(K k) {
return tailMap(k, true);
}
}
private enum EntryFunction implements Function<Map.Entry<?, ?>, Object> {
KEY { // from class: com.google.common.collect.Maps.EntryFunction.1
@Override // com.google.common.base.Function
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public Object apply(Map.Entry<?, ?> entry) {
return entry.getKey();
}
},
VALUE { // from class: com.google.common.collect.Maps.EntryFunction.2
@Override // com.google.common.base.Function
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public Object apply(Map.Entry<?, ?> entry) {
return entry.getValue();
}
}
}
static abstract class EntrySet<K, V> extends Sets.ImprovedAbstractSet<Map.Entry<K, V>> {
EntrySet() {
}
abstract Map<K, V> c();
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
c().clear();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
Object key = entry.getKey();
Object e = Maps.e(c(), key);
if (Objects.a(e, entry.getValue())) {
return e != null || c().containsKey(key);
}
return false;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean isEmpty() {
return c().isEmpty();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
if (contains(obj)) {
return c().keySet().remove(((Map.Entry) obj).getKey());
}
return false;
}
@Override // com.google.common.collect.Sets.ImprovedAbstractSet, java.util.AbstractSet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean removeAll(Collection<?> collection) {
try {
Preconditions.a(collection);
return super.removeAll(collection);
} catch (UnsupportedOperationException unused) {
return Sets.a((Set<?>) this, collection.iterator());
}
}
@Override // com.google.common.collect.Sets.ImprovedAbstractSet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean retainAll(Collection<?> collection) {
try {
Preconditions.a(collection);
return super.retainAll(collection);
} catch (UnsupportedOperationException unused) {
HashSet a = Sets.a(collection.size());
for (Object obj : collection) {
if (contains(obj)) {
a.add(((Map.Entry) obj).getKey());
}
}
return c().keySet().retainAll(a);
}
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return c().size();
}
}
public interface EntryTransformer<K, V1, V2> {
V2 a(K k, V1 v1);
}
static abstract class IteratorBasedAbstractMap<K, V> extends AbstractMap<K, V> {
IteratorBasedAbstractMap() {
}
@Override // java.util.AbstractMap, java.util.Map
public void clear() {
Iterators.b(entryIterator());
}
abstract Iterator<Map.Entry<K, V>> entryIterator();
@Override // java.util.AbstractMap, java.util.Map
public Set<Map.Entry<K, V>> entrySet() {
return new EntrySet<K, V>() { // from class: com.google.common.collect.Maps.IteratorBasedAbstractMap.1
@Override // com.google.common.collect.Maps.EntrySet
Map<K, V> c() {
return IteratorBasedAbstractMap.this;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<Map.Entry<K, V>> iterator() {
return IteratorBasedAbstractMap.this.entryIterator();
}
};
}
@Override // java.util.AbstractMap, java.util.Map
public abstract int size();
}
static class KeySet<K, V> extends Sets.ImprovedAbstractSet<K> {
final Map<K, V> a;
KeySet(Map<K, V> map) {
Preconditions.a(map);
this.a = map;
}
Map<K, V> c() {
return this.a;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
c().clear();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return c().containsKey(obj);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean isEmpty() {
return c().isEmpty();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<K> iterator() {
return Maps.a(c().entrySet().iterator());
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
if (!contains(obj)) {
return false;
}
c().remove(obj);
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return c().size();
}
}
static class NavigableKeySet<K, V> extends SortedKeySet<K, V> implements NavigableSet<K> {
NavigableKeySet(NavigableMap<K, V> navigableMap) {
super(navigableMap);
}
@Override // java.util.NavigableSet
public K ceiling(K k) {
return c().ceilingKey(k);
}
@Override // java.util.NavigableSet
public Iterator<K> descendingIterator() {
return descendingSet().iterator();
}
@Override // java.util.NavigableSet
public NavigableSet<K> descendingSet() {
return c().descendingKeySet();
}
@Override // java.util.NavigableSet
public K floor(K k) {
return c().floorKey(k);
}
@Override // java.util.NavigableSet
public NavigableSet<K> headSet(K k, boolean z) {
return c().headMap(k, z).navigableKeySet();
}
@Override // java.util.NavigableSet
public K higher(K k) {
return c().higherKey(k);
}
@Override // java.util.NavigableSet
public K lower(K k) {
return c().lowerKey(k);
}
@Override // java.util.NavigableSet
public K pollFirst() {
return (K) Maps.a(c().pollFirstEntry());
}
@Override // java.util.NavigableSet
public K pollLast() {
return (K) Maps.a(c().pollLastEntry());
}
@Override // java.util.NavigableSet
public NavigableSet<K> subSet(K k, boolean z, K k2, boolean z2) {
return c().subMap(k, z, k2, z2).navigableKeySet();
}
@Override // java.util.NavigableSet
public NavigableSet<K> tailSet(K k, boolean z) {
return c().tailMap(k, z).navigableKeySet();
}
@Override // com.google.common.collect.Maps.SortedKeySet, java.util.SortedSet, java.util.NavigableSet
public SortedSet<K> headSet(K k) {
return headSet(k, false);
}
@Override // com.google.common.collect.Maps.SortedKeySet, java.util.SortedSet, java.util.NavigableSet
public SortedSet<K> subSet(K k, K k2) {
return subSet(k, true, k2, false);
}
@Override // com.google.common.collect.Maps.SortedKeySet, java.util.SortedSet, java.util.NavigableSet
public SortedSet<K> tailSet(K k) {
return tailSet(k, true);
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.Maps.SortedKeySet, com.google.common.collect.Maps.KeySet
public NavigableMap<K, V> c() {
return (NavigableMap) this.a;
}
}
static class SortedKeySet<K, V> extends KeySet<K, V> implements SortedSet<K> {
SortedKeySet(SortedMap<K, V> sortedMap) {
super(sortedMap);
}
@Override // java.util.SortedSet
public Comparator<? super K> comparator() {
return c().comparator();
}
@Override // java.util.SortedSet
public K first() {
return c().firstKey();
}
public SortedSet<K> headSet(K k) {
return new SortedKeySet(c().headMap(k));
}
@Override // java.util.SortedSet
public K last() {
return c().lastKey();
}
public SortedSet<K> subSet(K k, K k2) {
return new SortedKeySet(c().subMap(k, k2));
}
public SortedSet<K> tailSet(K k) {
return new SortedKeySet(c().tailMap(k));
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.Maps.KeySet
public SortedMap<K, V> c() {
return (SortedMap) super.c();
}
}
static class TransformedEntriesMap<K, V1, V2> extends IteratorBasedAbstractMap<K, V2> {
final Map<K, V1> a;
final EntryTransformer<? super K, ? super V1, V2> b;
TransformedEntriesMap(Map<K, V1> map, EntryTransformer<? super K, ? super V1, V2> entryTransformer) {
Preconditions.a(map);
this.a = map;
Preconditions.a(entryTransformer);
this.b = entryTransformer;
}
@Override // com.google.common.collect.Maps.IteratorBasedAbstractMap, java.util.AbstractMap, java.util.Map
public void clear() {
this.a.clear();
}
@Override // java.util.AbstractMap, java.util.Map
public boolean containsKey(Object obj) {
return this.a.containsKey(obj);
}
@Override // com.google.common.collect.Maps.IteratorBasedAbstractMap
Iterator<Map.Entry<K, V2>> entryIterator() {
return Iterators.a((Iterator) this.a.entrySet().iterator(), Maps.a(this.b));
}
@Override // java.util.AbstractMap, java.util.Map
public V2 get(Object obj) {
V1 v1 = this.a.get(obj);
if (v1 != null || this.a.containsKey(obj)) {
return this.b.a(obj, v1);
}
return null;
}
@Override // java.util.AbstractMap, java.util.Map
public Set<K> keySet() {
return this.a.keySet();
}
@Override // java.util.AbstractMap, java.util.Map
public V2 remove(Object obj) {
if (this.a.containsKey(obj)) {
return this.b.a(obj, this.a.remove(obj));
}
return null;
}
@Override // com.google.common.collect.Maps.IteratorBasedAbstractMap, java.util.AbstractMap, java.util.Map
public int size() {
return this.a.size();
}
@Override // java.util.AbstractMap, java.util.Map
public Collection<V2> values() {
return new Values(this);
}
}
static class Values<K, V> extends AbstractCollection<V> {
final Map<K, V> a;
Values(Map<K, V> map) {
Preconditions.a(map);
this.a = map;
}
final Map<K, V> a() {
return this.a;
}
@Override // java.util.AbstractCollection, java.util.Collection
public void clear() {
a().clear();
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean contains(Object obj) {
return a().containsValue(obj);
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean isEmpty() {
return a().isEmpty();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public Iterator<V> iterator() {
return Maps.b(a().entrySet().iterator());
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean remove(Object obj) {
try {
return super.remove(obj);
} catch (UnsupportedOperationException unused) {
for (Map.Entry<K, V> entry : a().entrySet()) {
if (Objects.a(obj, entry.getValue())) {
a().remove(entry.getKey());
return true;
}
}
return false;
}
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean removeAll(Collection<?> collection) {
try {
Preconditions.a(collection);
return super.removeAll(collection);
} catch (UnsupportedOperationException unused) {
HashSet a = Sets.a();
for (Map.Entry<K, V> entry : a().entrySet()) {
if (collection.contains(entry.getValue())) {
a.add(entry.getKey());
}
}
return a().keySet().removeAll(a);
}
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean retainAll(Collection<?> collection) {
try {
Preconditions.a(collection);
return super.retainAll(collection);
} catch (UnsupportedOperationException unused) {
HashSet a = Sets.a();
for (Map.Entry<K, V> entry : a().entrySet()) {
if (collection.contains(entry.getValue())) {
a.add(entry.getKey());
}
}
return a().keySet().retainAll(a);
}
}
@Override // java.util.AbstractCollection, java.util.Collection
public int size() {
return a().size();
}
}
static abstract class ViewCachingAbstractMap<K, V> extends AbstractMap<K, V> {
private transient Set<Map.Entry<K, V>> a;
private transient Set<K> b;
private transient Collection<V> c;
ViewCachingAbstractMap() {
}
abstract Set<Map.Entry<K, V>> a();
Set<K> b() {
return new KeySet(this);
}
Collection<V> c() {
return new Values(this);
}
@Override // java.util.AbstractMap, java.util.Map
public Set<Map.Entry<K, V>> entrySet() {
Set<Map.Entry<K, V>> set = this.a;
if (set != null) {
return set;
}
Set<Map.Entry<K, V>> a = a();
this.a = a;
return a;
}
@Override // java.util.AbstractMap, java.util.Map
public Set<K> keySet() {
Set<K> set = this.b;
if (set != null) {
return set;
}
Set<K> b = b();
this.b = b;
return b;
}
@Override // java.util.AbstractMap, java.util.Map
public Collection<V> values() {
Collection<V> collection = this.c;
if (collection != null) {
return collection;
}
Collection<V> c = c();
this.c = c;
return c;
}
}
static <K> Function<Map.Entry<K, ?>, K> a() {
return EntryFunction.KEY;
}
static <K, V> Iterator<V> b(Iterator<Map.Entry<K, V>> it) {
return Iterators.a((Iterator) it, d());
}
public static <K, V> LinkedHashMap<K, V> c() {
return new LinkedHashMap<>();
}
static <V> Function<Map.Entry<?, V>, V> d() {
return EntryFunction.VALUE;
}
static <V> V e(Map<?, V> map, Object obj) {
Preconditions.a(map);
try {
return map.get(obj);
} catch (ClassCastException | NullPointerException unused) {
return null;
}
}
static <V> V f(Map<?, V> map, Object obj) {
Preconditions.a(map);
try {
return map.remove(obj);
} catch (ClassCastException | NullPointerException unused) {
return null;
}
}
static <K, V> Iterator<K> a(Iterator<Map.Entry<K, V>> it) {
return Iterators.a((Iterator) it, a());
}
public static <K, V> HashMap<K, V> b() {
return new HashMap<>();
}
public static <K, V> LinkedHashMap<K, V> c(int i) {
return new LinkedHashMap<>(a(i));
}
static boolean d(Map<?, ?> map, Object obj) {
Preconditions.a(map);
try {
return map.containsKey(obj);
} catch (ClassCastException | NullPointerException unused) {
return false;
}
}
static int a(int i) {
if (i < 3) {
CollectPreconditions.a(i, "expectedSize");
return i + 1;
}
if (i < 1073741824) {
return (int) ((i / 0.75f) + 1.0f);
}
return Integer.MAX_VALUE;
}
public static <K, V> HashMap<K, V> b(int i) {
return new HashMap<>(a(i));
}
static boolean c(Map<?, ?> map, Object obj) {
if (map == obj) {
return true;
}
if (obj instanceof Map) {
return map.entrySet().equals(((Map) obj).entrySet());
}
return false;
}
static <K, V> Iterator<Map.Entry<K, V>> a(Set<K> set, final Function<? super K, V> function) {
return new TransformedIterator<K, Map.Entry<K, V>>(set.iterator()) { // from class: com.google.common.collect.Maps.1
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.TransformedIterator
/* bridge */ /* synthetic */ Object a(Object obj) {
return a((AnonymousClass1<K, V>) obj);
}
@Override // com.google.common.collect.TransformedIterator
Map.Entry<K, V> a(K k) {
return Maps.a(k, function.apply(k));
}
};
}
static <K, V> Map.Entry<K, V> b(final Map.Entry<? extends K, ? extends V> entry) {
Preconditions.a(entry);
return new AbstractMapEntry<K, V>() { // from class: com.google.common.collect.Maps.5
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public K getKey() {
return (K) entry.getKey();
}
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public V getValue() {
return (V) entry.getValue();
}
};
}
public static <K, V> Map.Entry<K, V> a(K k, V v) {
return new ImmutableEntry(k, v);
}
public static <K, V1, V2> Map<K, V2> a(Map<K, V1> map, Function<? super V1, V2> function) {
return a((Map) map, a(function));
}
static <V> Predicate<Map.Entry<?, V>> b(Predicate<? super V> predicate) {
return Predicates.a(predicate, d());
}
static <V> V c(Map.Entry<?, V> entry) {
if (entry == null) {
return null;
}
return entry.getValue();
}
public static <K, V1, V2> Map<K, V2> a(Map<K, V1> map, EntryTransformer<? super K, ? super V1, V2> entryTransformer) {
return new TransformedEntriesMap(map, entryTransformer);
}
static boolean b(Map<?, ?> map, Object obj) {
return Iterators.a((Iterator<?>) b(map.entrySet().iterator()), obj);
}
static <K, V1, V2> EntryTransformer<K, V1, V2> a(final Function<? super V1, V2> function) {
Preconditions.a(function);
return new EntryTransformer<K, V1, V2>() { // from class: com.google.common.collect.Maps.7
@Override // com.google.common.collect.Maps.EntryTransformer
public V2 a(K k, V1 v1) {
return (V2) Function.this.apply(v1);
}
};
}
static <V2, K, V1> Map.Entry<K, V2> a(final EntryTransformer<? super K, ? super V1, V2> entryTransformer, final Map.Entry<K, V1> entry) {
Preconditions.a(entryTransformer);
Preconditions.a(entry);
return new AbstractMapEntry<K, V2>() { // from class: com.google.common.collect.Maps.10
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public K getKey() {
return (K) entry.getKey();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public V2 getValue() {
return (V2) entryTransformer.a(entry.getKey(), entry.getValue());
}
};
}
static <K, V1, V2> Function<Map.Entry<K, V1>, Map.Entry<K, V2>> a(final EntryTransformer<? super K, ? super V1, V2> entryTransformer) {
Preconditions.a(entryTransformer);
return new Function<Map.Entry<K, V1>, Map.Entry<K, V2>>() { // from class: com.google.common.collect.Maps.11
@Override // com.google.common.base.Function
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public Map.Entry<K, V2> apply(Map.Entry<K, V1> entry) {
return Maps.a(EntryTransformer.this, (Map.Entry) entry);
}
};
}
static <K> Predicate<Map.Entry<K, ?>> a(Predicate<? super K> predicate) {
return Predicates.a(predicate, a());
}
static boolean a(Map<?, ?> map, Object obj) {
return Iterators.a((Iterator<?>) a(map.entrySet().iterator()), obj);
}
static <K, V> boolean a(Collection<Map.Entry<K, V>> collection, Object obj) {
if (obj instanceof Map.Entry) {
return collection.contains(b((Map.Entry) obj));
}
return false;
}
static String a(Map<?, ?> map) {
StringBuilder a = Collections2.a(map.size());
a.append('{');
boolean z = true;
for (Map.Entry<?, ?> entry : map.entrySet()) {
if (!z) {
a.append(", ");
}
z = false;
a.append(entry.getKey());
a.append('=');
a.append(entry.getValue());
}
a.append('}');
return a.toString();
}
static <K, V> void a(Map<K, V> map, Map<? extends K, ? extends V> map2) {
for (Map.Entry<? extends K, ? extends V> entry : map2.entrySet()) {
map.put(entry.getKey(), entry.getValue());
}
}
static <K> K a(Map.Entry<K, ?> entry) {
if (entry == null) {
return null;
}
return entry.getKey();
}
static <E> ImmutableMap<E, Integer> a(Collection<E> collection) {
ImmutableMap.Builder builder = new ImmutableMap.Builder(collection.size());
Iterator<E> it = collection.iterator();
int i = 0;
while (it.hasNext()) {
builder.a(it.next(), Integer.valueOf(i));
i++;
}
return builder.a();
}
}

Some files were not shown because too many files have changed in this diff Show More