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

1049 lines
40 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.google.common.collect;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.base.Supplier;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.collect.Table;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializable {
private static final long serialVersionUID = 0;
@GwtTransient
final Map<R, Map<C, V>> backingMap;
private transient Set<C> columnKeySet;
private transient StandardTable<R, C, V>.ColumnMap columnMap;
@GwtTransient
final Supplier<? extends Map<C, V>> factory;
private transient Map<R, Map<C, V>> rowMap;
/* JADX INFO: Access modifiers changed from: package-private */
public StandardTable(Map<R, Map<C, V>> map, Supplier<? extends Map<C, V>> supplier) {
this.backingMap = map;
this.factory = supplier;
}
@Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table
public boolean contains(Object obj, Object obj2) {
return (obj == null || obj2 == null || !super.contains(obj, obj2)) ? false : true;
}
@Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table
public boolean containsColumn(Object obj) {
if (obj == null) {
return false;
}
Iterator<Map<C, V>> it = this.backingMap.values().iterator();
while (it.hasNext()) {
if (Maps.safeContainsKey(it.next(), obj)) {
return true;
}
}
return false;
}
@Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table
public boolean containsRow(Object obj) {
return obj != null && Maps.safeContainsKey(this.backingMap, obj);
}
@Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table
public boolean containsValue(Object obj) {
return obj != null && super.containsValue(obj);
}
@Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table
public V get(Object obj, Object obj2) {
if (obj == null || obj2 == null) {
return null;
}
return (V) super.get(obj, obj2);
}
@Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table
public boolean isEmpty() {
return this.backingMap.isEmpty();
}
@Override // com.google.common.collect.Table
public int size() {
Iterator<Map<C, V>> it = this.backingMap.values().iterator();
int i = 0;
while (it.hasNext()) {
i += it.next().size();
}
return i;
}
@Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table
public void clear() {
this.backingMap.clear();
}
private Map<C, V> getOrCreate(R r) {
Map<C, V> map = this.backingMap.get(r);
if (map != null) {
return map;
}
Map<C, V> map2 = this.factory.get();
this.backingMap.put(r, map2);
return map2;
}
@Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table
public V put(R r, C c, V v) {
Preconditions.checkNotNull(r);
Preconditions.checkNotNull(c);
Preconditions.checkNotNull(v);
return getOrCreate(r).put(c, v);
}
@Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table
public V remove(Object obj, Object obj2) {
Map map;
if (obj == null || obj2 == null || (map = (Map) Maps.safeGet(this.backingMap, obj)) == null) {
return null;
}
V v = (V) map.remove(obj2);
if (map.isEmpty()) {
this.backingMap.remove(obj);
}
return v;
}
/* JADX INFO: Access modifiers changed from: private */
public Map<R, V> removeColumn(Object obj) {
LinkedHashMap linkedHashMap = new LinkedHashMap();
Iterator<Map.Entry<R, Map<C, V>>> it = this.backingMap.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<R, Map<C, V>> next = it.next();
V remove = next.getValue().remove(obj);
if (remove != null) {
linkedHashMap.put(next.getKey(), remove);
if (next.getValue().isEmpty()) {
it.remove();
}
}
}
return linkedHashMap;
}
/* JADX INFO: Access modifiers changed from: private */
public boolean containsMapping(Object obj, Object obj2, Object obj3) {
return obj3 != null && obj3.equals(get(obj, obj2));
}
/* JADX INFO: Access modifiers changed from: private */
public boolean removeMapping(Object obj, Object obj2, Object obj3) {
if (!containsMapping(obj, obj2, obj3)) {
return false;
}
remove(obj, obj2);
return true;
}
/* loaded from: classes2.dex */
abstract class TableSet<T> extends Sets.ImprovedAbstractSet<T> {
final StandardTable this$0;
private TableSet(StandardTable standardTable) {
this.this$0 = standardTable;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean isEmpty() {
return this.this$0.backingMap.isEmpty();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
this.this$0.backingMap.clear();
}
}
@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
Iterator<Table.Cell<R, C, V>> cellIterator() {
return new CellIterator();
}
/* loaded from: classes2.dex */
class CellIterator implements Iterator<Table.Cell<R, C, V>> {
Iterator<Map.Entry<C, V>> columnIterator;
Map.Entry<R, Map<C, V>> rowEntry;
final Iterator<Map.Entry<R, Map<C, V>>> rowIterator;
final StandardTable this$0;
private CellIterator(StandardTable standardTable) {
this.this$0 = standardTable;
this.rowIterator = standardTable.backingMap.entrySet().iterator();
this.columnIterator = Iterators.emptyModifiableIterator();
}
@Override // java.util.Iterator
public boolean hasNext() {
return this.rowIterator.hasNext() || this.columnIterator.hasNext();
}
@Override // java.util.Iterator
public Table.Cell<R, C, V> next() {
if (!this.columnIterator.hasNext()) {
Map.Entry<R, Map<C, V>> next = this.rowIterator.next();
this.rowEntry = next;
this.columnIterator = next.getValue().entrySet().iterator();
}
Map.Entry<C, V> next2 = this.columnIterator.next();
return Tables.immutableCell(this.rowEntry.getKey(), next2.getKey(), next2.getValue());
}
@Override // java.util.Iterator
public void remove() {
this.columnIterator.remove();
if (this.rowEntry.getValue().isEmpty()) {
this.rowIterator.remove();
this.rowEntry = null;
}
}
}
@Override // com.google.common.collect.Table
public Map<C, V> row(R r) {
return new Row(this, r);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class Row extends Maps.IteratorBasedAbstractMap<C, V> {
Map<C, V> backingRowMap;
final R rowKey;
final StandardTable this$0;
/* JADX INFO: Access modifiers changed from: package-private */
public Row(StandardTable standardTable, R r) {
this.this$0 = standardTable;
this.rowKey = (R) Preconditions.checkNotNull(r);
}
/* JADX INFO: Access modifiers changed from: package-private */
public Map<C, V> backingRowMap() {
Map<C, V> map = this.backingRowMap;
if (map != null && (!map.isEmpty() || !this.this$0.backingMap.containsKey(this.rowKey))) {
return this.backingRowMap;
}
Map<C, V> computeBackingRowMap = computeBackingRowMap();
this.backingRowMap = computeBackingRowMap;
return computeBackingRowMap;
}
Map<C, V> computeBackingRowMap() {
return this.this$0.backingMap.get(this.rowKey);
}
void maintainEmptyInvariant() {
if (backingRowMap() == null || !this.backingRowMap.isEmpty()) {
return;
}
this.this$0.backingMap.remove(this.rowKey);
this.backingRowMap = null;
}
@Override // java.util.AbstractMap, java.util.Map
public boolean containsKey(Object obj) {
Map<C, V> backingRowMap = backingRowMap();
return (obj == null || backingRowMap == null || !Maps.safeContainsKey(backingRowMap, obj)) ? false : true;
}
@Override // java.util.AbstractMap, java.util.Map
public V get(Object obj) {
Map<C, V> backingRowMap = backingRowMap();
if (obj == null || backingRowMap == null) {
return null;
}
return (V) Maps.safeGet(backingRowMap, obj);
}
@Override // java.util.AbstractMap, java.util.Map
public V put(C c, V v) {
Preconditions.checkNotNull(c);
Preconditions.checkNotNull(v);
Map<C, V> map = this.backingRowMap;
if (map != null && !map.isEmpty()) {
return this.backingRowMap.put(c, v);
}
return (V) this.this$0.put(this.rowKey, c, v);
}
@Override // java.util.AbstractMap, java.util.Map
public V remove(Object obj) {
Map<C, V> backingRowMap = backingRowMap();
if (backingRowMap == null) {
return null;
}
V v = (V) Maps.safeRemove(backingRowMap, obj);
maintainEmptyInvariant();
return v;
}
@Override // com.google.common.collect.Maps.IteratorBasedAbstractMap, java.util.AbstractMap, java.util.Map
public void clear() {
Map<C, V> backingRowMap = backingRowMap();
if (backingRowMap != null) {
backingRowMap.clear();
}
maintainEmptyInvariant();
}
@Override // com.google.common.collect.Maps.IteratorBasedAbstractMap, java.util.AbstractMap, java.util.Map
public int size() {
Map<C, V> backingRowMap = backingRowMap();
if (backingRowMap == null) {
return 0;
}
return backingRowMap.size();
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.Maps.IteratorBasedAbstractMap
public Iterator<Map.Entry<C, V>> entryIterator() {
Map<C, V> backingRowMap = backingRowMap();
if (backingRowMap == null) {
return Iterators.emptyModifiableIterator();
}
return new Iterator<Map.Entry<C, V>>(this, backingRowMap.entrySet().iterator()) { // from class: com.google.common.collect.StandardTable.Row.1
final Row this$1;
final Iterator val$iterator;
{
this.this$1 = this;
this.val$iterator = r2;
}
@Override // java.util.Iterator
public boolean hasNext() {
return this.val$iterator.hasNext();
}
@Override // java.util.Iterator
public Map.Entry<C, V> next() {
return this.this$1.wrapEntry((Map.Entry) this.val$iterator.next());
}
@Override // java.util.Iterator
public void remove() {
this.val$iterator.remove();
this.this$1.maintainEmptyInvariant();
}
};
}
Map.Entry<C, V> wrapEntry(Map.Entry<C, V> entry) {
return new ForwardingMapEntry<C, V>(this, entry) { // from class: com.google.common.collect.StandardTable.Row.2
final Map.Entry val$entry;
{
this.val$entry = entry;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.ForwardingMapEntry, java.util.Map.Entry
public V setValue(V v) {
return (V) super.setValue(Preconditions.checkNotNull(v));
}
@Override // com.google.common.collect.ForwardingMapEntry, java.util.Map.Entry
public boolean equals(Object obj) {
return standardEquals(obj);
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.ForwardingMapEntry, com.google.common.collect.ForwardingObject
public Map.Entry<C, V> delegate() {
return this.val$entry;
}
};
}
}
@Override // com.google.common.collect.Table
public Map<R, V> column(C c) {
return new Column(this, c);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class Column extends Maps.ViewCachingAbstractMap<R, V> {
final C columnKey;
final StandardTable this$0;
Column(StandardTable standardTable, C c) {
this.this$0 = standardTable;
this.columnKey = (C) Preconditions.checkNotNull(c);
}
@Override // java.util.AbstractMap, java.util.Map
public V put(R r, V v) {
return (V) this.this$0.put(r, this.columnKey, v);
}
@Override // java.util.AbstractMap, java.util.Map
public V get(Object obj) {
return (V) this.this$0.get(obj, this.columnKey);
}
@Override // java.util.AbstractMap, java.util.Map
public boolean containsKey(Object obj) {
return this.this$0.contains(obj, this.columnKey);
}
@Override // java.util.AbstractMap, java.util.Map
public V remove(Object obj) {
return (V) this.this$0.remove(obj, this.columnKey);
}
boolean removeFromColumnIf(Predicate<? super Map.Entry<R, V>> predicate) {
Iterator<Map.Entry<R, Map<C, V>>> it = this.this$0.backingMap.entrySet().iterator();
boolean z = false;
while (it.hasNext()) {
Map.Entry<R, Map<C, V>> next = it.next();
Map<C, V> value = next.getValue();
V v = value.get(this.columnKey);
if (v != null && predicate.apply(Maps.immutableEntry(next.getKey(), v))) {
value.remove(this.columnKey);
if (value.isEmpty()) {
it.remove();
}
z = true;
}
}
return z;
}
@Override // com.google.common.collect.Maps.ViewCachingAbstractMap
Set<Map.Entry<R, V>> createEntrySet() {
return new EntrySet();
}
/* loaded from: classes2.dex */
class EntrySet extends Sets.ImprovedAbstractSet<Map.Entry<R, V>> {
final Column this$1;
private EntrySet(Column column) {
this.this$1 = column;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<Map.Entry<R, V>> iterator() {
return new EntrySetIterator();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
Iterator<Map<C, V>> it = this.this$1.this$0.backingMap.values().iterator();
int i = 0;
while (it.hasNext()) {
if (it.next().containsKey(this.this$1.columnKey)) {
i++;
}
}
return i;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean isEmpty() {
return !this.this$1.this$0.containsColumn(this.this$1.columnKey);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
this.this$1.removeFromColumnIf(Predicates.alwaysTrue());
}
@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;
return this.this$1.this$0.containsMapping(entry.getKey(), this.this$1.columnKey, entry.getValue());
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
return this.this$1.this$0.removeMapping(entry.getKey(), this.this$1.columnKey, entry.getValue());
}
@Override // com.google.common.collect.Sets.ImprovedAbstractSet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean retainAll(Collection<?> collection) {
return this.this$1.removeFromColumnIf(Predicates.not(Predicates.in(collection)));
}
}
/* loaded from: classes2.dex */
class EntrySetIterator extends AbstractIterator<Map.Entry<R, V>> {
final Iterator<Map.Entry<R, Map<C, V>>> iterator;
final Column this$1;
private EntrySetIterator(Column column) {
this.this$1 = column;
this.iterator = column.this$0.backingMap.entrySet().iterator();
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.common.collect.AbstractIterator
public Map.Entry<R, V> computeNext() {
while (this.iterator.hasNext()) {
Map.Entry<R, Map<C, V>> next = this.iterator.next();
if (next.getValue().containsKey(this.this$1.columnKey)) {
return new AbstractMapEntry<R, V>(this, next) { // from class: com.google.common.collect.StandardTable.Column.EntrySetIterator.1EntryImpl
final EntrySetIterator this$2;
final Map.Entry val$entry;
{
this.this$2 = this;
this.val$entry = next;
}
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public R getKey() {
return (R) this.val$entry.getKey();
}
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public V getValue() {
return (V) ((Map) this.val$entry.getValue()).get(this.this$2.this$1.columnKey);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
public V setValue(V v) {
return (V) ((Map) this.val$entry.getValue()).put(this.this$2.this$1.columnKey, Preconditions.checkNotNull(v));
}
};
}
}
return endOfData();
}
}
@Override // com.google.common.collect.Maps.ViewCachingAbstractMap
Set<R> createKeySet() {
return new KeySet(this);
}
/* loaded from: classes2.dex */
class KeySet extends Maps.KeySet<R, V> {
final Column this$1;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
KeySet(Column column) {
super(column);
this.this$1 = column;
}
@Override // com.google.common.collect.Maps.KeySet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return this.this$1.this$0.contains(obj, this.this$1.columnKey);
}
@Override // com.google.common.collect.Maps.KeySet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
return this.this$1.this$0.remove(obj, this.this$1.columnKey) != null;
}
@Override // com.google.common.collect.Sets.ImprovedAbstractSet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean retainAll(Collection<?> collection) {
return this.this$1.removeFromColumnIf(Maps.keyPredicateOnEntries(Predicates.not(Predicates.in(collection))));
}
}
@Override // com.google.common.collect.Maps.ViewCachingAbstractMap
Collection<V> createValues() {
return new Values(this);
}
/* loaded from: classes2.dex */
class Values extends Maps.Values<R, V> {
final Column this$1;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
Values(Column column) {
super(column);
this.this$1 = column;
}
@Override // com.google.common.collect.Maps.Values, java.util.AbstractCollection, java.util.Collection
public boolean remove(Object obj) {
return obj != null && this.this$1.removeFromColumnIf(Maps.valuePredicateOnEntries(Predicates.equalTo(obj)));
}
@Override // com.google.common.collect.Maps.Values, java.util.AbstractCollection, java.util.Collection
public boolean removeAll(Collection<?> collection) {
return this.this$1.removeFromColumnIf(Maps.valuePredicateOnEntries(Predicates.in(collection)));
}
@Override // com.google.common.collect.Maps.Values, java.util.AbstractCollection, java.util.Collection
public boolean retainAll(Collection<?> collection) {
return this.this$1.removeFromColumnIf(Maps.valuePredicateOnEntries(Predicates.not(Predicates.in(collection))));
}
}
}
@Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table
public Set<R> rowKeySet() {
return rowMap().keySet();
}
@Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table
public Set<C> columnKeySet() {
Set<C> set = this.columnKeySet;
if (set != null) {
return set;
}
ColumnKeySet columnKeySet = new ColumnKeySet();
this.columnKeySet = columnKeySet;
return columnKeySet;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class ColumnKeySet extends TableSet {
final StandardTable this$0;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
private ColumnKeySet(StandardTable standardTable) {
super();
this.this$0 = standardTable;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<C> iterator() {
return this.this$0.createColumnKeyIterator();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return Iterators.size(iterator());
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
boolean z = false;
if (obj == null) {
return false;
}
Iterator<Map<C, V>> it = this.this$0.backingMap.values().iterator();
while (it.hasNext()) {
Map<C, V> next = it.next();
if (next.keySet().remove(obj)) {
if (next.isEmpty()) {
it.remove();
}
z = true;
}
}
return z;
}
@Override // com.google.common.collect.Sets.ImprovedAbstractSet, java.util.AbstractSet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean removeAll(Collection<?> collection) {
Preconditions.checkNotNull(collection);
Iterator<Map<C, V>> it = this.this$0.backingMap.values().iterator();
boolean z = false;
while (it.hasNext()) {
Map<C, V> next = it.next();
if (Iterators.removeAll(next.keySet().iterator(), collection)) {
if (next.isEmpty()) {
it.remove();
}
z = true;
}
}
return z;
}
@Override // com.google.common.collect.Sets.ImprovedAbstractSet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean retainAll(Collection<?> collection) {
Preconditions.checkNotNull(collection);
Iterator<Map<C, V>> it = this.this$0.backingMap.values().iterator();
boolean z = false;
while (it.hasNext()) {
Map<C, V> next = it.next();
if (next.keySet().retainAll(collection)) {
if (next.isEmpty()) {
it.remove();
}
z = true;
}
}
return z;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return this.this$0.containsColumn(obj);
}
}
Iterator<C> createColumnKeyIterator() {
return new ColumnKeyIterator();
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class ColumnKeyIterator extends AbstractIterator<C> {
Iterator<Map.Entry<C, V>> entryIterator;
final Iterator<Map<C, V>> mapIterator;
final Map<C, V> seen;
final StandardTable this$0;
private ColumnKeyIterator(StandardTable standardTable) {
this.this$0 = standardTable;
this.seen = standardTable.factory.get();
this.mapIterator = standardTable.backingMap.values().iterator();
this.entryIterator = Iterators.emptyIterator();
}
@Override // com.google.common.collect.AbstractIterator
protected C computeNext() {
while (true) {
if (this.entryIterator.hasNext()) {
Map.Entry<C, V> next = this.entryIterator.next();
if (!this.seen.containsKey(next.getKey())) {
this.seen.put(next.getKey(), next.getValue());
return next.getKey();
}
} else if (this.mapIterator.hasNext()) {
this.entryIterator = this.mapIterator.next().entrySet().iterator();
} else {
return endOfData();
}
}
}
}
@Override // com.google.common.collect.AbstractTable, com.google.common.collect.Table
public Collection<V> values() {
return super.values();
}
@Override // com.google.common.collect.Table
public Map<R, Map<C, V>> rowMap() {
Map<R, Map<C, V>> map = this.rowMap;
if (map != null) {
return map;
}
Map<R, Map<C, V>> createRowMap = createRowMap();
this.rowMap = createRowMap;
return createRowMap;
}
Map<R, Map<C, V>> createRowMap() {
return new RowMap(this);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class RowMap extends Maps.ViewCachingAbstractMap<R, Map<C, V>> {
final StandardTable this$0;
/* JADX INFO: Access modifiers changed from: package-private */
public RowMap(StandardTable standardTable) {
this.this$0 = standardTable;
}
@Override // java.util.AbstractMap, java.util.Map
public boolean containsKey(Object obj) {
return this.this$0.containsRow(obj);
}
@Override // java.util.AbstractMap, java.util.Map
public Map<C, V> get(Object obj) {
if (this.this$0.containsRow(obj)) {
return this.this$0.row(obj);
}
return null;
}
@Override // java.util.AbstractMap, java.util.Map
public Map<C, V> remove(Object obj) {
if (obj == null) {
return null;
}
return this.this$0.backingMap.remove(obj);
}
@Override // com.google.common.collect.Maps.ViewCachingAbstractMap
protected Set<Map.Entry<R, Map<C, V>>> createEntrySet() {
return new EntrySet(this);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class EntrySet extends TableSet {
final RowMap this$1;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
EntrySet(RowMap rowMap) {
super();
this.this$1 = rowMap;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<Map.Entry<R, Map<C, V>>> iterator() {
return Maps.asMapEntryIterator(this.this$1.this$0.backingMap.keySet(), new Function<R, Map<C, V>>(this) { // from class: com.google.common.collect.StandardTable.RowMap.EntrySet.1
final EntrySet this$2;
{
this.this$2 = this;
}
@Override // com.google.common.base.Function
public /* bridge */ /* synthetic */ Object apply(Object obj) {
return apply((AnonymousClass1) obj);
}
@Override // com.google.common.base.Function
public Map<C, V> apply(R r) {
return this.this$2.this$1.this$0.row(r);
}
});
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return this.this$1.this$0.backingMap.size();
}
@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;
return entry.getKey() != null && (entry.getValue() instanceof Map) && Collections2.safeContains(this.this$1.this$0.backingMap.entrySet(), entry);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
return entry.getKey() != null && (entry.getValue() instanceof Map) && this.this$1.this$0.backingMap.entrySet().remove(entry);
}
}
}
@Override // com.google.common.collect.Table
public Map<C, Map<R, V>> columnMap() {
StandardTable<R, C, V>.ColumnMap columnMap = this.columnMap;
if (columnMap != null) {
return columnMap;
}
StandardTable<R, C, V>.ColumnMap columnMap2 = new ColumnMap();
this.columnMap = columnMap2;
return columnMap2;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class ColumnMap extends Maps.ViewCachingAbstractMap<C, Map<R, V>> {
final StandardTable this$0;
private ColumnMap(StandardTable standardTable) {
this.this$0 = standardTable;
}
@Override // java.util.AbstractMap, java.util.Map
public Map<R, V> get(Object obj) {
if (this.this$0.containsColumn(obj)) {
return this.this$0.column(obj);
}
return null;
}
@Override // java.util.AbstractMap, java.util.Map
public boolean containsKey(Object obj) {
return this.this$0.containsColumn(obj);
}
@Override // java.util.AbstractMap, java.util.Map
public Map<R, V> remove(Object obj) {
if (this.this$0.containsColumn(obj)) {
return this.this$0.removeColumn(obj);
}
return null;
}
@Override // com.google.common.collect.Maps.ViewCachingAbstractMap
public Set<Map.Entry<C, Map<R, V>>> createEntrySet() {
return new ColumnMapEntrySet(this);
}
@Override // com.google.common.collect.Maps.ViewCachingAbstractMap, java.util.AbstractMap, java.util.Map
public Set<C> keySet() {
return this.this$0.columnKeySet();
}
@Override // com.google.common.collect.Maps.ViewCachingAbstractMap
Collection<Map<R, V>> createValues() {
return new ColumnMapValues(this);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class ColumnMapEntrySet extends TableSet {
final ColumnMap this$1;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
ColumnMapEntrySet(ColumnMap columnMap) {
super();
this.this$1 = columnMap;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<Map.Entry<C, Map<R, V>>> iterator() {
return Maps.asMapEntryIterator(this.this$1.this$0.columnKeySet(), new Function<C, Map<R, V>>(this) { // from class: com.google.common.collect.StandardTable.ColumnMap.ColumnMapEntrySet.1
final ColumnMapEntrySet this$2;
{
this.this$2 = this;
}
@Override // com.google.common.base.Function
public /* bridge */ /* synthetic */ Object apply(Object obj) {
return apply((AnonymousClass1) obj);
}
@Override // com.google.common.base.Function
public Map<R, V> apply(C c) {
return this.this$2.this$1.this$0.column(c);
}
});
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return this.this$1.this$0.columnKeySet().size();
}
@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;
if (!this.this$1.this$0.containsColumn(entry.getKey())) {
return false;
}
return this.this$1.get(entry.getKey()).equals(entry.getValue());
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
if (!contains(obj)) {
return false;
}
this.this$1.this$0.removeColumn(((Map.Entry) obj).getKey());
return true;
}
@Override // com.google.common.collect.Sets.ImprovedAbstractSet, java.util.AbstractSet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean removeAll(Collection<?> collection) {
Preconditions.checkNotNull(collection);
return Sets.removeAllImpl(this, collection.iterator());
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.Sets.ImprovedAbstractSet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean retainAll(Collection<?> collection) {
Preconditions.checkNotNull(collection);
Iterator it = Lists.newArrayList(this.this$1.this$0.columnKeySet().iterator()).iterator();
boolean z = false;
while (it.hasNext()) {
Object next = it.next();
if (!collection.contains(Maps.immutableEntry(next, this.this$1.this$0.column(next)))) {
this.this$1.this$0.removeColumn(next);
z = true;
}
}
return z;
}
}
/* loaded from: classes2.dex */
class ColumnMapValues extends Maps.Values<C, Map<R, V>> {
final ColumnMap this$1;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
ColumnMapValues(ColumnMap columnMap) {
super(columnMap);
this.this$1 = columnMap;
}
@Override // com.google.common.collect.Maps.Values, java.util.AbstractCollection, java.util.Collection
public boolean remove(Object obj) {
for (Map.Entry<C, Map<R, V>> entry : this.this$1.entrySet()) {
if (entry.getValue().equals(obj)) {
this.this$1.this$0.removeColumn(entry.getKey());
return true;
}
}
return false;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.Maps.Values, java.util.AbstractCollection, java.util.Collection
public boolean removeAll(Collection<?> collection) {
Preconditions.checkNotNull(collection);
Iterator it = Lists.newArrayList(this.this$1.this$0.columnKeySet().iterator()).iterator();
boolean z = false;
while (it.hasNext()) {
Object next = it.next();
if (collection.contains(this.this$1.this$0.column(next))) {
this.this$1.this$0.removeColumn(next);
z = true;
}
}
return z;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.Maps.Values, java.util.AbstractCollection, java.util.Collection
public boolean retainAll(Collection<?> collection) {
Preconditions.checkNotNull(collection);
Iterator it = Lists.newArrayList(this.this$1.this$0.columnKeySet().iterator()).iterator();
boolean z = false;
while (it.hasNext()) {
Object next = it.next();
if (!collection.contains(this.this$1.this$0.column(next))) {
this.this$1.this$0.removeColumn(next);
z = true;
}
}
return z;
}
}
}
}