645 |
|
|
646 |
|
// NavigableMap API methods |
647 |
|
|
648 |
+ |
/** |
649 |
+ |
* @since 1.6 |
650 |
+ |
*/ |
651 |
|
public Map.Entry<K,V> firstEntry() { |
652 |
|
Entry<K,V> e = getFirstEntry(); |
653 |
|
return (e == null)? null : new AbstractMap.SimpleImmutableEntry<K,V>(e); |
654 |
|
} |
655 |
|
|
656 |
+ |
/** |
657 |
+ |
* @since 1.6 |
658 |
+ |
*/ |
659 |
|
public Map.Entry<K,V> lastEntry() { |
660 |
|
Entry<K,V> e = getLastEntry(); |
661 |
|
return (e == null)? null : new AbstractMap.SimpleImmutableEntry<K,V>(e); |
662 |
|
} |
663 |
|
|
664 |
+ |
/** |
665 |
+ |
* @since 1.6 |
666 |
+ |
*/ |
667 |
|
public Map.Entry<K,V> pollFirstEntry() { |
668 |
|
Entry<K,V> p = getFirstEntry(); |
669 |
|
if (p == null) |
673 |
|
return result; |
674 |
|
} |
675 |
|
|
676 |
+ |
/** |
677 |
+ |
* @since 1.6 |
678 |
+ |
*/ |
679 |
|
public Map.Entry<K,V> pollLastEntry() { |
680 |
|
Entry<K,V> p = getLastEntry(); |
681 |
|
if (p == null) |
690 |
|
* @throws NullPointerException if the specified key is null |
691 |
|
* and this map uses natural ordering, or its comparator |
692 |
|
* does not permit null keys |
693 |
+ |
* @since 1.6 |
694 |
|
*/ |
695 |
|
public Map.Entry<K,V> lowerEntry(K key) { |
696 |
|
Entry<K,V> e = getLowerEntry(key); |
702 |
|
* @throws NullPointerException if the specified key is null |
703 |
|
* and this map uses natural ordering, or its comparator |
704 |
|
* does not permit null keys |
705 |
+ |
* @since 1.6 |
706 |
|
*/ |
707 |
|
public K lowerKey(K key) { |
708 |
|
Entry<K,V> e = getLowerEntry(key); |
714 |
|
* @throws NullPointerException if the specified key is null |
715 |
|
* and this map uses natural ordering, or its comparator |
716 |
|
* does not permit null keys |
717 |
+ |
* @since 1.6 |
718 |
|
*/ |
719 |
|
public Map.Entry<K,V> floorEntry(K key) { |
720 |
|
Entry<K,V> e = getFloorEntry(key); |
726 |
|
* @throws NullPointerException if the specified key is null |
727 |
|
* and this map uses natural ordering, or its comparator |
728 |
|
* does not permit null keys |
729 |
+ |
* @since 1.6 |
730 |
|
*/ |
731 |
|
public K floorKey(K key) { |
732 |
|
Entry<K,V> e = getFloorEntry(key); |
738 |
|
* @throws NullPointerException if the specified key is null |
739 |
|
* and this map uses natural ordering, or its comparator |
740 |
|
* does not permit null keys |
741 |
+ |
* @since 1.6 |
742 |
|
*/ |
743 |
|
public Map.Entry<K,V> ceilingEntry(K key) { |
744 |
|
Entry<K,V> e = getCeilingEntry(key); |
750 |
|
* @throws NullPointerException if the specified key is null |
751 |
|
* and this map uses natural ordering, or its comparator |
752 |
|
* does not permit null keys |
753 |
+ |
* @since 1.6 |
754 |
|
*/ |
755 |
|
public K ceilingKey(K key) { |
756 |
|
Entry<K,V> e = getCeilingEntry(key); |
762 |
|
* @throws NullPointerException if the specified key is null |
763 |
|
* and this map uses natural ordering, or its comparator |
764 |
|
* does not permit null keys |
765 |
+ |
* @since 1.6 |
766 |
|
*/ |
767 |
|
public Map.Entry<K,V> higherEntry(K key) { |
768 |
|
Entry<K,V> e = getHigherEntry(key); |
774 |
|
* @throws NullPointerException if the specified key is null |
775 |
|
* and this map uses natural ordering, or its comparator |
776 |
|
* does not permit null keys |
777 |
+ |
* @since 1.6 |
778 |
|
*/ |
779 |
|
public K higherKey(K key) { |
780 |
|
Entry<K,V> e = getHigherEntry(key); |
942 |
|
} |
943 |
|
} |
944 |
|
|
945 |
+ |
/** |
946 |
+ |
* @since 1.6 |
947 |
+ |
*/ |
948 |
|
public Set<Map.Entry<K,V>> descendingEntrySet() { |
949 |
|
Set<Map.Entry<K,V>> es = descendingEntrySet; |
950 |
|
return (es != null) ? es : (descendingEntrySet = new DescendingEntrySet()); |
956 |
|
} |
957 |
|
} |
958 |
|
|
959 |
+ |
/** |
960 |
+ |
* @since 1.6 |
961 |
+ |
*/ |
962 |
|
public Set<K> descendingKeySet() { |
963 |
|
Set<K> ks = descendingKeySet; |
964 |
|
return (ks != null) ? ks : (descendingKeySet = new DescendingKeySet()); |
976 |
|
* null and this map uses natural ordering, or its comparator |
977 |
|
* does not permit null keys |
978 |
|
* @throws IllegalArgumentException {@inheritDoc} |
979 |
+ |
* @since 1.6 |
980 |
|
*/ |
981 |
|
public NavigableMap<K,V> navigableSubMap(K fromKey, K toKey) { |
982 |
|
return new SubMap(fromKey, toKey); |
988 |
|
* and this map uses natural ordering, or its comparator |
989 |
|
* does not permit null keys |
990 |
|
* @throws IllegalArgumentException {@inheritDoc} |
991 |
+ |
* @since 1.6 |
992 |
|
*/ |
993 |
|
public NavigableMap<K,V> navigableHeadMap(K toKey) { |
994 |
|
return new SubMap(toKey, true); |
1000 |
|
* and this map uses natural ordering, or its comparator |
1001 |
|
* does not permit null keys |
1002 |
|
* @throws IllegalArgumentException {@inheritDoc} |
1003 |
+ |
* @since 1.6 |
1004 |
|
*/ |
1005 |
|
public NavigableMap<K,V> navigableTailMap(K fromKey) { |
1006 |
|
return new SubMap(fromKey, false); |