@Test public void testKeySetDescendingIteratorOrder() { IncrementalSortMap<Integer, String> map = map5(); NavigableSet s = map.navigableKeySet(); Iterator i = s.descendingIterator(); Integer last = (Integer) i.next(); assertEquals(last, five); int count = 1; while (i.hasNext()) { Integer k = (Integer) i.next(); assertTrue(last.compareTo(k) > 0); last = k; ++count; } assertEquals(5, count); }
@Override public NavigableSet<K> navigableKeySet() { long[] stamps = grabAllSegmentWriteLocks(); try { sort(); return sorted.navigableKeySet(); } finally { releaseSegmentLocks(stamps); } }
IncrementalSortMap implements ConcurrentNavigableMap<K, V> { @Override public NavigableSet<K> navigableKeySet() { long[] stamps = grabAllSegmentWriteLocks(); try { sort(); return sorted.navigableKeySet(); } finally { releaseSegmentLocks(stamps); } } }
IncrementalSortMap implements ConcurrentNavigableMap<K, V> { @Override public NavigableSet<K> navigableKeySet() { long[] stamps = grabAllSegmentWriteLocks(); try { sort(); return sorted.navigableKeySet(); } finally { releaseSegmentLocks(stamps); } } @SuppressWarnings("unchecked") private  IncrementalSortMap(Comparator<? super K> comparator); }
IncrementalSortMap implements ConcurrentNavigableMap<K, V> { @Override public NavigableSet<K> navigableKeySet() { long[] stamps = grabAllSegmentWriteLocks(); try { sort(); return sorted.navigableKeySet(); } finally { releaseSegmentLocks(stamps); } } @SuppressWarnings("unchecked") private  IncrementalSortMap(Comparator<? super K> comparator); static IncrementalSortMap<K, V> create(); static IncrementalSortMap<K, V> create(
            Comparator<? super K> comparator); @Override java.util.Map.Entry<K, V> ceilingEntry(K key); @Override K ceilingKey(K key); @Override void clear(); @Override Comparator<? super K> comparator(); @Override boolean containsKey(Object key); @Override boolean containsValue(Object value); @Override NavigableSet<K> descendingKeySet(); @Override ConcurrentNavigableMap<K, V> descendingMap(); @Override Set<java.util.Map.Entry<K, V>> entrySet(); @SuppressWarnings("rawtypes") @Override boolean equals(Object obj); @Override java.util.Map.Entry<K, V> firstEntry(); @Override K firstKey(); @Override java.util.Map.Entry<K, V> floorEntry(K key); @Override K floorKey(K key); @Override V get(Object key); @Override int hashCode(); @Override ConcurrentNavigableMap<K, V> headMap(K key); @Override ConcurrentNavigableMap<K, V> headMap(K toKey, boolean inclusive); @Override java.util.Map.Entry<K, V> higherEntry(K key); @Override K higherKey(K key); @Override boolean isEmpty(); @Override NavigableSet<K> keySet(); @Override java.util.Map.Entry<K, V> lastEntry(); @Override K lastKey(); @Override java.util.Map.Entry<K, V> lowerEntry(K key); @Override K lowerKey(K key); @Override NavigableSet<K> navigableKeySet(); @Override java.util.Map.Entry<K, V> pollFirstEntry(); @Override java.util.Map.Entry<K, V> pollLastEntry(); @Override @Nullable V put(K key, V value); @Override void putAll(Map<? extends K, ? extends V> m); @Override V putIfAbsent(K key, V value); @Override V remove(Object key); @Override boolean remove(Object key, Object value); @Override V replace(K key, V value); @Override boolean replace(K key, V oldValue, V newValue); @Override int size(); @Override ConcurrentNavigableMap<K, V> subMap(K fromKey, boolean fromInclusive,
            K toKey, boolean toInclusive); @Override ConcurrentNavigableMap<K, V> subMap(K fromKey, K toKey); @Override ConcurrentNavigableMap<K, V> tailMap(K fromKey); @Override ConcurrentNavigableMap<K, V> tailMap(K fromKey, boolean inclusive); @Override String toString(); @Override Collection<V> values(); }
IncrementalSortMap implements ConcurrentNavigableMap<K, V> { @Override public NavigableSet<K> navigableKeySet() { long[] stamps = grabAllSegmentWriteLocks(); try { sort(); return sorted.navigableKeySet(); } finally { releaseSegmentLocks(stamps); } } @SuppressWarnings("unchecked") private  IncrementalSortMap(Comparator<? super K> comparator); static IncrementalSortMap<K, V> create(); static IncrementalSortMap<K, V> create(
            Comparator<? super K> comparator); @Override java.util.Map.Entry<K, V> ceilingEntry(K key); @Override K ceilingKey(K key); @Override void clear(); @Override Comparator<? super K> comparator(); @Override boolean containsKey(Object key); @Override boolean containsValue(Object value); @Override NavigableSet<K> descendingKeySet(); @Override ConcurrentNavigableMap<K, V> descendingMap(); @Override Set<java.util.Map.Entry<K, V>> entrySet(); @SuppressWarnings("rawtypes") @Override boolean equals(Object obj); @Override java.util.Map.Entry<K, V> firstEntry(); @Override K firstKey(); @Override java.util.Map.Entry<K, V> floorEntry(K key); @Override K floorKey(K key); @Override V get(Object key); @Override int hashCode(); @Override ConcurrentNavigableMap<K, V> headMap(K key); @Override ConcurrentNavigableMap<K, V> headMap(K toKey, boolean inclusive); @Override java.util.Map.Entry<K, V> higherEntry(K key); @Override K higherKey(K key); @Override boolean isEmpty(); @Override NavigableSet<K> keySet(); @Override java.util.Map.Entry<K, V> lastEntry(); @Override K lastKey(); @Override java.util.Map.Entry<K, V> lowerEntry(K key); @Override K lowerKey(K key); @Override NavigableSet<K> navigableKeySet(); @Override java.util.Map.Entry<K, V> pollFirstEntry(); @Override java.util.Map.Entry<K, V> pollLastEntry(); @Override @Nullable V put(K key, V value); @Override void putAll(Map<? extends K, ? extends V> m); @Override V putIfAbsent(K key, V value); @Override V remove(Object key); @Override boolean remove(Object key, Object value); @Override V replace(K key, V value); @Override boolean replace(K key, V oldValue, V newValue); @Override int size(); @Override ConcurrentNavigableMap<K, V> subMap(K fromKey, boolean fromInclusive,
            K toKey, boolean toInclusive); @Override ConcurrentNavigableMap<K, V> subMap(K fromKey, K toKey); @Override ConcurrentNavigableMap<K, V> tailMap(K fromKey); @Override ConcurrentNavigableMap<K, V> tailMap(K fromKey, boolean inclusive); @Override String toString(); @Override Collection<V> values();  }