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; import javax.annotation.CheckForNull; @ElementTypesAreNonnullByDefault /* loaded from: classes3.dex */ abstract class DescendingMultiset extends ForwardingMultiset implements SortedMultiset { @CheckForNull private transient Comparator comparator; @CheckForNull private transient NavigableSet elementSet; @CheckForNull 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 @CheckForNull public Multiset.Entry pollFirstEntry() { return forwardMultiset().pollLastEntry(); } @Override // com.google.common.collect.SortedMultiset @CheckForNull public Multiset.Entry pollLastEntry() { return forwardMultiset().pollFirstEntry(); } @Override // com.google.common.collect.SortedMultiset public SortedMultiset headMultiset(@ParametricNullness E e, BoundType boundType) { return forwardMultiset().tailMultiset(e, boundType).descendingMultiset(); } @Override // com.google.common.collect.SortedMultiset public SortedMultiset subMultiset(@ParametricNullness E e, BoundType boundType, @ParametricNullness E e2, BoundType boundType2) { return forwardMultiset().subMultiset(e2, boundType2, e, boundType).descendingMultiset(); } @Override // com.google.common.collect.SortedMultiset public SortedMultiset tailMultiset(@ParametricNullness 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 @CheckForNull public Multiset.Entry firstEntry() { return forwardMultiset().lastEntry(); } @Override // com.google.common.collect.SortedMultiset @CheckForNull 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() { // from class: com.google.common.collect.DescendingMultiset.1EntrySetImpl @Override // com.google.common.collect.Multisets.EntrySet Multiset multiset() { return DescendingMultiset.this; } @Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set public Iterator> iterator() { return DescendingMultiset.this.entryIterator(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public int size() { return DescendingMultiset.this.forwardMultiset().entrySet().size(); } }; } @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(); } }