< prev index next >

src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java

Print this page




2693             else if (loInclusive)
2694                 return m.findNear(lo, GT|EQ, cmp);
2695             else
2696                 return m.findNear(lo, GT, cmp);
2697         }
2698 
2699         /**
2700          * Returns highest node. This node might not be in range, so
2701          * most usages need to check bounds.
2702          */
2703         ConcurrentSkipListMap.Node<K,V> hiNode(Comparator<? super K> cmp) {
2704             if (hi == null)
2705                 return m.findLast();
2706             else if (hiInclusive)
2707                 return m.findNear(hi, LT|EQ, cmp);
2708             else
2709                 return m.findNear(hi, LT, cmp);
2710         }
2711 
2712         /**
2713          * Returns lowest absolute key (ignoring directonality).
2714          */
2715         K lowestKey() {
2716             Comparator<? super K> cmp = m.comparator;
2717             ConcurrentSkipListMap.Node<K,V> n = loNode(cmp);
2718             if (isBeforeEnd(n, cmp))
2719                 return n.key;
2720             else
2721                 throw new NoSuchElementException();
2722         }
2723 
2724         /**
2725          * Returns highest absolute key (ignoring directonality).
2726          */
2727         K highestKey() {
2728             Comparator<? super K> cmp = m.comparator;
2729             ConcurrentSkipListMap.Node<K,V> n = hiNode(cmp);
2730             if (n != null) {
2731                 K last = n.key;
2732                 if (inBounds(last, cmp))
2733                     return last;
2734             }
2735             throw new NoSuchElementException();
2736         }
2737 
2738         Map.Entry<K,V> lowestEntry() {
2739             Comparator<? super K> cmp = m.comparator;
2740             for (;;) {
2741                 ConcurrentSkipListMap.Node<K,V> n = loNode(cmp);
2742                 if (!isBeforeEnd(n, cmp))
2743                     return null;
2744                 Map.Entry<K,V> e = n.createSnapshot();
2745                 if (e != null)




2693             else if (loInclusive)
2694                 return m.findNear(lo, GT|EQ, cmp);
2695             else
2696                 return m.findNear(lo, GT, cmp);
2697         }
2698 
2699         /**
2700          * Returns highest node. This node might not be in range, so
2701          * most usages need to check bounds.
2702          */
2703         ConcurrentSkipListMap.Node<K,V> hiNode(Comparator<? super K> cmp) {
2704             if (hi == null)
2705                 return m.findLast();
2706             else if (hiInclusive)
2707                 return m.findNear(hi, LT|EQ, cmp);
2708             else
2709                 return m.findNear(hi, LT, cmp);
2710         }
2711 
2712         /**
2713          * Returns lowest absolute key (ignoring directionality).
2714          */
2715         K lowestKey() {
2716             Comparator<? super K> cmp = m.comparator;
2717             ConcurrentSkipListMap.Node<K,V> n = loNode(cmp);
2718             if (isBeforeEnd(n, cmp))
2719                 return n.key;
2720             else
2721                 throw new NoSuchElementException();
2722         }
2723 
2724         /**
2725          * Returns highest absolute key (ignoring directionality).
2726          */
2727         K highestKey() {
2728             Comparator<? super K> cmp = m.comparator;
2729             ConcurrentSkipListMap.Node<K,V> n = hiNode(cmp);
2730             if (n != null) {
2731                 K last = n.key;
2732                 if (inBounds(last, cmp))
2733                     return last;
2734             }
2735             throw new NoSuchElementException();
2736         }
2737 
2738         Map.Entry<K,V> lowestEntry() {
2739             Comparator<? super K> cmp = m.comparator;
2740             for (;;) {
2741                 ConcurrentSkipListMap.Node<K,V> n = loNode(cmp);
2742                 if (!isBeforeEnd(n, cmp))
2743                     return null;
2744                 Map.Entry<K,V> e = n.createSnapshot();
2745                 if (e != null)


< prev index next >