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,6 @@
package com.squareup.haha.guava.base;
/* loaded from: classes.dex */
public interface Function<F, T> {
T apply(F f);
}

View File

@@ -0,0 +1,211 @@
package com.squareup.haha.guava.base;
import com.squareup.haha.guava.collect.ImmutableList;
import com.squareup.haha.guava.collect.Iterators;
import com.squareup.haha.guava.collect.Lists$RandomAccessReverseList;
import com.squareup.haha.guava.collect.Lists$ReverseList;
import com.squareup.haha.guava.collect.Multiset;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.RandomAccess;
import java.util.Set;
/* loaded from: classes.dex */
public class Joiner {
private final String separator;
public static final class MapJoiner {
public /* synthetic */ MapJoiner(Joiner joiner, String str, byte b) {
this(joiner, str);
}
private MapJoiner(Joiner joiner, String str) {
Joiner.checkNotNull(str);
}
}
/* synthetic */ Joiner(Joiner joiner, byte b) {
this(joiner);
}
static String badPositionIndex(int i, int i2, String str) {
if (i < 0) {
return format("%s (%s) must not be negative", str, Integer.valueOf(i));
}
if (i2 >= 0) {
return format("%s (%s) must not be greater than size (%s)", str, Integer.valueOf(i), Integer.valueOf(i2));
}
throw new IllegalArgumentException("negative size: " + i2);
}
public static void checkArgument(boolean z) {
if (!z) {
throw new IllegalArgumentException();
}
}
public static int checkElementIndex(int i, int i2) {
String format;
if (i >= 0 && i < i2) {
return i;
}
if (i < 0) {
format = format("%s (%s) must not be negative", "index", Integer.valueOf(i));
} else {
if (i2 < 0) {
throw new IllegalArgumentException("negative size: " + i2);
}
format = format("%s (%s) must be less than size (%s)", "index", Integer.valueOf(i), Integer.valueOf(i2));
}
throw new IndexOutOfBoundsException(format);
}
public static <T> T checkNotNull(T t) {
if (t != null) {
return t;
}
throw new NullPointerException();
}
public static int checkPositionIndex(int i, int i2) {
if (i < 0 || i > i2) {
throw new IndexOutOfBoundsException(badPositionIndex(i, i2, "index"));
}
return i;
}
public static void checkPositionIndexes(int i, int i2, int i3) {
if (i < 0 || i2 < i || i2 > i3) {
throw new IndexOutOfBoundsException((i < 0 || i > i3) ? badPositionIndex(i, i3, "start index") : (i2 < 0 || i2 > i3) ? badPositionIndex(i2, i3, "end index") : format("end index (%s) must not be less than start index (%s)", Integer.valueOf(i2), Integer.valueOf(i)));
}
}
public static void checkRemove(boolean z) {
if (!z) {
throw new IllegalStateException("no calls to next() since the last call to remove()");
}
}
public static boolean equal(Object obj, Object obj2) {
if (obj != obj2) {
return obj != null && obj.equals(obj2);
}
return true;
}
public static boolean equalsImpl(Set<?> set, Object obj) {
if (set == obj) {
return true;
}
if (obj instanceof Set) {
Set set2 = (Set) obj;
try {
if (set.size() == set2.size()) {
if (set.containsAll(set2)) {
return true;
}
}
} catch (ClassCastException | NullPointerException unused) {
}
}
return false;
}
static String format(String str, Object... objArr) {
int indexOf;
String valueOf = String.valueOf(str);
StringBuilder sb = new StringBuilder(valueOf.length() + (objArr.length * 16));
int i = 0;
int i2 = 0;
while (i < objArr.length && (indexOf = valueOf.indexOf("%s", i2)) != -1) {
sb.append(valueOf.substring(i2, indexOf));
sb.append(objArr[i]);
i2 = indexOf + 2;
i++;
}
sb.append(valueOf.substring(i2));
if (i < objArr.length) {
sb.append(" [");
sb.append(objArr[i]);
for (int i3 = i + 1; i3 < objArr.length; i3++) {
sb.append(", ");
sb.append(objArr[i3]);
}
sb.append(']');
}
return sb.toString();
}
public static boolean removeAllImpl(Set<?> set, Iterator<?> it) {
boolean z = false;
while (it.hasNext()) {
z |= set.remove(it.next());
}
return z;
}
public static <T> List<T> reverse(List<T> list) {
return list instanceof ImmutableList ? ((ImmutableList) list).reverse() : list instanceof Lists$ReverseList ? ((Lists$ReverseList) list).forwardList : list instanceof RandomAccess ? new Lists$RandomAccessReverseList(list) : new Lists$ReverseList(list);
}
public final StringBuilder appendTo(StringBuilder sb, Iterator<?> it) {
try {
checkNotNull(sb);
if (it.hasNext()) {
sb.append(toString(it.next()));
while (it.hasNext()) {
sb.append((CharSequence) this.separator);
sb.append(toString(it.next()));
}
}
return sb;
} catch (IOException e) {
throw new AssertionError(e);
}
}
CharSequence toString(Object obj) {
checkNotNull(obj);
return obj instanceof CharSequence ? (CharSequence) obj : obj.toString();
}
public Joiner useForNull(final String str) {
checkNotNull(str);
return new Joiner(this) { // from class: com.squareup.haha.guava.base.Joiner.1
{
byte b = 0;
}
@Override // com.squareup.haha.guava.base.Joiner
final CharSequence toString(Object obj) {
return obj == null ? str : Joiner.this.toString(obj);
}
@Override // com.squareup.haha.guava.base.Joiner
public final Joiner useForNull(String str2) {
throw new UnsupportedOperationException("already specified useForNull");
}
};
}
public Joiner(String str) {
this.separator = (String) checkNotNull(str);
}
public static boolean removeAllImpl(Set<?> set, Collection<?> collection) {
checkNotNull(collection);
if (collection instanceof Multiset) {
collection = ((Multiset) collection).elementSet();
}
if ((collection instanceof Set) && collection.size() > set.size()) {
return Iterators.removeAll(set.iterator(), collection);
}
return removeAllImpl(set, collection.iterator());
}
private Joiner(Joiner joiner) {
this.separator = joiner.separator;
}
}

View File

@@ -0,0 +1,6 @@
package com.squareup.haha.guava.base;
/* loaded from: classes.dex */
public interface Predicate<T> {
boolean apply(T t);
}

View File

@@ -0,0 +1,52 @@
package com.squareup.haha.guava.base;
import java.io.Serializable;
import java.util.Collection;
/* loaded from: classes.dex */
public final class Predicates {
static class InPredicate<T> implements Predicate<T>, Serializable {
private final Collection<?> target;
/* synthetic */ InPredicate(Collection collection, byte b) {
this(collection);
}
@Override // com.squareup.haha.guava.base.Predicate
public final boolean apply(T t) {
try {
return this.target.contains(t);
} catch (ClassCastException | NullPointerException unused) {
return false;
}
}
public final boolean equals(Object obj) {
if (obj instanceof InPredicate) {
return this.target.equals(((InPredicate) obj).target);
}
return false;
}
public final int hashCode() {
return this.target.hashCode();
}
public final String toString() {
return "Predicates.in(" + this.target + ")";
}
private InPredicate(Collection<?> collection) {
this.target = (Collection) Joiner.checkNotNull(collection);
}
}
static {
new Joiner(",");
}
public static <T> Predicate<T> in(Collection<? extends T> collection) {
return new InPredicate(collection, (byte) 0);
}
}

View File

@@ -0,0 +1,58 @@
package com.squareup.haha.guava.collect;
import com.squareup.haha.guava.base.Joiner;
import java.util.NoSuchElementException;
/* loaded from: classes.dex */
abstract class AbstractIndexedListIterator<E> extends UnmodifiableListIterator<E> {
private int position;
private final int size;
protected AbstractIndexedListIterator(int i, int i2) {
Joiner.checkPositionIndex(i2, i);
this.size = i;
this.position = i2;
}
protected abstract E get(int i);
@Override // java.util.Iterator, java.util.ListIterator
public final boolean hasNext() {
return this.position < this.size;
}
@Override // java.util.ListIterator
public final boolean hasPrevious() {
return this.position > 0;
}
@Override // java.util.Iterator, java.util.ListIterator
public final E next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
int i = this.position;
this.position = i + 1;
return get(i);
}
@Override // java.util.ListIterator
public final int nextIndex() {
return this.position;
}
@Override // java.util.ListIterator
public final E previous() {
if (!hasPrevious()) {
throw new NoSuchElementException();
}
int i = this.position - 1;
this.position = i;
return get(i);
}
@Override // java.util.ListIterator
public final int previousIndex() {
return this.position - 1;
}
}

View File

