package com.google.common.collect; import com.google.common.collect.Maps; import java.util.Iterator; import java.util.Map; import java.util.NavigableMap; import java.util.NavigableSet; import java.util.NoSuchElementException; import java.util.Set; import java.util.SortedMap; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public abstract class AbstractNavigableMap extends Maps.IteratorBasedAbstractMap implements NavigableMap { abstract Iterator> descendingEntryIterator(); @Override // java.util.AbstractMap, java.util.Map public abstract V get(Object obj); @Override // java.util.NavigableMap public Map.Entry firstEntry() { return (Map.Entry) Iterators.getNext(entryIterator(), null); } @Override // java.util.NavigableMap public Map.Entry lastEntry() { return (Map.Entry) Iterators.getNext(descendingEntryIterator(), null); } @Override // java.util.NavigableMap public Map.Entry pollFirstEntry() { return (Map.Entry) Iterators.pollNext(entryIterator()); } @Override // java.util.NavigableMap public Map.Entry pollLastEntry() { return (Map.Entry) Iterators.pollNext(descendingEntryIterator()); } @Override // java.util.SortedMap public K firstKey() { Map.Entry firstEntry = firstEntry(); if (firstEntry == null) { throw new NoSuchElementException(); } return firstEntry.getKey(); } @Override // java.util.SortedMap public K lastKey() { Map.Entry lastEntry = lastEntry(); if (lastEntry == null) { throw new NoSuchElementException(); } return lastEntry.getKey(); } @Override // java.util.NavigableMap public Map.Entry lowerEntry(K k) { return headMap(k, false).lastEntry(); } @Override // java.util.NavigableMap public Map.Entry floorEntry(K k) { return headMap(k, true).lastEntry(); } @Override // java.util.NavigableMap public Map.Entry ceilingEntry(K k) { return tailMap(k, true).firstEntry(); } @Override // java.util.NavigableMap public Map.Entry higherEntry(K k) { return tailMap(k, false).firstEntry(); } @Override // java.util.NavigableMap public K lowerKey(K k) { return (K) Maps.keyOrNull(lowerEntry(k)); } @Override // java.util.NavigableMap public K floorKey(K k) { return (K) Maps.keyOrNull(floorEntry(k)); } @Override // java.util.NavigableMap public K ceilingKey(K k) { return (K) Maps.keyOrNull(ceilingEntry(k)); } @Override // java.util.NavigableMap public K higherKey(K k) { return (K) Maps.keyOrNull(higherEntry(k)); } @Override // java.util.NavigableMap, java.util.SortedMap public SortedMap subMap(K k, K k2) { return subMap(k, true, k2, false); } @Override // java.util.NavigableMap, java.util.SortedMap public SortedMap headMap(K k) { return headMap(k, false); } @Override // java.util.NavigableMap, java.util.SortedMap public SortedMap tailMap(K k) { return tailMap(k, true); } @Override // java.util.NavigableMap public NavigableSet navigableKeySet() { return new Maps.NavigableKeySet(this); } @Override // java.util.AbstractMap, java.util.Map, java.util.SortedMap public Set keySet() { return navigableKeySet(); } @Override // java.util.NavigableMap public NavigableSet descendingKeySet() { return descendingMap().navigableKeySet(); } @Override // java.util.NavigableMap public NavigableMap descendingMap() { return new DescendingMap(); } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public final class DescendingMap extends Maps.DescendingMap { final AbstractNavigableMap this$0; private DescendingMap(AbstractNavigableMap abstractNavigableMap) { this.this$0 = abstractNavigableMap; } @Override // com.google.common.collect.Maps.DescendingMap final Iterator> entryIterator() { return this.this$0.descendingEntryIterator(); } @Override // com.google.common.collect.Maps.DescendingMap final NavigableMap forward() { return this.this$0; } } }