Rabbit-R1/switch port/java/sources/com/google/common/collect/TreeMultimap.java
2024-05-21 17:08:36 -04:00

218 lines
11 KiB
Java

package com.google.common.collect;
import com.google.common.base.Preconditions;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Collection;
import java.util.Comparator;
import java.util.Map;
import java.util.NavigableMap;
import java.util.NavigableSet;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
import javax.annotation.CheckForNull;
@ElementTypesAreNonnullByDefault
/* loaded from: classes3.dex */
public class TreeMultimap<K, V> extends AbstractSortedKeySortedSetMultimap<K, V> {
private static final long serialVersionUID = 0;
private transient Comparator<? super K> keyComparator;
private transient Comparator<? super V> valueComparator;
@Deprecated
public Comparator<? super K> keyComparator() {
return this.keyComparator;
}
@Override // com.google.common.collect.SortedSetMultimap
public Comparator<? super V> valueComparator() {
return this.valueComparator;
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ void clear() {
super.clear();
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean containsEntry(@CheckForNull Object obj, @CheckForNull Object obj2) {
return super.containsEntry(obj, obj2);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean containsKey(@CheckForNull Object obj) {
return super.containsKey(obj);
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean containsValue(@CheckForNull Object obj) {
return super.containsValue(obj);
}
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Set entries() {
return super.entries();
}
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap, com.google.common.collect.ListMultimap
public /* bridge */ /* synthetic */ boolean equals(@CheckForNull Object obj) {
return super.equals(obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractSortedSetMultimap, com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap, com.google.common.collect.ListMultimap
public /* bridge */ /* synthetic */ Collection get(@ParametricNullness Object obj) {
return get((TreeMultimap<K, V>) obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractSortedSetMultimap, com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap, com.google.common.collect.ListMultimap
public /* bridge */ /* synthetic */ Set get(@ParametricNullness Object obj) {
return get((TreeMultimap<K, V>) obj);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractSortedSetMultimap, com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap, com.google.common.collect.ListMultimap
public /* bridge */ /* synthetic */ SortedSet get(@ParametricNullness Object obj) {
return get((TreeMultimap<K, V>) obj);
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ int hashCode() {
return super.hashCode();
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean isEmpty() {
return super.isEmpty();
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Multiset keys() {
return super.keys();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean put(@ParametricNullness Object obj, @ParametricNullness Object obj2) {
return super.put(obj, obj2);
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean putAll(Multimap multimap) {
return super.putAll(multimap);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean putAll(@ParametricNullness Object obj, Iterable iterable) {
return super.putAll(obj, iterable);
}
@Override // com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ boolean remove(@CheckForNull Object obj, @CheckForNull Object obj2) {
return super.remove(obj, obj2);
}
@Override // com.google.common.collect.AbstractSortedSetMultimap, com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap, com.google.common.collect.ListMultimap
public /* bridge */ /* synthetic */ SortedSet removeAll(@CheckForNull Object obj) {
return super.removeAll(obj);
}
@Override // com.google.common.collect.AbstractSortedSetMultimap, com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap, com.google.common.collect.ListMultimap
public /* bridge */ /* synthetic */ SortedSet replaceValues(@ParametricNullness Object obj, Iterable iterable) {
return super.replaceValues(obj, iterable);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ int size() {
return super.size();
}
@Override // com.google.common.collect.AbstractMultimap
public /* bridge */ /* synthetic */ String toString() {
return super.toString();
}
@Override // com.google.common.collect.AbstractSortedSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public /* bridge */ /* synthetic */ Collection values() {
return super.values();
}
public static <K extends Comparable, V extends Comparable> TreeMultimap<K, V> create() {
return new TreeMultimap<>(Ordering.natural(), Ordering.natural());
}
public static <K, V> TreeMultimap<K, V> create(Comparator<? super K> comparator, Comparator<? super V> comparator2) {
return new TreeMultimap<>((Comparator) Preconditions.checkNotNull(comparator), (Comparator) Preconditions.checkNotNull(comparator2));
}
public static <K extends Comparable, V extends Comparable> TreeMultimap<K, V> create(Multimap<? extends K, ? extends V> multimap) {
return new TreeMultimap<>(Ordering.natural(), Ordering.natural(), multimap);
}
TreeMultimap(Comparator<? super K> comparator, Comparator<? super V> comparator2) {
super(new TreeMap(comparator));
this.keyComparator = comparator;
this.valueComparator = comparator2;
}
private TreeMultimap(Comparator<? super K> comparator, Comparator<? super V> comparator2, Multimap<? extends K, ? extends V> multimap) {
this(comparator, comparator2);
putAll(multimap);
}
@Override // com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.AbstractMultimap
Map<K, Collection<V>> createAsMap() {
return createMaybeNavigableAsMap();
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.common.collect.AbstractSortedSetMultimap, com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap
public SortedSet<V> createCollection() {
return new TreeSet(this.valueComparator);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* JADX WARN: Multi-variable type inference failed */
@Override // com.google.common.collect.AbstractMapBasedMultimap
public Collection<V> createCollection(@ParametricNullness K k) {
if (k == 0) {
keyComparator().compare(k, k);
}
return super.createCollection(k);
}
@Override // com.google.common.collect.AbstractSortedSetMultimap, com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMapBasedMultimap, com.google.common.collect.Multimap, com.google.common.collect.ListMultimap
public NavigableSet<V> get(@ParametricNullness K k) {
return (NavigableSet) super.get((Object) k);
}
@Override // com.google.common.collect.AbstractSortedKeySortedSetMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap
public NavigableSet<K> keySet() {
return (NavigableSet) super.keySet();
}
@Override // com.google.common.collect.AbstractSortedKeySortedSetMultimap, com.google.common.collect.AbstractSortedSetMultimap, com.google.common.collect.AbstractSetMultimap, com.google.common.collect.AbstractMultimap, com.google.common.collect.Multimap, com.google.common.collect.ListMultimap
public NavigableMap<K, Collection<V>> asMap() {
return (NavigableMap) super.asMap();
}
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
objectOutputStream.defaultWriteObject();
objectOutputStream.writeObject(keyComparator());
objectOutputStream.writeObject(valueComparator());
Serialization.writeMultimap(this, objectOutputStream);
}
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
objectInputStream.defaultReadObject();
this.keyComparator = (Comparator) Preconditions.checkNotNull((Comparator) objectInputStream.readObject());
this.valueComparator = (Comparator) Preconditions.checkNotNull((Comparator) objectInputStream.readObject());
setMap(new TreeMap(this.keyComparator));
Serialization.populateMultimap(this, objectInputStream);
}
}