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