@@ -0,0 +1,42 @@
package com.squareup.haha.guava.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> {
protected AbstractListMultimap(Map<K, Collection<V>> map) {
super(map);
}
@Override // com.squareup.haha.guava.collect.AbstractMultimap, com.squareup.haha.guava.collect.Multimap
public Map<K, Collection<V>> asMap() {
return super.asMap();
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.squareup.haha.guava.collect.AbstractMapBasedMultimap
public abstract List<V> createCollection();
@Override // com.squareup.haha.guava.collect.AbstractMultimap
public boolean equals(Object obj) {
return super.equals(obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.squareup.haha.guava.collect.AbstractMapBasedMultimap, com.squareup.haha.guava.collect.Multimap
public final /* bridge */ /* synthetic */ Collection get(Object obj) {
return get((AbstractListMultimap<K, V>) obj);
}
@Override // com.squareup.haha.guava.collect.AbstractMapBasedMultimap, com.squareup.haha.guava.collect.AbstractMultimap, com.squareup.haha.guava.collect.Multimap
public boolean put(K k, V v) {
return super.put(k, v);
}
@Override // com.squareup.haha.guava.collect.AbstractMapBasedMultimap, com.squareup.haha.guava.collect.Multimap
public List<V> get(K k) {
return (List) super.get((AbstractListMultimap<K, V>) k);
}
}

View File

@@ -0,0 +1,949 @@
package com.squareup.haha.guava.collect;
import com.squareup.haha.guava.base.Joiner;
import com.squareup.haha.guava.collect.Maps;
import java.io.Serializable;
import java.util.AbstractCollection;
import java.util.Collection;
import java.util.Comparator;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.RandomAccess;
import java.util.Set;
import java.util.SortedMap;
import java.util.SortedSet;
/* loaded from: classes.dex */
abstract class AbstractMapBasedMultimap<K, V> extends AbstractMultimap<K, V> implements Serializable {
private transient Map<K, Collection<V>> map;
private transient int totalSize;
class AsMap extends Maps.ImprovedAbstractMap<K, Collection<V>> {
final transient Map<K, Collection<V>> submap;
class AsMapEntries extends Maps.EntrySet<K, Collection<V>> {
AsMapEntries() {
}
@Override // com.squareup.haha.guava.collect.Maps.EntrySet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public final boolean contains(Object obj) {
return Collections2.safeContains(AsMap.this.submap.entrySet(), obj);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public final Iterator<Map.Entry<K, Collection<V>>> iterator() {
return AsMap.this.new AsMapIterator();
}
@Override // com.squareup.haha.guava.collect.Maps.EntrySet
final Map<K, Collection<V>> map() {
return AsMap.this;
}
@Override // com.squareup.haha.guava.collect.Maps.EntrySet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public final boolean remove(Object obj) {
if (!contains(obj)) {
return false;
}
AbstractMapBasedMultimap.access$400(AbstractMapBasedMultimap.this, ((Map.Entry) obj).getKey());
return true;
}
}
class AsMapIterator implements Iterator<Map.Entry<K, Collection<V>>> {
private Collection<V> collection;
private Iterator<Map.Entry<K, Collection<V>>> delegateIterator;
AsMapIterator() {
this.delegateIterator = AsMap.this.submap.entrySet().iterator();
}
@Override // java.util.Iterator
public final boolean hasNext() {
return this.delegateIterator.hasNext();
}
@Override // java.util.Iterator
public final /* bridge */ /* synthetic */ Object next() {
Map.Entry<K, Collection<V>> next = this.delegateIterator.next();
this.collection = next.getValue();
AsMap asMap = AsMap.this;
K key = next.getKey();
return Maps.immutableEntry(key, AbstractMapBasedMultimap.this.wrapCollection(key, next.getValue()));
}
@Override // java.util.Iterator
public final void remove() {
this.delegateIterator.remove();
AbstractMapBasedMultimap.access$220(AbstractMapBasedMultimap.this, this.collection.size());
this.collection.clear();
}
}
AsMap(Map<K, Collection<V>> map) {
this.submap = map;
}
@Override // java.util.AbstractMap, java.util.Map
public void clear() {
if (this.submap == AbstractMapBasedMultimap.this.map) {
AbstractMapBasedMultimap.this.clear();
} else {
Iterators.clear(new AsMapIterator());
}
}
@Override // java.util.AbstractMap, java.util.Map
public boolean containsKey(Object obj) {
return Maps.safeContainsKey(this.submap, obj);
}
@Override // com.squareup.haha.guava.collect.Maps.ImprovedAbstractMap
protected final Set<Map.Entry<K, Collection<V>>> createEntrySet() {
return new AsMapEntries();
}
@Override // java.util.AbstractMap, java.util.Map
public boolean equals(Object obj) {
return this == obj || this.submap.equals(obj);
}
@Override // java.util.AbstractMap, java.util.Map
public /* bridge */ /* synthetic */ Object get(Object obj) {
Collection<V> collection = (Collection) Maps.safeGet(this.submap, obj);
if (collection == null) {
return null;
}
return AbstractMapBasedMultimap.this.wrapCollection(obj, collection);
}
@Override // java.util.AbstractMap, java.util.Map
public int hashCode() {
return this.submap.hashCode();
}
@Override // com.squareup.haha.guava.collect.Maps.ImprovedAbstractMap, java.util.AbstractMap, java.util.Map
public Set<K> keySet() {
return AbstractMapBasedMultimap.this.keySet();
}
@Override // java.util.AbstractMap, java.util.Map
public /* bridge */ /* synthetic */ Object remove(Object obj) {
Collection<V> remove = this.submap.remove(obj);
if (remove == null) {
return null;
}
Collection<V> createCollection = AbstractMapBasedMultimap.this.createCollection();
createCollection.addAll(remove);
AbstractMapBasedMultimap.access$220(AbstractMapBasedMultimap.this, remove.size());
remove.clear();
return createCollection;
}
@Override // java.util.AbstractMap, java.util.Map
public int size() {
return this.submap.size();
}
@Override // java.util.AbstractMap
public String toString() {
return this.submap.toString();
}
}
abstract class Itr<T> implements Iterator<T> {
private Iterator<Map.Entry<K, Collection<V>>> keyIterator;
private K key = null;
private Collection<V> collection = null;
private Iterator<V> valueIterator = Iterators.emptyModifiableIterator();
Itr() {
this.keyIterator = AbstractMapBasedMultimap.this.map.entrySet().iterator();
}
@Override // java.util.Iterator
public boolean hasNext() {
return this.keyIterator.hasNext() || this.valueIterator.hasNext();
}
@Override // java.util.Iterator
public T next() {
if (!this.valueIterator.hasNext()) {
Map.Entry<K, Collection<V>> next = this.keyIterator.next();
this.key = next.getKey();
this.collection = next.getValue();
this.valueIterator = this.collection.iterator();
}
return output(this.key, this.valueIterator.next());
}
abstract T output(K k, V v);
@Override // java.util.Iterator
public void remove() {
this.valueIterator.remove();
if (this.collection.isEmpty()) {
this.keyIterator.remove();
}
AbstractMapBasedMultimap.access$210(AbstractMapBasedMultimap.this);
}
}
class KeySet extends Maps.KeySet<K, Collection<V>> {
KeySet(Map<K, Collection<V>> map) {
super(map);
}
@Override // com.squareup.haha.guava.collect.Maps.KeySet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
Iterators.clear(iterator());
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean containsAll(Collection<?> collection) {
return this.map.keySet().containsAll(collection);
}
@Override // java.util.AbstractSet, java.util.Collection, java.util.Set
public boolean equals(Object obj) {
return this == obj || this.map.keySet().equals(obj);
}
@Override // java.util.AbstractSet, java.util.Collection, java.util.Set
public int hashCode() {
return this.map.keySet().hashCode();
}
@Override // com.squareup.haha.guava.collect.Maps.KeySet, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<K> iterator() {
final Iterator<Map.Entry<K, V>> it = this.map.entrySet().iterator();
return new Iterator<K>() { // from class: com.squareup.haha.guava.collect.AbstractMapBasedMultimap.KeySet.1
private Map.Entry<K, Collection<V>> entry;
@Override // java.util.Iterator
public final boolean hasNext() {
return it.hasNext();
}
@Override // java.util.Iterator
public final K next() {
this.entry = (Map.Entry) it.next();
return this.entry.getKey();
}
@Override // java.util.Iterator
public final void remove() {
Joiner.checkRemove(this.entry != null);
Collection<V> value = this.entry.getValue();
it.remove();
AbstractMapBasedMultimap.access$220(AbstractMapBasedMultimap.this, value.size());
value.clear();
}
};
}
@Override // com.squareup.haha.guava.collect.Maps.KeySet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
int i;
Collection collection = (Collection) this.map.remove(obj);
if (collection != null) {
i = collection.size();
collection.clear();
AbstractMapBasedMultimap.access$220(AbstractMapBasedMultimap.this, i);
} else {
i = 0;
}
return i > 0;
}
}
class RandomAccessWrappedList extends WrappedList implements RandomAccess {
RandomAccessWrappedList(AbstractMapBasedMultimap abstractMapBasedMultimap, Object obj, List list, WrappedCollection wrappedCollection) {
super(obj, list, wrappedCollection);
}
}
class SortedAsMap extends AsMap implements SortedMap {
private SortedSet<K> sortedKeySet;
SortedAsMap(SortedMap<K, Collection<V>> sortedMap) {
super(sortedMap);
}
@Override // java.util.SortedMap
public final Comparator<? super K> comparator() {
return ((SortedMap) this.submap).comparator();
}
@Override // java.util.SortedMap
public final K firstKey() {
return (K) ((SortedMap) this.submap).firstKey();
}
@Override // java.util.SortedMap
public final SortedMap<K, Collection<V>> headMap(K k) {
return new SortedAsMap(((SortedMap) this.submap).headMap(k));
}
@Override // com.squareup.haha.guava.collect.AbstractMapBasedMultimap.AsMap, com.squareup.haha.guava.collect.Maps.ImprovedAbstractMap, java.util.AbstractMap, java.util.Map
public final /* bridge */ /* synthetic */ Set keySet() {
SortedSet<K> sortedSet = this.sortedKeySet;
if (sortedSet != null) {
return sortedSet;
}
SortedSet<K> mo16createKeySet = mo16createKeySet();
this.sortedKeySet = mo16createKeySet;
return mo16createKeySet;
}
@Override // java.util.SortedMap
public final K lastKey() {
return (K) ((SortedMap) this.submap).lastKey();
}
@Override // java.util.SortedMap
public final SortedMap<K, Collection<V>> subMap(K k, K k2) {
return new SortedAsMap(((SortedMap) this.submap).subMap(k, k2));
}
@Override // java.util.SortedMap
public final SortedMap<K, Collection<V>> tailMap(K k) {
return new SortedAsMap(((SortedMap) this.submap).tailMap(k));
}
/* JADX INFO: Access modifiers changed from: private */
@Override // com.squareup.haha.guava.collect.Maps.ImprovedAbstractMap
/* renamed from: createKeySet, reason: merged with bridge method [inline-methods] */
public SortedSet<K> mo16createKeySet() {
return new SortedKeySet((SortedMap) this.submap);
}
}
class SortedKeySet extends KeySet implements SortedSet {
SortedKeySet(SortedMap<K, Collection<V>> sortedMap) {
super(sortedMap);
}
private SortedMap<K, Collection<V>> sortedMap() {
return (SortedMap) this.map;
}
@Override // java.util.SortedSet
public final Comparator<? super K> comparator() {
return sortedMap().comparator();
}
@Override // java.util.SortedSet
public final K first() {
return sortedMap().firstKey();
}
@Override // java.util.SortedSet
public final SortedSet<K> headSet(K k) {
return new SortedKeySet(sortedMap().headMap(k));
}
@Override // java.util.SortedSet
public final K last() {
return sortedMap().lastKey();
}
@Override // java.util.SortedSet
public final SortedSet<K> subSet(K k, K k2) {
return new SortedKeySet(sortedMap().subMap(k, k2));
}
@Override // java.util.SortedSet
public final SortedSet<K> tailSet(K k) {
return new SortedKeySet(sortedMap().tailMap(k));
}
}
class WrappedSet extends WrappedCollection implements Set {
WrappedSet(K k, Set<V> set) {
super(k, set, null);
}
@Override // com.squareup.haha.guava.collect.AbstractMapBasedMultimap.WrappedCollection, java.util.AbstractCollection, java.util.Collection
public final boolean removeAll(Collection<?> collection) {
if (collection.isEmpty()) {
return false;
}
int size = size();
boolean removeAllImpl = Joiner.removeAllImpl((Set<?>) this.delegate, collection);
if (removeAllImpl) {
AbstractMapBasedMultimap.access$212(AbstractMapBasedMultimap.this, this.delegate.size() - size);
removeIfEmpty();
}
return removeAllImpl;
}
}
class WrappedSortedSet extends WrappedCollection implements SortedSet {
WrappedSortedSet(Object obj, SortedSet sortedSet, WrappedCollection wrappedCollection) {
super(obj, sortedSet, wrappedCollection);
}
private SortedSet<V> getSortedSetDelegate() {
return (SortedSet) this.delegate;
}
@Override // java.util.SortedSet
public final Comparator<? super V> comparator() {
return getSortedSetDelegate().comparator();
}
@Override // java.util.SortedSet
public final V first() {
refreshIfEmpty();
return getSortedSetDelegate().first();
}
@Override // java.util.SortedSet
public final SortedSet<V> headSet(V v) {
refreshIfEmpty();
AbstractMapBasedMultimap abstractMapBasedMultimap = AbstractMapBasedMultimap.this;
K k = this.key;
SortedSet<V> headSet = getSortedSetDelegate().headSet(v);
WrappedCollection wrappedCollection = this.ancestor;
if (wrappedCollection == null) {
wrappedCollection = this;
}
return new WrappedSortedSet(k, headSet, wrappedCollection);
}
@Override // java.util.SortedSet
public final V last() {
refreshIfEmpty();
return getSortedSetDelegate().last();
}
@Override // java.util.SortedSet
public final SortedSet<V> subSet(V v, V v2) {
refreshIfEmpty();
AbstractMapBasedMultimap abstractMapBasedMultimap = AbstractMapBasedMultimap.this;
K k = this.key;
SortedSet<V> subSet = getSortedSetDelegate().subSet(v, v2);
WrappedCollection wrappedCollection = this.ancestor;
if (wrappedCollection == null) {
wrappedCollection = this;
}
return new WrappedSortedSet(k, subSet, wrappedCollection);
}
@Override // java.util.SortedSet
public final SortedSet<V> tailSet(V v) {
refreshIfEmpty();
AbstractMapBasedMultimap abstractMapBasedMultimap = AbstractMapBasedMultimap.this;
K k = this.key;
SortedSet<V> tailSet = getSortedSetDelegate().tailSet(v);
WrappedCollection wrappedCollection = this.ancestor;
if (wrappedCollection == null) {
wrappedCollection = this;
}
return new WrappedSortedSet(k, tailSet, wrappedCollection);
}
}
protected AbstractMapBasedMultimap(Map<K, Collection<V>> map) {
Joiner.checkArgument(map.isEmpty());
this.map = map;
}
static /* synthetic */ Iterator access$100(AbstractMapBasedMultimap abstractMapBasedMultimap, Collection collection) {
return collection instanceof List ? ((List) collection).listIterator() : collection.iterator();
}
static /* synthetic */ int access$208(AbstractMapBasedMultimap abstractMapBasedMultimap) {
int i = abstractMapBasedMultimap.totalSize;
abstractMapBasedMultimap.totalSize = i + 1;
return i;
}
static /* synthetic */ int access$210(AbstractMapBasedMultimap abstractMapBasedMultimap) {
int i = abstractMapBasedMultimap.totalSize;
abstractMapBasedMultimap.totalSize = i - 1;
return i;
}
static /* synthetic */ int access$212(AbstractMapBasedMultimap abstractMapBasedMultimap, int i) {
int i2 = abstractMapBasedMultimap.totalSize + i;
abstractMapBasedMultimap.totalSize = i2;
return i2;
}
static /* synthetic */ int access$220(AbstractMapBasedMultimap abstractMapBasedMultimap, int i) {
int i2 = abstractMapBasedMultimap.totalSize - i;
abstractMapBasedMultimap.totalSize = i2;
return i2;
}
static /* synthetic */ int access$400(AbstractMapBasedMultimap abstractMapBasedMultimap, Object obj) {
Collection collection = (Collection) Maps.safeRemove(abstractMapBasedMultimap.map, obj);
if (collection == null) {
return 0;
}
int size = collection.size();
collection.clear();
abstractMapBasedMultimap.totalSize -= size;
return size;
}
/* JADX INFO: Access modifiers changed from: private */
public List wrapList(Object obj, List list, WrappedCollection wrappedCollection) {
return list instanceof RandomAccess ? new RandomAccessWrappedList(this, obj, list, wrappedCollection) : new WrappedList(obj, list, wrappedCollection);
}
@Override // com.squareup.haha.guava.collect.Multimap
public void clear() {
Iterator<Collection<V>> it = this.map.values().iterator();
while (it.hasNext()) {
it.next().clear();
}
this.map.clear();
this.totalSize = 0;
}
@Override // com.squareup.haha.guava.collect.AbstractMultimap
final Map<K, Collection<V>> createAsMap() {
Map<K, Collection<V>> map = this.map;
return map instanceof SortedMap ? new SortedAsMap((SortedMap) map) : new AsMap(map);
}
abstract Collection<V> createCollection();
@Override // com.squareup.haha.guava.collect.AbstractMultimap
final Set<K> createKeySet() {
Map<K, Collection<V>> map = this.map;
return map instanceof SortedMap ? new SortedKeySet((SortedMap) map) : new KeySet(map);
}
@Override // com.squareup.haha.guava.collect.AbstractMultimap
public Collection<Map.Entry<K, V>> entries() {
return super.entries();
}
@Override // com.squareup.haha.guava.collect.AbstractMultimap
final Iterator<Map.Entry<K, V>> entryIterator() {
return new Itr(this) { // from class: com.squareup.haha.guava.collect.AbstractMapBasedMultimap.2
@Override // com.squareup.haha.guava.collect.AbstractMapBasedMultimap.Itr
final /* bridge */ /* synthetic */ Object output(Object obj, Object obj2) {
return Maps.immutableEntry(obj, obj2);
}
};
}
@Override // com.squareup.haha.guava.collect.Multimap
public Collection<V> get(K k) {
Collection<V> collection = this.map.get(k);
if (collection == null) {
collection = createCollection();
}
return wrapCollection(k, collection);
}
@Override // com.squareup.haha.guava.collect.AbstractMultimap, com.squareup.haha.guava.collect.Multimap
public boolean put(K k, V v) {
Collection<V> collection = this.map.get(k);
if (collection != null) {
if (!collection.add(v)) {
return false;
}
this.totalSize++;
return true;
}
Collection<V> createCollection = createCollection();
if (!createCollection.add(v)) {
throw new AssertionError("New Collection violated the Collection spec");
}
this.totalSize++;
this.map.put(k, createCollection);
return true;
}
@Override // com.squareup.haha.guava.collect.Multimap
public int size() {
return this.totalSize;
}
@Override // com.squareup.haha.guava.collect.AbstractMultimap
final Iterator<V> valueIterator() {
return new Itr(this) { // from class: com.squareup.haha.guava.collect.AbstractMapBasedMultimap.1
@Override // com.squareup.haha.guava.collect.AbstractMapBasedMultimap.Itr
final V output(K k, V v) {
return v;
}
};
}
@Override // com.squareup.haha.guava.collect.AbstractMultimap, com.squareup.haha.guava.collect.Multimap
public Collection<V> values() {
return super.values();
}
final Collection<V> wrapCollection(K k, Collection<V> collection) {
return collection instanceof SortedSet ? new WrappedSortedSet(k, (SortedSet) collection, null) : collection instanceof Set ? new WrappedSet(k, (Set) collection) : collection instanceof List ? wrapList(k, (List) collection, null) : new WrappedCollection(k, collection, null);
}
class WrappedCollection extends AbstractCollection<V> {
final WrappedCollection ancestor;
private Collection<V> ancestorDelegate;
Collection<V> delegate;
final K key;
/* JADX WARN: Multi-variable type inference failed */
WrappedCollection(Object obj, Collection collection, WrappedCollection wrappedCollection) {
this.key = obj;
this.delegate = collection;
this.ancestor = wrappedCollection;
this.ancestorDelegate = wrappedCollection == null ? null : wrappedCollection.delegate;
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean add(V v) {
refreshIfEmpty();
boolean isEmpty = this.delegate.isEmpty();
boolean add = this.delegate.add(v);
if (add) {
AbstractMapBasedMultimap.access$208(AbstractMapBasedMultimap.this);
if (isEmpty) {
addToMap();
}
}
return add;
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean addAll(Collection<? extends V> collection) {
if (collection.isEmpty()) {
return false;
}
int size = size();
boolean addAll = this.delegate.addAll(collection);
if (addAll) {
AbstractMapBasedMultimap.access$212(AbstractMapBasedMultimap.this, this.delegate.size() - size);
if (size == 0) {
addToMap();
}
}
return addAll;
}
final void addToMap() {
WrappedCollection wrappedCollection = this.ancestor;
if (wrappedCollection != null) {
wrappedCollection.addToMap();
} else {
AbstractMapBasedMultimap.this.map.put(this.key, this.delegate);
}
}
@Override // java.util.AbstractCollection, java.util.Collection
public void clear() {
int size = size();
if (size == 0) {
return;
}
this.delegate.clear();
AbstractMapBasedMultimap.access$220(AbstractMapBasedMultimap.this, size);
removeIfEmpty();
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean contains(Object obj) {
refreshIfEmpty();
return this.delegate.contains(obj);
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean containsAll(Collection<?> collection) {
refreshIfEmpty();
return this.delegate.containsAll(collection);
}
@Override // java.util.Collection
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
refreshIfEmpty();
return this.delegate.equals(obj);
}
@Override // java.util.Collection
public int hashCode() {
refreshIfEmpty();
return this.delegate.hashCode();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public Iterator<V> iterator() {
refreshIfEmpty();
return new WrappedIterator();
}
final void refreshIfEmpty() {
Collection<V> collection;
WrappedCollection wrappedCollection = this.ancestor;
if (wrappedCollection != null) {
wrappedCollection.refreshIfEmpty();
if (this.ancestor.delegate != this.ancestorDelegate) {
throw new ConcurrentModificationException();
}
} else {
if (!this.delegate.isEmpty() || (collection = (Collection) AbstractMapBasedMultimap.this.map.get(this.key)) == null) {
return;
}
this.delegate = collection;
}
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean remove(Object obj) {
refreshIfEmpty();
boolean remove = this.delegate.remove(obj);
if (remove) {
AbstractMapBasedMultimap.access$210(AbstractMapBasedMultimap.this);
removeIfEmpty();
}
return remove;
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean removeAll(Collection<?> collection) {
if (collection.isEmpty()) {
return false;
}
int size = size();
boolean removeAll = this.delegate.removeAll(collection);
if (removeAll) {
AbstractMapBasedMultimap.access$212(AbstractMapBasedMultimap.this, this.delegate.size() - size);
removeIfEmpty();
}
return removeAll;
}
final void removeIfEmpty() {
WrappedCollection wrappedCollection = this.ancestor;
if (wrappedCollection != null) {
wrappedCollection.removeIfEmpty();
} else if (this.delegate.isEmpty()) {
AbstractMapBasedMultimap.this.map.remove(this.key);
}
}
@Override // java.util.AbstractCollection, java.util.Collection
public boolean retainAll(Collection<?> collection) {
Joiner.checkNotNull(collection);
int size = size();
boolean retainAll = this.delegate.retainAll(collection);
if (retainAll) {
AbstractMapBasedMultimap.access$212(AbstractMapBasedMultimap.this, this.delegate.size() - size);
removeIfEmpty();
}
return retainAll;
}
@Override // java.util.AbstractCollection, java.util.Collection
public int size() {
refreshIfEmpty();
return this.delegate.size();
}
@Override // java.util.AbstractCollection
public String toString() {
refreshIfEmpty();
return this.delegate.toString();
}
class WrappedIterator implements Iterator<V> {
final Iterator<V> delegateIterator;
private Collection<V> originalDelegate;
WrappedIterator() {
this.originalDelegate = WrappedCollection.this.delegate;
this.delegateIterator = AbstractMapBasedMultimap.access$100(AbstractMapBasedMultimap.this, WrappedCollection.this.delegate);
}
@Override // java.util.Iterator
public boolean hasNext() {
validateIterator();
return this.delegateIterator.hasNext();
}
@Override // java.util.Iterator
public V next() {
validateIterator();
return this.delegateIterator.next();
}
@Override // java.util.Iterator
public void remove() {
this.delegateIterator.remove();
AbstractMapBasedMultimap.access$210(AbstractMapBasedMultimap.this);
WrappedCollection.this.removeIfEmpty();
}
final void validateIterator() {
WrappedCollection.this.refreshIfEmpty();
if (WrappedCollection.this.delegate != this.originalDelegate) {
throw new ConcurrentModificationException();
}
}
WrappedIterator(Iterator<V> it) {
this.originalDelegate = WrappedCollection.this.delegate;
this.delegateIterator = it;
}
}
}
class WrappedList extends WrappedCollection implements List {
class WrappedListIterator extends WrappedCollection.WrappedIterator implements ListIterator {
WrappedListIterator() {
super();
}
private ListIterator<V> getDelegateListIterator() {
validateIterator();
return (ListIterator) this.delegateIterator;
}
@Override // java.util.ListIterator
public final void add(V v) {
boolean isEmpty = WrappedList.this.isEmpty();
getDelegateListIterator().add(v);
AbstractMapBasedMultimap.access$208(AbstractMapBasedMultimap.this);
if (isEmpty) {
WrappedList.this.addToMap();
}
}
@Override // java.util.ListIterator
public final boolean hasPrevious() {
return getDelegateListIterator().hasPrevious();
}
@Override // java.util.ListIterator
public final int nextIndex() {
return getDelegateListIterator().nextIndex();
}
@Override // java.util.ListIterator
public final V previous() {
return getDelegateListIterator().previous();
}
@Override // java.util.ListIterator
public final int previousIndex() {
return getDelegateListIterator().previousIndex();
}
@Override // java.util.ListIterator
public final void set(V v) {
getDelegateListIterator().set(v);
}
public WrappedListIterator(int i) {
super(WrappedList.this.getListDelegate().listIterator(i));
}
}
WrappedList(Object obj, List list, WrappedCollection wrappedCollection) {
super(obj, list, wrappedCollection);
}
@Override // java.util.List
public void add(int i, V v) {
refreshIfEmpty();
boolean isEmpty = this.delegate.isEmpty();
getListDelegate().add(i, v);
AbstractMapBasedMultimap.access$208(AbstractMapBasedMultimap.this);
if (isEmpty) {
addToMap();
}
}
@Override // java.util.List
public boolean addAll(int i, Collection<? extends V> collection) {
if (collection.isEmpty()) {
return false;
}
int size = size();
boolean addAll = getListDelegate().addAll(i, collection);
if (addAll) {
AbstractMapBasedMultimap.access$212(AbstractMapBasedMultimap.this, this.delegate.size() - size);
if (size == 0) {
addToMap();
}
}
return addAll;
}
@Override // java.util.List
public V get(int i) {
refreshIfEmpty();
return getListDelegate().get(i);
}
final List<V> getListDelegate() {
return (List) this.delegate;
}
@Override // java.util.List
public int indexOf(Object obj) {
refreshIfEmpty();
return getListDelegate().indexOf(obj);
}
@Override // java.util.List
public int lastIndexOf(Object obj) {
refreshIfEmpty();
return getListDelegate().lastIndexOf(obj);
}
@Override // java.util.List
public ListIterator<V> listIterator() {
refreshIfEmpty();
return new WrappedListIterator();
}
@Override // java.util.List
public V remove(int i) {
refreshIfEmpty();
V remove = getListDelegate().remove(i);
AbstractMapBasedMultimap.access$210(AbstractMapBasedMultimap.this);
removeIfEmpty();
return remove;
}
@Override // java.util.List
public V set(int i, V v) {
refreshIfEmpty();
return getListDelegate().set(i, v);
}
@Override // java.util.List
public List<V> subList(int i, int i2) {
refreshIfEmpty();
AbstractMapBasedMultimap abstractMapBasedMultimap = AbstractMapBasedMultimap.this;
K k = this.key;
List<V> subList = getListDelegate().subList(i, i2);
WrappedCollection wrappedCollection = this.ancestor;
if (wrappedCollection == null) {
wrappedCollection = this;
}
return abstractMapBasedMultimap.wrapList(k, subList, wrappedCollection);
}
@Override // java.util.List
public ListIterator<V> listIterator(int i) {
refreshIfEmpty();
return new WrappedListIterator(i);
}
}
}

View File

@@ -0,0 +1,43 @@
package com.squareup.haha.guava.collect;
import com.squareup.haha.guava.base.Joiner;
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) {
Map.Entry entry = (Map.Entry) obj;
if (Joiner.equal(getKey(), entry.getKey()) && Joiner.equal(getValue(), entry.getValue())) {
return true;
}
}
return false;
}
@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,189 @@
package com.squareup.haha.guava.collect;
import com.squareup.haha.guava.base.Joiner;
import com.squareup.haha.guava.collect.Maps;
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 Collection<V> values;
class Entries extends Multimaps$Entries<K, V> {
private Entries() {
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public Iterator<Map.Entry<K, V>> iterator() {
return AbstractMultimap.this.entryIterator();
}
@Override // com.squareup.haha.guava.collect.Multimaps$Entries
final Multimap<K, V> multimap() {
return AbstractMultimap.this;
}
/* synthetic */ Entries(AbstractMultimap abstractMultimap, byte b) {
this();
}
}
class EntrySet extends Entries implements Set {
private EntrySet(AbstractMultimap abstractMultimap) {
super(abstractMultimap, (byte) 0);
}
@Override // java.util.Collection, java.util.Set
public final boolean equals(Object obj) {
return Joiner.equalsImpl(this, obj);
}
@Override // java.util.Collection, java.util.Set
public final int hashCode() {
Iterator it = iterator();
int i = 0;
while (it.hasNext()) {
Object next = it.next();
i = ~(~(i + (next != null ? next.hashCode() : 0)));
}
return i;
}
/* synthetic */ EntrySet(AbstractMultimap abstractMultimap, byte b) {
this(abstractMultimap);
}
}
class Values extends AbstractCollection<V> {
Values() {
}
@Override // java.util.AbstractCollection, java.util.Collection
public final void clear() {
AbstractMultimap.this.clear();
}
@Override // java.util.AbstractCollection, java.util.Collection
public final boolean contains(Object obj) {
return AbstractMultimap.this.containsValue(obj);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public final Iterator<V> iterator() {
return AbstractMultimap.this.valueIterator();
}
@Override // java.util.AbstractCollection, java.util.Collection
public final int size() {
return AbstractMultimap.this.size();
}
}
AbstractMultimap() {
}
@Override // com.squareup.haha.guava.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.squareup.haha.guava.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();
Set<K> createKeySet() {
return new Maps.KeySet(asMap());
}
public Collection<Map.Entry<K, V>> entries() {
Collection<Map.Entry<K, V>> collection = this.entries;
if (collection == null) {
byte b = 0;
collection = this instanceof SetMultimap ? new EntrySet(this, b) : new Entries(this, b);
this.entries = collection;
}
return collection;
}
abstract Iterator<Map.Entry<K, V>> entryIterator();
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof Multimap) {
return asMap().equals(((Multimap) obj).asMap());
}
return false;
}
public int hashCode() {
return asMap().hashCode();
}
public Set<K> keySet() {
Set<K> set = this.keySet;
if (set != null) {
return set;
}
Set<K> createKeySet = createKeySet();
this.keySet = createKeySet;
return createKeySet;
}
@Override // com.squareup.haha.guava.collect.Multimap
public boolean put(K k, V v) {
return get(k).add(v);
}
@Override // com.squareup.haha.guava.collect.Multimap
public boolean remove(Object obj, Object obj2) {
Collection<V> collection = asMap().get(obj);
return collection != null && collection.remove(obj2);
}
public String toString() {
return asMap().toString();
}
Iterator<V> valueIterator() {
return Maps.valueIterator(entries().iterator());
}
@Override // com.squareup.haha.guava.collect.Multimap
public Collection<V> values() {
Collection<V> collection = this.values;
if (collection != null) {
return collection;
}
Values values = new Values();
this.values = values;
return values;
}
}

View File

@@ -0,0 +1,100 @@
package com.squareup.haha.guava.collect;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
public final class ArrayListMultimap<K, V> extends AbstractListMultimap<K, V> {
private transient int expectedValuesPerKey;
private ArrayListMultimap() {
super(new HashMap());
this.expectedValuesPerKey = 3;
}
public static <K, V> ArrayListMultimap<K, V> create() {
return new ArrayListMultimap<>();
}
@Override // com.squareup.haha.guava.collect.AbstractListMultimap, com.squareup.haha.guava.collect.AbstractMultimap, com.squareup.haha.guava.collect.Multimap
public final /* bridge */ /* synthetic */ Map asMap() {
return super.asMap();
}
@Override // com.squareup.haha.guava.collect.AbstractMapBasedMultimap, com.squareup.haha.guava.collect.Multimap
public final /* bridge */ /* synthetic */ void clear() {
super.clear();
}
@Override // com.squareup.haha.guava.collect.AbstractMultimap, com.squareup.haha.guava.collect.Multimap
public final /* bridge */ /* synthetic */ boolean containsEntry(Object obj, Object obj2) {
return super.containsEntry(obj, obj2);
}
@Override // com.squareup.haha.guava.collect.AbstractMultimap
public final /* bridge */ /* synthetic */ boolean containsValue(Object obj) {
return super.containsValue(obj);
}
@Override // com.squareup.haha.guava.collect.AbstractMapBasedMultimap, com.squareup.haha.guava.collect.AbstractMultimap
public final /* bridge */ /* synthetic */ Collection entries() {
return super.entries();
}
@Override // com.squareup.haha.guava.collect.AbstractListMultimap, com.squareup.haha.guava.collect.AbstractMultimap
public final /* bridge */ /* synthetic */ boolean equals(Object obj) {
return super.equals(obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.squareup.haha.guava.collect.AbstractListMultimap, com.squareup.haha.guava.collect.AbstractMapBasedMultimap, com.squareup.haha.guava.collect.Multimap
public final /* bridge */ /* synthetic */ List get(Object obj) {
return super.get((ArrayListMultimap<K, V>) obj);
}
@Override // com.squareup.haha.guava.collect.AbstractMultimap
public final /* bridge */ /* synthetic */ int hashCode() {
return super.hashCode();
}
@Override // com.squareup.haha.guava.collect.AbstractMultimap
public final /* bridge */ /* synthetic */ Set keySet() {
return super.keySet();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.squareup.haha.guava.collect.AbstractListMultimap, com.squareup.haha.guava.collect.AbstractMapBasedMultimap, com.squareup.haha.guava.collect.AbstractMultimap, com.squareup.haha.guava.collect.Multimap
public final /* bridge */ /* synthetic */ boolean put(Object obj, Object obj2) {
return super.put(obj, obj2);
}
@Override // com.squareup.haha.guava.collect.AbstractMultimap, com.squareup.haha.guava.collect.Multimap
public final /* bridge */ /* synthetic */ boolean remove(Object obj, Object obj2) {
return super.remove(obj, obj2);
}
@Override // com.squareup.haha.guava.collect.AbstractMapBasedMultimap, com.squareup.haha.guava.collect.Multimap
public final /* bridge */ /* synthetic */ int size() {
return super.size();
}
@Override // com.squareup.haha.guava.collect.AbstractMultimap
public final /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
@Override // com.squareup.haha.guava.collect.AbstractMapBasedMultimap, com.squareup.haha.guava.collect.AbstractMultimap, com.squareup.haha.guava.collect.Multimap
public final /* bridge */ /* synthetic */ Collection values() {
return super.values();
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.squareup.haha.guava.collect.AbstractListMultimap, com.squareup.haha.guava.collect.AbstractMapBasedMultimap
public final List<V> createCollection() {
return new ArrayList(this.expectedValuesPerKey);
}
}

View File

@@ -0,0 +1,18 @@
package com.squareup.haha.guava.collect;
import com.squareup.haha.guava.base.Joiner;
import java.util.Collection;
/* loaded from: classes.dex */
public final class Collections2 {
static final Joiner STANDARD_JOINER = new Joiner(", ").useForNull("null");
static boolean safeContains(Collection<?> collection, Object obj) {
Joiner.checkNotNull(collection);
try {
return collection.contains(obj);
} catch (ClassCastException | NullPointerException unused) {
return false;
}
}
}

View File

@@ -0,0 +1,13 @@
package com.squareup.haha.guava.collect;
/* loaded from: classes.dex */
public abstract class FluentIterable<E> implements Iterable<E> {
private final Iterable<E> iterable = this;
protected FluentIterable() {
}
public String toString() {
return Iterables.toString(this.iterable);
}
}

View File

@@ -0,0 +1,29 @@
package com.squareup.haha.guava.collect;
/* loaded from: classes.dex */
abstract class ImmutableAsList<E> extends ImmutableList<E> {
ImmutableAsList() {
}
@Override // com.squareup.haha.guava.collect.ImmutableList, com.squareup.haha.guava.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.List
public boolean contains(Object obj) {
return delegateCollection().contains(obj);
}
abstract ImmutableCollection<E> delegateCollection();
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public boolean isEmpty() {
return delegateCollection().isEmpty();
}
@Override // com.squareup.haha.guava.collect.ImmutableCollection
final boolean isPartialView() {
return delegateCollection().isPartialView();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public int size() {
return delegateCollection().size();
}
}

View File

@@ -0,0 +1,103 @@
package com.squareup.haha.guava.collect;
import com.squareup.haha.guava.base.Joiner;
import java.io.Serializable;
import java.util.AbstractCollection;
import java.util.Collection;
import java.util.Iterator;
/* loaded from: classes.dex */
public abstract class ImmutableCollection<E> extends AbstractCollection<E> implements Serializable {
private transient ImmutableList<E> asList;
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() {
ImmutableList<E> immutableList = this.asList;
if (immutableList == null) {
int size = size();
immutableList = size != 0 ? size != 1 ? new RegularImmutableAsList<>(this, toArray()) : ImmutableList.of((Object) iterator().next()) : ImmutableList.of();
this.asList = immutableList;
}
return immutableList;
}
@Override // java.util.AbstractCollection, java.util.Collection
@Deprecated
public final void clear() {
throw new UnsupportedOperationException();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public boolean contains(Object obj) {
return obj != null && super.contains(obj);
}
int copyIntoArray(Object[] objArr, int i) {
Iterator 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
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() {
if (size() == 0) {
return ObjectArrays.EMPTY_ARRAY;
}
Object[] objArr = new Object[size()];
copyIntoArray(objArr, 0);
return objArr;
}
@Override // java.util.AbstractCollection, java.util.Collection
public final <T> T[] toArray(T[] tArr) {
Joiner.checkNotNull(tArr);
int size = size();
if (tArr.length < size) {
tArr = (T[]) ObjectArrays.newArray(tArr, size);
} else if (tArr.length > size) {
tArr[size] = null;
}
copyIntoArray(tArr, 0);
return tArr;
}
}

View File

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

View File

@@ -0,0 +1,304 @@
package com.squareup.haha.guava.collect;
import com.squareup.haha.guava.base.Joiner;
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 abstract class ImmutableList<E> extends ImmutableCollection<E> implements List<E>, RandomAccess {
static final ImmutableList<Object> EMPTY = new RegularImmutableList(ObjectArrays.EMPTY_ARRAY);
static class ReverseImmutableList<E> extends ImmutableList<E> {
private final transient ImmutableList<E> forwardList;
ReverseImmutableList(ImmutableList<E> immutableList) {
this.forwardList = immutableList;
}
private int reverseIndex(int i) {
return (size() - 1) - i;
}
@Override // com.squareup.haha.guava.collect.ImmutableList, com.squareup.haha.guava.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.List
public final boolean contains(Object obj) {
return this.forwardList.contains(obj);
}
@Override // java.util.List
public final E get(int i) {
Joiner.checkElementIndex(i, size());
return this.forwardList.get(reverseIndex(i));
}
@Override // com.squareup.haha.guava.collect.ImmutableList, java.util.List
public final int indexOf(Object obj) {
int lastIndexOf = this.forwardList.lastIndexOf(obj);
if (lastIndexOf >= 0) {
return reverseIndex(lastIndexOf);
}
return -1;
}
@Override // com.squareup.haha.guava.collect.ImmutableCollection
final boolean isPartialView() {
return this.forwardList.isPartialView();
}
@Override // com.squareup.haha.guava.collect.ImmutableList, com.squareup.haha.guava.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public final /* bridge */ /* synthetic */ Iterator iterator() {
return super.iterator();
}
@Override // com.squareup.haha.guava.collect.ImmutableList, java.util.List
public final int lastIndexOf(Object obj) {
int indexOf = this.forwardList.indexOf(obj);
if (indexOf >= 0) {
return reverseIndex(indexOf);
}
return -1;
}
@Override // com.squareup.haha.guava.collect.ImmutableList, java.util.List
public final /* bridge */ /* synthetic */ ListIterator listIterator(int i) {
return super.listIterator(i);
}
@Override // com.squareup.haha.guava.collect.ImmutableList
public final ImmutableList<E> reverse() {
return this.forwardList;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public final int size() {
return this.forwardList.size();
}
@Override // com.squareup.haha.guava.collect.ImmutableList, java.util.List
public final /* bridge */ /* synthetic */ ListIterator listIterator() {
return listIterator(0);
}
@Override // com.squareup.haha.guava.collect.ImmutableList, java.util.List
public final ImmutableList<E> subList(int i, int i2) {
Joiner.checkPositionIndexes(i, i2, size());
return this.forwardList.subList(size() - i2, size() - i).reverse();
}
}
class SubList extends ImmutableList<E> {
private transient int length;
private transient int offset;
SubList(int i, int i2) {
this.offset = i;
this.length = i2;
}
@Override // java.util.List
public final E get(int i) {
Joiner.checkElementIndex(i, this.length);
return ImmutableList.this.get(i + this.offset);
}
@Override // com.squareup.haha.guava.collect.ImmutableCollection
final boolean isPartialView() {
return true;
}
@Override // com.squareup.haha.guava.collect.ImmutableList, com.squareup.haha.guava.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public final /* bridge */ /* synthetic */ Iterator iterator() {
return super.iterator();
}
@Override // com.squareup.haha.guava.collect.ImmutableList, java.util.List
public final /* bridge */ /* synthetic */ ListIterator listIterator(int i) {
return super.listIterator(i);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public final int size() {
return this.length;
}
@Override // com.squareup.haha.guava.collect.ImmutableList, java.util.List
public final /* bridge */ /* synthetic */ ListIterator listIterator() {
return listIterator(0);
}
@Override // com.squareup.haha.guava.collect.ImmutableList, java.util.List
public final ImmutableList<E> subList(int i, int i2) {
Joiner.checkPositionIndexes(i, i2, this.length);
ImmutableList immutableList = ImmutableList.this;
int i3 = this.offset;
return immutableList.subList(i + i3, i2 + i3);
}
}
ImmutableList() {
}
static <E> ImmutableList<E> asImmutableList(Object[] objArr) {
int length = objArr.length;
if (length == 0) {
return (ImmutableList<E>) EMPTY;
}
if (length == 1) {
return new SingletonImmutableList(objArr[0]);
}
if (length < objArr.length) {
objArr = ObjectArrays.arraysCopyOf(objArr, length);
}
return new RegularImmutableList(objArr);
}
public static <E> ImmutableList<E> copyOf(Collection<? extends E> collection) {
if (!(collection instanceof ImmutableCollection)) {
return asImmutableList(ObjectArrays.checkElementsNotNull(collection.toArray()));
}
ImmutableList<E> asList = ((ImmutableCollection) collection).asList();
return asList.isPartialView() ? asImmutableList(asList.toArray()) : asList;
}
public static <E> ImmutableList<E> of() {
return (ImmutableList<E>) EMPTY;
}
@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.squareup.haha.guava.collect.ImmutableCollection
public final ImmutableList<E> asList() {
return this;
}
@Override // com.squareup.haha.guava.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.List
public boolean contains(Object obj) {
return indexOf(obj) >= 0;
}
@Override // com.squareup.haha.guava.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) {
if (obj == Joiner.checkNotNull(this)) {
return true;
}
if (!(obj instanceof List)) {
return false;
}
List list = (List) obj;
return size() == list.size() && Iterators.elementsEqual(iterator(), list.iterator());
}
@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;
}
ListIterator<E> listIterator = listIterator();
while (listIterator.hasNext()) {
if (Joiner.equal(obj, listIterator.next())) {
return listIterator.previousIndex();
}
}
return -1;
}
@Override // java.util.List
public int lastIndexOf(Object obj) {
if (obj == null) {
return -1;
}
ListIterator<E> listIterator = listIterator(size());
while (listIterator.hasPrevious()) {
if (Joiner.equal(obj, listIterator.previous())) {
return listIterator.nextIndex();
}
}
return -1;
}
@Override // java.util.List
@Deprecated
public final E remove(int i) {
throw new UnsupportedOperationException();
}
public ImmutableList<E> reverse() {
return 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);
}
public static <E> ImmutableList<E> of(E e) {
return new SingletonImmutableList(e);
}
@Override // com.squareup.haha.guava.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public UnmodifiableIterator<E> iterator() {
return listIterator(0);
}
@Override // java.util.List
public UnmodifiableListIterator<E> listIterator(int i) {
return new AbstractIndexedListIterator<E>(size(), i) { // from class: com.squareup.haha.guava.collect.ImmutableList.1
@Override // com.squareup.haha.guava.collect.AbstractIndexedListIterator
protected final E get(int i2) {
return ImmutableList.this.get(i2);
}
};
}
@Override // java.util.List
public ImmutableList<E> subList(int i, int i2) {
Joiner.checkPositionIndexes(i, i2, size());
int i3 = i2 - i;
return i3 != 0 ? i3 != 1 ? subListUnchecked(i, i2) : of((Object) get(i)) : (ImmutableList<E>) EMPTY;
}
public static <E> ImmutableList<E> of(E e, E e2) {
return asImmutableList(ObjectArrays.checkElementsNotNull(e, e2));
}
@Override // java.util.List
public /* bridge */ /* synthetic */ ListIterator listIterator() {
return listIterator(0);
}
}

View File

@@ -0,0 +1,31 @@
package com.squareup.haha.guava.collect;
import com.squareup.haha.guava.base.Joiner;
import java.util.Iterator;
/* loaded from: classes.dex */
public final class Iterables {
static /* synthetic */ Iterator access$100(Iterable iterable) {
return new TransformedIterator<Iterable<? extends T>, Iterator<? extends T>>(iterable.iterator()) { // from class: com.squareup.haha.guava.collect.Iterables.3
@Override // com.squareup.haha.guava.collect.TransformedIterator
final /* bridge */ /* synthetic */ Object transform(Object obj) {
return ((Iterable) obj).iterator();
}
};
}
public static <T> Iterable<T> concat(Iterable<? extends T> iterable, Iterable<? extends T> iterable2) {
final ImmutableList of = ImmutableList.of(iterable, iterable2);
Joiner.checkNotNull(of);
return new FluentIterable<T>() { // from class: com.squareup.haha.guava.collect.Iterables.2
@Override // java.lang.Iterable
public final Iterator<T> iterator() {
return Iterators.concat(Iterables.access$100(of));
}
};
}
public static String toString(Iterable<?> iterable) {
return Iterators.toString(iterable.iterator());
}
}

View File

@@ -0,0 +1,184 @@
package com.squareup.haha.guava.collect;
import com.squareup.haha.guava.base.Function;
import com.squareup.haha.guava.base.Joiner;
import com.squareup.haha.guava.base.Predicate;
import com.squareup.haha.guava.base.Predicates;
import java.util.Collection;
import java.util.Iterator;
import java.util.NoSuchElementException;
/* loaded from: classes.dex */
public final class Iterators {
private static UnmodifiableListIterator<Object> EMPTY_LIST_ITERATOR = new UnmodifiableListIterator<Object>() { // from class: com.squareup.haha.guava.collect.Iterators.1
@Override // java.util.Iterator, java.util.ListIterator
public final boolean hasNext() {
return false;
}
@Override // java.util.ListIterator
public final boolean hasPrevious() {
return false;
}
@Override // java.util.Iterator, java.util.ListIterator
public final Object next() {
throw new NoSuchElementException();
}
@Override // java.util.ListIterator
public final int nextIndex() {
return 0;
}
@Override // java.util.ListIterator
public final Object previous() {
throw new NoSuchElementException();
}
@Override // java.util.ListIterator
public final int previousIndex() {
return -1;
}
};
private static final Iterator<Object> EMPTY_MODIFIABLE_ITERATOR = new Iterator<Object>() { // from class: com.squareup.haha.guava.collect.Iterators.2
@Override // java.util.Iterator
public final boolean hasNext() {
return false;
}
@Override // java.util.Iterator
public final Object next() {
throw new NoSuchElementException();
}
@Override // java.util.Iterator
public final void remove() {
Joiner.checkRemove(false);
}
};
static void clear(Iterator<?> it) {
Joiner.checkNotNull(it);
while (it.hasNext()) {
it.next();
it.remove();
}
}
public static <T> Iterator<T> concat(final Iterator<? extends Iterator<? extends T>> it) {
Joiner.checkNotNull(it);
return new Iterator<T>() { // from class: com.squareup.haha.guava.collect.Iterators.5
private Iterator<? extends T> current = Iterators.emptyIterator();
private Iterator<? extends T> removeFrom;
@Override // java.util.Iterator
public final boolean hasNext() {
boolean hasNext;
while (true) {
hasNext = ((Iterator) Joiner.checkNotNull(this.current)).hasNext();
if (hasNext || !it.hasNext()) {
break;
}
this.current = (Iterator) it.next();
}
return hasNext;
}
@Override // java.util.Iterator
public final T next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
Iterator<? extends T> it2 = this.current;
this.removeFrom = it2;
return it2.next();
}
@Override // java.util.Iterator
public final void remove() {
Joiner.checkRemove(this.removeFrom != null);
this.removeFrom.remove();
this.removeFrom = null;
}
};
}
public static boolean elementsEqual(Iterator<?> it, Iterator<?> it2) {
while (it.hasNext()) {
if (!it2.hasNext() || !Joiner.equal(it.next(), it2.next())) {
return false;
}
}
return !it2.hasNext();
}
public static <T> UnmodifiableIterator<T> emptyIterator() {
return EMPTY_LIST_ITERATOR;
}
static <T> Iterator<T> emptyModifiableIterator() {
return (Iterator<T>) EMPTY_MODIFIABLE_ITERATOR;
}
static <T> UnmodifiableListIterator<T> forArray(final T[] tArr, final int i, int i2, int i3) {
Joiner.checkArgument(i2 >= 0);
Joiner.checkPositionIndexes(i, i + i2, tArr.length);
Joiner.checkPositionIndex(i3, i2);
return i2 == 0 ? (UnmodifiableListIterator<T>) EMPTY_LIST_ITERATOR : new AbstractIndexedListIterator<T>(i2, i3) { // from class: com.squareup.haha.guava.collect.Iterators.11
@Override // com.squareup.haha.guava.collect.AbstractIndexedListIterator
protected final T get(int i4) {
return (T) tArr[i + i4];
}
};
}
public static boolean removeAll(Iterator<?> it, Collection<?> collection) {
Predicate in = Predicates.in(collection);
Joiner.checkNotNull(in);
boolean z = false;
while (it.hasNext()) {
if (in.apply(it.next())) {
it.remove();
z = true;
}
}
return z;
}
public static <T> UnmodifiableIterator<T> singletonIterator(final T t) {
return new UnmodifiableIterator<T>() { // from class: com.squareup.haha.guava.collect.Iterators.12
private boolean done;
@Override // java.util.Iterator
public final boolean hasNext() {
return !this.done;
}
@Override // java.util.Iterator
public final T next() {
if (this.done) {
throw new NoSuchElementException();
}
this.done = true;
return (T) t;
}
};
}
public static String toString(Iterator<?> it) {
StringBuilder appendTo = Collections2.STANDARD_JOINER.appendTo(new StringBuilder("["), it);
appendTo.append(']');
return appendTo.toString();
}
public static <F, T> Iterator<T> transform(Iterator<F> it, final Function<? super F, ? extends T> function) {
Joiner.checkNotNull(function);
return new TransformedIterator<F, T>(it) { // from class: com.squareup.haha.guava.collect.Iterators.8
@Override // com.squareup.haha.guava.collect.TransformedIterator
final T transform(F f) {
return (T) function.apply(f);
}
};
}
}

View File

@@ -0,0 +1,5 @@
package com.squareup.haha.guava.collect;
/* loaded from: classes.dex */
public interface ListMultimap extends Multimap {
}

View File

@@ -0,0 +1,11 @@
package com.squareup.haha.guava.collect;
import java.util.List;
import java.util.RandomAccess;
/* loaded from: classes.dex */
public final class Lists$RandomAccessReverseList<T> extends Lists$ReverseList<T> implements RandomAccess {
public Lists$RandomAccessReverseList(List<T> list) {
super(list);
}
}

View File

@@ -0,0 +1,144 @@
package com.squareup.haha.guava.collect;
import com.squareup.haha.guava.base.Joiner;
import java.util.AbstractList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.NoSuchElementException;
/* loaded from: classes.dex */
public class Lists$ReverseList<T> extends AbstractList<T> {
public final List<T> forwardList;
public Lists$ReverseList(List<T> list) {
this.forwardList = (List) Joiner.checkNotNull(list);
}
private int reverseIndex(int i) {
int size = size();
Joiner.checkElementIndex(i, size);
return (size - 1) - i;
}
/* JADX INFO: Access modifiers changed from: private */
public int reversePosition(int i) {
int size = size();
Joiner.checkPositionIndex(i, size);
return size - i;
}
@Override // java.util.AbstractList, java.util.List
public void add(int i, T t) {
this.forwardList.add(reversePosition(i), t);
}
@Override // java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List
public void clear() {
this.forwardList.clear();
}
@Override // java.util.AbstractList, java.util.List
public T get(int i) {
return this.forwardList.get(reverseIndex(i));
}
@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) {
final ListIterator<T> listIterator = this.forwardList.listIterator(reversePosition(i));
return new ListIterator<T>() { // from class: com.squareup.haha.guava.collect.Lists$ReverseList.1
private boolean canRemoveOrSet;
@Override // java.util.ListIterator
public final void add(T t) {
listIterator.add(t);
listIterator.previous();
this.canRemoveOrSet = false;
}
@Override // java.util.ListIterator, java.util.Iterator
public final boolean hasNext() {
return listIterator.hasPrevious();
}
@Override // java.util.ListIterator
public final boolean hasPrevious() {
return listIterator.hasNext();
}
@Override // java.util.ListIterator, java.util.Iterator
public final T next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
this.canRemoveOrSet = true;
return (T) listIterator.previous();
}
@Override // java.util.ListIterator
public final int nextIndex() {
return Lists$ReverseList.this.reversePosition(listIterator.nextIndex());
}
@Override // java.util.ListIterator
public final T previous() {
if (!hasPrevious()) {
throw new NoSuchElementException();
}
this.canRemoveOrSet = true;
return (T) listIterator.next();
}
@Override // java.util.ListIterator
public final int previousIndex() {
return nextIndex() - 1;
}
@Override // java.util.ListIterator, java.util.Iterator
public final void remove() {
Joiner.checkRemove(this.canRemoveOrSet);
listIterator.remove();
this.canRemoveOrSet = false;
}
@Override // java.util.ListIterator
public final void set(T t) {
if (!this.canRemoveOrSet) {
throw new IllegalStateException();
}
listIterator.set(t);
}
};
}
@Override // java.util.AbstractList, java.util.List
public T remove(int i) {
return this.forwardList.remove(reverseIndex(i));
}
@Override // java.util.AbstractList
protected void removeRange(int i, int i2) {
subList(i, i2).clear();
}
@Override // java.util.AbstractList, java.util.List
public T set(int i, T t) {
return this.forwardList.set(reverseIndex(i), t);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public int size() {
return this.forwardList.size();
}
@Override // java.util.AbstractList, java.util.List
public List<T> subList(int i, int i2) {
Joiner.checkPositionIndexes(i, i2, size());
return Joiner.reverse(this.forwardList.subList(reversePosition(i2), reversePosition(i)));
}
}

View File

@@ -0,0 +1,349 @@
package com.squareup.haha.guava.collect;
import com.squareup.haha.guava.base.Function;
import com.squareup.haha.guava.base.Joiner;
import java.util.AbstractCollection;
import java.util.AbstractMap;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
public final class Maps {
/* JADX WARN: $VALUES field not found */
/* JADX WARN: Failed to restore enum class, 'enum' modifier and super class removed */
static abstract class EntryFunction implements Function<Map.Entry<?, ?>, Object> {
public static final EntryFunction KEY = new EntryFunction("KEY", 0) { // from class: com.squareup.haha.guava.collect.Maps.EntryFunction.1
{
byte b = 0;
}
@Override // com.squareup.haha.guava.base.Function
public final /* bridge */ /* synthetic */ Object apply(Map.Entry<?, ?> entry) {
return entry.getKey();
}
};
public static final EntryFunction VALUE = new EntryFunction("VALUE", 1) { // from class: com.squareup.haha.guava.collect.Maps.EntryFunction.2
{
int i = 1;
byte b = 0;
}
@Override // com.squareup.haha.guava.base.Function
public final /* bridge */ /* synthetic */ Object apply(Map.Entry<?, ?> entry) {
return entry.getValue();
}
};
static {
EntryFunction[] entryFunctionArr = {KEY, VALUE};
}
private EntryFunction(String str, int i) {
}
/* synthetic */ EntryFunction(String str, int i, byte b) {
this(str, i);
}
}
static abstract class EntrySet<K, V> extends Sets$ImprovedAbstractSet<Map.Entry<K, V>> {
EntrySet() {
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
map().clear();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
if (obj instanceof Map.Entry) {
Map.Entry entry = (Map.Entry) obj;
Object key = entry.getKey();
Object safeGet = Maps.safeGet(map(), key);
if (Joiner.equal(safeGet, entry.getValue()) && (safeGet != null || map().containsKey(key))) {
return true;
}
}
return false;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean isEmpty() {
return map().isEmpty();
}
abstract Map<K, V> map();
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
if (contains(obj)) {
return map().keySet().remove(((Map.Entry) obj).getKey());
}
return false;
}
@Override // com.squareup.haha.guava.collect.Sets$ImprovedAbstractSet, java.util.AbstractSet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean removeAll(Collection<?> collection) {
try {
return super.removeAll((Collection) Joiner.checkNotNull(collection));
} catch (UnsupportedOperationException unused) {
return Joiner.removeAllImpl(this, collection.iterator());
}
}
@Override // com.squareup.haha.guava.collect.Sets$ImprovedAbstractSet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean retainAll(Collection<?> collection) {
try {
return super.retainAll((Collection) Joiner.checkNotNull(collection));
} catch (UnsupportedOperationException unused) {
HashSet hashSet = new HashSet(Maps.capacity(collection.size()));
for (Object obj : collection) {
if (contains(obj)) {
hashSet.add(((Map.Entry) obj).getKey());
}
}
return map().keySet().retainAll(hashSet);
}
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return map().size();
}
}
static abstract class ImprovedAbstractMap<K, V> extends AbstractMap<K, V> {
private transient Set<Map.Entry<K, V>> entrySet;
private transient Set<K> keySet;
private transient Collection<V> values;
ImprovedAbstractMap() {
}
abstract Set<Map.Entry<K, V>> createEntrySet();
/* renamed from: createKeySet */
Set<K> mo16createKeySet() {
return new KeySet(this);
}
@Override // java.util.AbstractMap, java.util.Map
public Set<Map.Entry<K, V>> entrySet() {
Set<Map.Entry<K, V>> set = this.entrySet;
if (set != null) {
return set;
}
Set<Map.Entry<K, V>> createEntrySet = createEntrySet();
this.entrySet = createEntrySet;
return createEntrySet;
}
@Override // java.util.AbstractMap, java.util.Map
public Set<K> keySet() {
Set<K> set = this.keySet;
if (set != null) {
return set;
}
Set<K> mo16createKeySet = mo16createKeySet();
this.keySet = mo16createKeySet;
return mo16createKeySet;
}
@Override // java.util.AbstractMap, java.util.Map
public Collection<V> values() {
Collection<V> collection = this.values;
if (collection != null) {
return collection;
}
Values values = new Values(this);
this.values = values;
return values;
}
}
static class KeySet<K, V> extends Sets$ImprovedAbstractSet<K> {
final Map<K, V> map;
KeySet(Map<K, V> map) {
this.map = (Map) Joiner.checkNotNull(map);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
this.map.clear();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return this.map.containsKey(obj);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean isEmpty() {
return this.map.isEmpty();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<K> iterator() {
return Maps.keyIterator(this.map.entrySet().iterator());
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
if (!contains(obj)) {
return false;
}
this.map.remove(obj);
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return this.map.size();
}
}
static class Values<K, V> extends AbstractCollection<V> {
private Map<K, V> map;
Values(Map<K, V> map) {
this.map = (Map) Joiner.checkNotNull(map);
}
@Override // java.util.AbstractCollection, java.util.Collection
public final void clear() {
this.map.clear();
}
@Override // java.util.AbstractCollection, java.util.Collection
public final boolean contains(Object obj) {
return this.map.containsValue(obj);
}
@Override // java.util.AbstractCollection, java.util.Collection
public final boolean isEmpty() {
return this.map.isEmpty();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public final Iterator<V> iterator() {
return Maps.valueIterator(this.map.entrySet().iterator());
}
@Override // java.util.AbstractCollection, java.util.Collection
public final boolean remove(Object obj) {
try {
return super.remove(obj);
} catch (UnsupportedOperationException unused) {
for (Map.Entry<K, V> entry : this.map.entrySet()) {
if (Joiner.equal(obj, entry.getValue())) {
this.map.remove(entry.getKey());
return true;
}
}
return false;
}
}
@Override // java.util.AbstractCollection, java.util.Collection
public final boolean removeAll(Collection<?> collection) {
try {
return super.removeAll((Collection) Joiner.checkNotNull(collection));
} catch (UnsupportedOperationException unused) {
HashSet hashSet = new HashSet();
for (Map.Entry<K, V> entry : this.map.entrySet()) {
if (collection.contains(entry.getValue())) {
hashSet.add(entry.getKey());
}
}
return this.map.keySet().removeAll(hashSet);
}
}
@Override // java.util.AbstractCollection, java.util.Collection
public final boolean retainAll(Collection<?> collection) {
try {
return super.retainAll((Collection) Joiner.checkNotNull(collection));
} catch (UnsupportedOperationException unused) {
HashSet hashSet = new HashSet();
for (Map.Entry<K, V> entry : this.map.entrySet()) {
if (collection.contains(entry.getValue())) {
hashSet.add(entry.getKey());
}
}
return this.map.keySet().retainAll(hashSet);
}
}
@Override // java.util.AbstractCollection, java.util.Collection
public final int size() {
return this.map.size();
}
}
static {
new Joiner.MapJoiner(Collections2.STANDARD_JOINER, "=", (byte) 0);
}
public static int capacity(int i) {
if (i >= 3) {
if (i < 1073741824) {
return i + (i / 3);
}
return Integer.MAX_VALUE;
}
if (i >= 0) {
return i + 1;
}
throw new IllegalArgumentException("expectedSize cannot be negative but was: " + i);
}
public static <K, V> Map.Entry<K, V> immutableEntry(K k, V v) {
return new ImmutableEntry(k, v);
}
static <K, V> Iterator<K> keyIterator(Iterator<Map.Entry<K, V>> it) {
return Iterators.transform(it, EntryFunction.KEY);
}
public static <K, V> HashMap<K, V> newHashMap() {
return new HashMap<>();
}
static boolean safeContainsKey(Map<?, ?> map, Object obj) {
Joiner.checkNotNull(map);
try {
return map.containsKey(obj);
} catch (ClassCastException | NullPointerException unused) {
return false;
}
}
static <V> V safeGet(Map<?, V> map, Object obj) {
Joiner.checkNotNull(map);
try {
return map.get(obj);
} catch (ClassCastException | NullPointerException unused) {
return null;
}
}
static <V> V safeRemove(Map<?, V> map, Object obj) {
Joiner.checkNotNull(map);
try {
return map.remove(obj);
} catch (ClassCastException | NullPointerException unused) {
return null;
}
}
static <K, V> Iterator<V> valueIterator(Iterator<Map.Entry<K, V>> it) {
return Iterators.transform(it, EntryFunction.VALUE);
}
}

View File

@@ -0,0 +1,23 @@
package com.squareup.haha.guava.collect;
import java.util.Collection;
import java.util.Map;
/* loaded from: classes.dex */
public interface Multimap<K, V> {
Map<K, Collection<V>> asMap();
void clear();
boolean containsEntry(Object obj, Object obj2);
Collection<V> get(K k);
boolean put(K k, V v);
boolean remove(Object obj, Object obj2);
int size();
Collection<V> values();
}

View File

@@ -0,0 +1,9 @@
package com.squareup.haha.guava.collect;
import java.util.Collection;
import java.util.Set;
/* loaded from: classes.dex */
public interface Multiset<E> extends Collection<E> {
Set<E> elementSet();
}

View File

@@ -0,0 +1,28 @@
package com.squareup.haha.guava.collect;
import java.lang.reflect.Array;
/* loaded from: classes.dex */
public final class ObjectArrays {
static final Object[] EMPTY_ARRAY = new Object[0];
static <T> T[] arraysCopyOf(T[] tArr, int i) {
T[] tArr2 = (T[]) newArray(tArr, i);
System.arraycopy(tArr, 0, tArr2, 0, Math.min(tArr.length, i));
return tArr2;
}
static Object[] checkElementsNotNull(Object... objArr) {
int length = objArr.length;
for (int i = 0; i < length; i++) {
if (objArr[i] == null) {
throw new NullPointerException("at index " + i);
}
}
return objArr;
}
public static <T> T[] newArray(T[] tArr, int i) {
return (T[]) ((Object[]) Array.newInstance(tArr.getClass().getComponentType(), i));
}
}

View File

@@ -0,0 +1,36 @@
package com.squareup.haha.guava.collect;
/* loaded from: classes.dex */
final class RegularImmutableAsList<E> extends ImmutableAsList<E> {
private final ImmutableCollection<E> delegate;
private final ImmutableList<? extends E> delegateList;
private RegularImmutableAsList(ImmutableCollection<E> immutableCollection, ImmutableList<? extends E> immutableList) {
this.delegate = immutableCollection;
this.delegateList = immutableList;
}
@Override // com.squareup.haha.guava.collect.ImmutableList, com.squareup.haha.guava.collect.ImmutableCollection
final int copyIntoArray(Object[] objArr, int i) {
return this.delegateList.copyIntoArray(objArr, i);
}
@Override // com.squareup.haha.guava.collect.ImmutableAsList
final ImmutableCollection<E> delegateCollection() {
return this.delegate;
}
@Override // java.util.List
public final E get(int i) {
return this.delegateList.get(i);
}
@Override // com.squareup.haha.guava.collect.ImmutableList, java.util.List
public final UnmodifiableListIterator<E> listIterator(int i) {
return this.delegateList.listIterator(i);
}
RegularImmutableAsList(ImmutableCollection<E> immutableCollection, Object[] objArr) {
this(immutableCollection, ImmutableList.asImmutableList(objArr));
}
}

View File

@@ -0,0 +1,78 @@
package com.squareup.haha.guava.collect;
import com.squareup.haha.guava.base.Joiner;
/* loaded from: classes.dex */
final class RegularImmutableList<E> extends ImmutableList<E> {
private final transient Object[] array;
private final transient int offset;
private final transient int size;
private RegularImmutableList(Object[] objArr, int i, int i2) {
this.offset = i;
this.size = i2;
this.array = objArr;
}
@Override // com.squareup.haha.guava.collect.ImmutableList, com.squareup.haha.guava.collect.ImmutableCollection
final int copyIntoArray(Object[] objArr, int i) {
System.arraycopy(this.array, this.offset, objArr, i, this.size);
return i + this.size;
}
@Override // java.util.List
public final E get(int i) {
Joiner.checkElementIndex(i, this.size);
return (E) this.array[i + this.offset];
}
@Override // com.squareup.haha.guava.collect.ImmutableList, java.util.List
public final int indexOf(Object obj) {
if (obj == null) {
return -1;
}
for (int i = 0; i < this.size; i++) {
if (this.array[this.offset + i].equals(obj)) {
return i;
}
}
return -1;
}
@Override // com.squareup.haha.guava.collect.ImmutableCollection
final boolean isPartialView() {
return this.size != this.array.length;
}
@Override // com.squareup.haha.guava.collect.ImmutableList, java.util.List
public final int lastIndexOf(Object obj) {
if (obj == null) {
return -1;
}
for (int i = this.size - 1; i >= 0; i--) {
if (this.array[this.offset + i].equals(obj)) {
return i;
}
}
return -1;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public final int size() {
return this.size;
}
@Override // com.squareup.haha.guava.collect.ImmutableList
final ImmutableList<E> subListUnchecked(int i, int i2) {
return new RegularImmutableList(this.array, this.offset + i, i2 - i);
}
@Override // com.squareup.haha.guava.collect.ImmutableList, java.util.List
public final UnmodifiableListIterator<E> listIterator(int i) {
return Iterators.forArray(this.array, this.offset, this.size, i);
}
RegularImmutableList(Object[] objArr) {
this(objArr, 0, objArr.length);
}
}

View File

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

View File

@@ -0,0 +1,21 @@
package com.squareup.haha.guava.collect;
import com.squareup.haha.guava.base.Joiner;
import java.util.AbstractSet;
import java.util.Collection;
/* loaded from: classes.dex */
abstract class Sets$ImprovedAbstractSet<E> extends AbstractSet<E> {
Sets$ImprovedAbstractSet() {
}
@Override // java.util.AbstractSet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean removeAll(Collection<?> collection) {
return Joiner.removeAllImpl(this, collection);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean retainAll(Collection<?> collection) {
return super.retainAll((Collection) Joiner.checkNotNull(collection));
}
}

View File

@@ -0,0 +1,106 @@
package com.squareup.haha.guava.collect;
import com.squareup.haha.guava.base.Joiner;
import java.util.Iterator;
import java.util.List;
/* loaded from: classes.dex */
final class SingletonImmutableList<E> extends ImmutableList<E> {
private transient E element;
SingletonImmutableList(E e) {
this.element = (E) Joiner.checkNotNull(e);
}
@Override // com.squareup.haha.guava.collect.ImmutableList, com.squareup.haha.guava.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.List
public final boolean contains(Object obj) {
return this.element.equals(obj);
}
@Override // com.squareup.haha.guava.collect.ImmutableList, com.squareup.haha.guava.collect.ImmutableCollection
final int copyIntoArray(Object[] objArr, int i) {
objArr[i] = this.element;
return i + 1;
}
@Override // com.squareup.haha.guava.collect.ImmutableList, java.util.Collection, java.util.List
public final boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof List) {
List list = (List) obj;
if (list.size() == 1 && this.element.equals(list.get(0))) {
return true;
}
}
return false;
}
@Override // java.util.List
public final E get(int i) {
Joiner.checkElementIndex(i, 1);
return this.element;
}
@Override // com.squareup.haha.guava.collect.ImmutableList, java.util.Collection, java.util.List
public final int hashCode() {
return this.element.hashCode() + 31;
}
@Override // com.squareup.haha.guava.collect.ImmutableList, java.util.List
public final int indexOf(Object obj) {
return this.element.equals(obj) ? 0 : -1;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public final boolean isEmpty() {
return false;
}
@Override // com.squareup.haha.guava.collect.ImmutableCollection
final boolean isPartialView() {
return false;
}
@Override // com.squareup.haha.guava.collect.ImmutableList, com.squareup.haha.guava.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public final UnmodifiableIterator<E> iterator() {
return Iterators.singletonIterator(this.element);
}
@Override // com.squareup.haha.guava.collect.ImmutableList, java.util.List
public final int lastIndexOf(Object obj) {
return indexOf(obj);
}
@Override // com.squareup.haha.guava.collect.ImmutableList
public final ImmutableList<E> reverse() {
return this;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public final int size() {
return 1;
}
@Override // java.util.AbstractCollection
public final String toString() {
String obj = this.element.toString();
StringBuilder sb = new StringBuilder(obj.length() + 2);
sb.append('[');
sb.append(obj);
sb.append(']');
return sb.toString();
}
@Override // com.squareup.haha.guava.collect.ImmutableList, com.squareup.haha.guava.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
public final /* bridge */ /* synthetic */ Iterator iterator() {
return Iterators.singletonIterator(this.element);
}
@Override // com.squareup.haha.guava.collect.ImmutableList, java.util.List
public final ImmutableList<E> subList(int i, int i2) {
Joiner.checkPositionIndexes(i, i2, 1);
return i == i2 ? (ImmutableList<E>) ImmutableList.EMPTY : this;
}
}

View File

@@ -0,0 +1,30 @@
package com.squareup.haha.guava.collect;
import com.squareup.haha.guava.base.Joiner;
import java.util.Iterator;
/* loaded from: classes.dex */
abstract class TransformedIterator<F, T> implements Iterator<T> {
private Iterator<? extends F> backingIterator;
TransformedIterator(Iterator<? extends F> it) {
this.backingIterator = (Iterator) Joiner.checkNotNull(it);
}
@Override // java.util.Iterator
public final boolean hasNext() {
return this.backingIterator.hasNext();
}
@Override // java.util.Iterator
public final T next() {
return transform(this.backingIterator.next());
}
@Override // java.util.Iterator
public final void remove() {
this.backingIterator.remove();
}
abstract T transform(F f);
}

View File

@@ -0,0 +1,15 @@
package com.squareup.haha.guava.collect;
import java.util.Iterator;
/* loaded from: classes.dex */
public abstract class UnmodifiableIterator<E> implements Iterator<E> {
protected UnmodifiableIterator() {
}
@Override // java.util.Iterator
@Deprecated
public final void remove() {
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,21 @@
package com.squareup.haha.guava.collect;
import java.util.ListIterator;
/* loaded from: classes.dex */
public abstract class UnmodifiableListIterator<E> extends UnmodifiableIterator<E> implements ListIterator<E> {
protected UnmodifiableListIterator() {
}
@Override // java.util.ListIterator
@Deprecated
public final void add(E e) {
throw new UnsupportedOperationException();
}
@Override // java.util.ListIterator
@Deprecated
public final void set(E e) {
throw new UnsupportedOperationException();
}
}