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