599 |
|
/** |
600 |
|
* Returns the key corresponding to this entry. |
601 |
|
* |
602 |
< |
* @return the key corresponding to this entry. |
602 |
> |
* @return the key corresponding to this entry |
603 |
|
*/ |
604 |
|
public K getKey() { |
605 |
|
return key; |
608 |
|
/** |
609 |
|
* Returns the value corresponding to this entry. |
610 |
|
* |
611 |
< |
* @return the value corresponding to this entry. |
611 |
> |
* @return the value corresponding to this entry |
612 |
|
*/ |
613 |
|
public V getValue() { |
614 |
|
return value; |
616 |
|
|
617 |
|
/** |
618 |
|
* Always fails, throwing <tt>UnsupportedOperationException</tt>. |
619 |
< |
* @throws UnsupportedOperationException always. |
619 |
> |
* @throws UnsupportedOperationException always |
620 |
|
*/ |
621 |
|
public V setValue(V value) { |
622 |
|
throw new UnsupportedOperationException(); |
646 |
|
* Returns a String consisting of the key followed by an |
647 |
|
* equals sign (<tt>"="</tt>) followed by the associated |
648 |
|
* value. |
649 |
< |
* @return a String representation of this entry. |
649 |
> |
* @return a String representation of this entry |
650 |
|
*/ |
651 |
|
public String toString() { |
652 |
|
return getKey() + "=" + getValue(); |
807 |
|
* were performed. |
808 |
|
* |
809 |
|
* @param key the key |
810 |
< |
* @return node holding key, or null if no such. |
810 |
> |
* @return node holding key, or null if no such |
811 |
|
*/ |
812 |
|
private Node<K,V> findNode(Comparable<K> key) { |
813 |
|
for (;;) { |
1378 |
|
* last valid node. Needed by doRemoveLast. It is possible that |
1379 |
|
* all successors of returned node will have been deleted upon |
1380 |
|
* return, in which case this method can be retried. |
1381 |
< |
* @return likely predecessor of last node. |
1381 |
> |
* @return likely predecessor of last node |
1382 |
|
*/ |
1383 |
|
private Node<K,V> findPredecessorOfLast() { |
1384 |
|
for (;;) { |
1586 |
|
* Constructs a new map containing the same mappings as the given map, |
1587 |
|
* sorted according to the keys' <i>natural order</i>. |
1588 |
|
* |
1589 |
< |
* @param m the map whose mappings are to be placed in this map. |
1589 |
> |
* @param m the map whose mappings are to be placed in this map |
1590 |
|
* @throws ClassCastException if the keys in m are not Comparable, or |
1591 |
< |
* are not mutually comparable. |
1592 |
< |
* @throws NullPointerException if the specified map is <tt>null</tt>. |
1591 |
> |
* are not mutually comparable |
1592 |
> |
* @throws NullPointerException if the specified map is <tt>null</tt> |
1593 |
|
*/ |
1594 |
|
public ConcurrentSkipListMap(Map<? extends K, ? extends V> m) { |
1595 |
|
this.comparator = null; |
1615 |
|
* Returns a shallow copy of this <tt>Map</tt> instance. (The keys and |
1616 |
|
* values themselves are not cloned.) |
1617 |
|
* |
1618 |
< |
* @return a shallow copy of this Map. |
1618 |
> |
* @return a shallow copy of this Map |
1619 |
|
*/ |
1620 |
|
public Object clone() { |
1621 |
|
ConcurrentSkipListMap<K,V> clone = null; |
1779 |
|
/** |
1780 |
|
* Returns <tt>true</tt> if this map contains a mapping for the specified |
1781 |
|
* key. |
1782 |
< |
* @param key key whose presence in this map is to be tested. |
1782 |
> |
* @param key key whose presence in this map is to be tested |
1783 |
|
* @return <tt>true</tt> if this map contains a mapping for the |
1784 |
< |
* specified key. |
1784 |
> |
* specified key |
1785 |
|
* @throws ClassCastException if the key cannot be compared with the keys |
1786 |
< |
* currently in the map. |
1787 |
< |
* @throws NullPointerException if the key is <tt>null</tt>. |
1786 |
> |
* currently in the map |
1787 |
> |
* @throws NullPointerException if the key is <tt>null</tt> |
1788 |
|
*/ |
1789 |
|
public boolean containsKey(Object key) { |
1790 |
|
return doGet(key) != null; |
1794 |
|
* Returns the value to which this map maps the specified key. Returns |
1795 |
|
* <tt>null</tt> if the map contains no mapping for this key. |
1796 |
|
* |
1797 |
< |
* @param key key whose associated value is to be returned. |
1797 |
> |
* @param key key whose associated value is to be returned |
1798 |
|
* @return the value to which this map maps the specified key, or |
1799 |
< |
* <tt>null</tt> if the map contains no mapping for the key. |
1799 |
> |
* <tt>null</tt> if the map contains no mapping for the key |
1800 |
|
* @throws ClassCastException if the key cannot be compared with the keys |
1801 |
< |
* currently in the map. |
1802 |
< |
* @throws NullPointerException if the key is <tt>null</tt>. |
1801 |
> |
* currently in the map |
1802 |
> |
* @throws NullPointerException if the key is <tt>null</tt> |
1803 |
|
*/ |
1804 |
|
public V get(Object key) { |
1805 |
|
return doGet(key); |
1810 |
|
* If the map previously contained a mapping for this key, the old |
1811 |
|
* value is replaced. |
1812 |
|
* |
1813 |
< |
* @param key key with which the specified value is to be associated. |
1814 |
< |
* @param value value to be associated with the specified key. |
1813 |
> |
* @param key key with which the specified value is to be associated |
1814 |
> |
* @param value value to be associated with the specified key |
1815 |
|
* |
1816 |
|
* @return previous value associated with specified key, or <tt>null</tt> |
1817 |
< |
* if there was no mapping for key. |
1817 |
> |
* if there was no mapping for key |
1818 |
|
* @throws ClassCastException if the key cannot be compared with the keys |
1819 |
< |
* currently in the map. |
1820 |
< |
* @throws NullPointerException if the key or value are <tt>null</tt>. |
1819 |
> |
* currently in the map |
1820 |
> |
* @throws NullPointerException if the key or value are <tt>null</tt> |
1821 |
|
*/ |
1822 |
|
public V put(K key, V value) { |
1823 |
|
if (value == null) |
1830 |
|
* |
1831 |
|
* @param key key for which mapping should be removed |
1832 |
|
* @return previous value associated with specified key, or <tt>null</tt> |
1833 |
< |
* if there was no mapping for key. |
1833 |
> |
* if there was no mapping for key |
1834 |
|
* |
1835 |
|
* @throws ClassCastException if the key cannot be compared with the keys |
1836 |
< |
* currently in the map. |
1837 |
< |
* @throws NullPointerException if the key is <tt>null</tt>. |
1836 |
> |
* currently in the map |
1837 |
> |
* @throws NullPointerException if the key is <tt>null</tt> |
1838 |
|
*/ |
1839 |
|
public V remove(Object key) { |
1840 |
|
return doRemove(key, null); |
1845 |
|
* specified value. This operation requires time linear in the |
1846 |
|
* Map size. |
1847 |
|
* |
1848 |
< |
* @param value value whose presence in this Map is to be tested. |
1848 |
> |
* @param value value whose presence in this Map is to be tested |
1849 |
|
* @return <tt>true</tt> if a mapping to <tt>value</tt> exists; |
1850 |
< |
* <tt>false</tt> otherwise. |
1851 |
< |
* @throws NullPointerException if the value is <tt>null</tt>. |
1850 |
> |
* <tt>false</tt> otherwise |
1851 |
> |
* @throws NullPointerException if the value is <tt>null</tt> |
1852 |
|
*/ |
1853 |
|
public boolean containsValue(Object value) { |
1854 |
|
if (value == null) |
1875 |
|
* will be inaccurate. Thus, this method is typically not very |
1876 |
|
* useful in concurrent applications. |
1877 |
|
* |
1878 |
< |
* @return the number of elements in this map. |
1878 |
> |
* @return the number of elements in this map |
1879 |
|
*/ |
1880 |
|
public int size() { |
1881 |
|
long count = 0; |
1888 |
|
|
1889 |
|
/** |
1890 |
|
* Returns <tt>true</tt> if this map contains no key-value mappings. |
1891 |
< |
* @return <tt>true</tt> if this map contains no key-value mappings. |
1891 |
> |
* @return <tt>true</tt> if this map contains no key-value mappings |
1892 |
|
*/ |
1893 |
|
public boolean isEmpty() { |
1894 |
|
return findFirst() == null; |
1915 |
|
* construction of the iterator, and may (but is not guaranteed to) |
1916 |
|
* reflect any modifications subsequent to construction. |
1917 |
|
* |
1918 |
< |
* @return a set view of the keys contained in this map. |
1918 |
> |
* @return a set view of the keys contained in this map |
1919 |
|
*/ |
1920 |
|
public Set<K> keySet() { |
1921 |
|
/* |
1946 |
|
* construction of the iterator, and may (but is not guaranteed |
1947 |
|
* to) reflect any modifications subsequent to construction. |
1948 |
|
* |
1949 |
< |
* @return a set view of the keys contained in this map. |
1949 |
> |
* @return a set view of the keys contained in this map |
1950 |
|
*/ |
1951 |
|
public Set<K> descendingKeySet() { |
1952 |
|
/* |
1978 |
|
* iterator, and may (but is not guaranteed to) reflect any |
1979 |
|
* modifications subsequent to construction. |
1980 |
|
* |
1981 |
< |
* @return a collection view of the values contained in this map. |
1981 |
> |
* @return a collection view of the values contained in this map |
1982 |
|
*/ |
1983 |
|
public Collection<V> values() { |
1984 |
|
Values vs = values; |
2005 |
|
* <tt>iterator.next()</tt> do <em>not</em> support the |
2006 |
|
* <tt>setValue</tt> operation. |
2007 |
|
* |
2008 |
< |
* @return a collection view of the mappings contained in this map. |
2008 |
> |
* @return a collection view of the mappings contained in this map |
2009 |
|
*/ |
2010 |
|
public Set<Map.Entry<K,V>> entrySet() { |
2011 |
|
EntrySet es = entrySet; |
2032 |
|
* <tt>iterator.next()</tt> do <em>not</em> support the |
2033 |
|
* <tt>setValue</tt> operation. |
2034 |
|
* |
2035 |
< |
* @return a collection view of the mappings contained in this map. |
2035 |
> |
* @return a collection view of the mappings contained in this map |
2036 |
|
*/ |
2037 |
|
public Set<Map.Entry<K,V>> descendingEntrySet() { |
2038 |
|
DescendingEntrySet es = descendingEntrySet; |
2052 |
|
* operation may return misleading results if either map is |
2053 |
|
* concurrently modified during execution of this method. |
2054 |
|
* |
2055 |
< |
* @param o object to be compared for equality with this map. |
2056 |
< |
* @return <tt>true</tt> if the specified object is equal to this map. |
2055 |
> |
* @param o object to be compared for equality with this map |
2056 |
> |
* @return <tt>true</tt> if the specified object is equal to this map |
2057 |
|
*/ |
2058 |
|
public boolean equals(Object o) { |
2059 |
|
if (o == this) |
2099 |
|
* return map.get(key); |
2100 |
|
* </pre> |
2101 |
|
* except that the action is performed atomically. |
2102 |
< |
* @param key key with which the specified value is to be associated. |
2103 |
< |
* @param value value to be associated with the specified key. |
2102 |
> |
* @param key key with which the specified value is to be associated |
2103 |
> |
* @param value value to be associated with the specified key |
2104 |
|
* @return previous value associated with specified key, or <tt>null</tt> |
2105 |
< |
* if there was no mapping for key. |
2105 |
> |
* if there was no mapping for key |
2106 |
|
* |
2107 |
|
* @throws ClassCastException if the key cannot be compared with the keys |
2108 |
< |
* currently in the map. |
2109 |
< |
* @throws NullPointerException if the key or value are <tt>null</tt>. |
2108 |
> |
* currently in the map |
2109 |
> |
* @throws NullPointerException if the key or value are <tt>null</tt> |
2110 |
|
*/ |
2111 |
|
public V putIfAbsent(K key, V value) { |
2112 |
|
if (value == null) |
2124 |
|
* } else return false; |
2125 |
|
* </pre> |
2126 |
|
* except that the action is performed atomically. |
2127 |
< |
* @param key key with which the specified value is associated. |
2128 |
< |
* @param value value associated with the specified key. |
2127 |
> |
* @param key key with which the specified value is associated |
2128 |
> |
* @param value value associated with the specified key |
2129 |
|
* @return true if the value was removed, false otherwise |
2130 |
|
* @throws ClassCastException if the key cannot be compared with the keys |
2131 |
< |
* currently in the map. |
2132 |
< |
* @throws NullPointerException if the key or value are <tt>null</tt>. |
2131 |
> |
* currently in the map |
2132 |
> |
* @throws NullPointerException if the key or value are <tt>null</tt> |
2133 |
|
*/ |
2134 |
|
public boolean remove(Object key, Object value) { |
2135 |
|
if (value == null) |
2147 |
|
* } else return false; |
2148 |
|
* </pre> |
2149 |
|
* except that the action is performed atomically. |
2150 |
< |
* @param key key with which the specified value is associated. |
2151 |
< |
* @param oldValue value expected to be associated with the specified key. |
2152 |
< |
* @param newValue value to be associated with the specified key. |
2150 |
> |
* @param key key with which the specified value is associated |
2151 |
> |
* @param oldValue value expected to be associated with the specified key |
2152 |
> |
* @param newValue value to be associated with the specified key |
2153 |
|
* @return true if the value was replaced |
2154 |
|
* @throws ClassCastException if the key cannot be compared with the keys |
2155 |
< |
* currently in the map. |
2155 |
> |
* currently in the map |
2156 |
|
* @throws NullPointerException if key, oldValue or newValue are |
2157 |
< |
* <tt>null</tt>. |
2157 |
> |
* <tt>null</tt> |
2158 |
|
*/ |
2159 |
|
public boolean replace(K key, V oldValue, V newValue) { |
2160 |
|
if (oldValue == null || newValue == null) |
2183 |
|
* } else return null; |
2184 |
|
* </pre> |
2185 |
|
* except that the action is performed atomically. |
2186 |
< |
* @param key key with which the specified value is associated. |
2187 |
< |
* @param value value to be associated with the specified key. |
2186 |
> |
* @param key key with which the specified value is associated |
2187 |
> |
* @param value value to be associated with the specified key |
2188 |
|
* @return previous value associated with specified key, or <tt>null</tt> |
2189 |
< |
* if there was no mapping for key. |
2189 |
> |
* if there was no mapping for key |
2190 |
|
* @throws ClassCastException if the key cannot be compared with the keys |
2191 |
< |
* currently in the map. |
2192 |
< |
* @throws NullPointerException if the key or value are <tt>null</tt>. |
2191 |
> |
* currently in the map |
2192 |
> |
* @throws NullPointerException if the key or value are <tt>null</tt> |
2193 |
|
*/ |
2194 |
|
public V replace(K key, V value) { |
2195 |
|
if (value == null) |
2221 |
|
/** |
2222 |
|
* Returns the first (lowest) key currently in this map. |
2223 |
|
* |
2224 |
< |
* @return the first (lowest) key currently in this map. |
2225 |
< |
* @throws NoSuchElementException Map is empty. |
2224 |
> |
* @return the first (lowest) key currently in this map |
2225 |
> |
* @throws NoSuchElementException Map is empty |
2226 |
|
*/ |
2227 |
|
public K firstKey() { |
2228 |
|
Node<K,V> n = findFirst(); |
2234 |
|
/** |
2235 |
|
* Returns the last (highest) key currently in this map. |
2236 |
|
* |
2237 |
< |
* @return the last (highest) key currently in this map. |
2238 |
< |
* @throws NoSuchElementException Map is empty. |
2237 |
> |
* @return the last (highest) key currently in this map |
2238 |
> |
* @throws NoSuchElementException Map is empty |
2239 |
|
*/ |
2240 |
|
public K lastKey() { |
2241 |
|
Node<K,V> n = findLast(); |
2251 |
|
* is empty.) The returned sorted map is backed by this map, so changes |
2252 |
|
* in the returned sorted map are reflected in this map, and vice-versa. |
2253 |
|
* |
2254 |
< |
* @param fromKey low endpoint (inclusive) of the subMap. |
2255 |
< |
* @param toKey high endpoint (exclusive) of the subMap. |
2254 |
> |
* @param fromKey low endpoint (inclusive) of the subMap |
2255 |
> |
* @param toKey high endpoint (exclusive) of the subMap |
2256 |
|
* |
2257 |
|
* @return a view of the portion of this map whose keys range from |
2258 |
< |
* <tt>fromKey</tt>, inclusive, to <tt>toKey</tt>, exclusive. |
2258 |
> |
* <tt>fromKey</tt>, inclusive, to <tt>toKey</tt>, exclusive |
2259 |
|
* |
2260 |
|
* @throws ClassCastException if <tt>fromKey</tt> and <tt>toKey</tt> |
2261 |
|
* cannot be compared to one another using this map's comparator |
2262 |
< |
* (or, if the map has no comparator, using natural ordering). |
2262 |
> |
* (or, if the map has no comparator, using natural ordering) |
2263 |
|
* @throws IllegalArgumentException if <tt>fromKey</tt> is greater than |
2264 |
< |
* <tt>toKey</tt>. |
2264 |
> |
* <tt>toKey</tt> |
2265 |
|
* @throws NullPointerException if <tt>fromKey</tt> or <tt>toKey</tt> is |
2266 |
< |
* <tt>null</tt>. |
2266 |
> |
* <tt>null</tt> |
2267 |
|
*/ |
2268 |
|
public ConcurrentNavigableMap<K,V> subMap(K fromKey, K toKey) { |
2269 |
|
if (fromKey == null || toKey == null) |
2276 |
|
* strictly less than <tt>toKey</tt>. The returned sorted map is |
2277 |
|
* backed by this map, so changes in the returned sorted map are |
2278 |
|
* reflected in this map, and vice-versa. |
2279 |
< |
* @param toKey high endpoint (exclusive) of the headMap. |
2279 |
> |
* @param toKey high endpoint (exclusive) of the headMap |
2280 |
|
* @return a view of the portion of this map whose keys are |
2281 |
< |
* strictly less than <tt>toKey</tt>. |
2281 |
> |
* strictly less than <tt>toKey</tt> |
2282 |
|
* |
2283 |
|
* @throws ClassCastException if <tt>toKey</tt> is not compatible |
2284 |
|
* with this map's comparator (or, if the map has no comparator, |
2285 |
< |
* if <tt>toKey</tt> does not implement <tt>Comparable</tt>). |
2286 |
< |
* @throws NullPointerException if <tt>toKey</tt> is <tt>null</tt>. |
2285 |
> |
* if <tt>toKey</tt> does not implement <tt>Comparable</tt>) |
2286 |
> |
* @throws NullPointerException if <tt>toKey</tt> is <tt>null</tt> |
2287 |
|
*/ |
2288 |
|
public ConcurrentNavigableMap<K,V> headMap(K toKey) { |
2289 |
|
if (toKey == null) |
2296 |
|
* greater than or equal to <tt>fromKey</tt>. The returned sorted |
2297 |
|
* map is backed by this map, so changes in the returned sorted |
2298 |
|
* map are reflected in this map, and vice-versa. |
2299 |
< |
* @param fromKey low endpoint (inclusive) of the tailMap. |
2299 |
> |
* @param fromKey low endpoint (inclusive) of the tailMap |
2300 |
|
* @return a view of the portion of this map whose keys are |
2301 |
< |
* greater than or equal to <tt>fromKey</tt>. |
2301 |
> |
* greater than or equal to <tt>fromKey</tt> |
2302 |
|
* @throws ClassCastException if <tt>fromKey</tt> is not |
2303 |
|
* compatible with this map's comparator (or, if the map has no |
2304 |
|
* comparator, if <tt>fromKey</tt> does not implement |
2305 |
< |
* <tt>Comparable</tt>). |
2306 |
< |
* @throws NullPointerException if <tt>fromKey</tt> is <tt>null</tt>. |
2305 |
> |
* <tt>Comparable</tt>) |
2306 |
> |
* @throws NullPointerException if <tt>fromKey</tt> is <tt>null</tt> |
2307 |
|
*/ |
2308 |
|
public ConcurrentNavigableMap<K,V> tailMap(K fromKey) { |
2309 |
|
if (fromKey == null) |
2319 |
|
* there is no such entry. The returned entry does <em>not</em> |
2320 |
|
* support the <tt>Entry.setValue</tt> method. |
2321 |
|
* |
2322 |
< |
* @param key the key. |
2322 |
> |
* @param key the key |
2323 |
|
* @return an Entry associated with ceiling of given key, or |
2324 |
< |
* <tt>null</tt> if there is no such Entry. |
2324 |
> |
* <tt>null</tt> if there is no such Entry |
2325 |
|
* @throws ClassCastException if key cannot be compared with the |
2326 |
< |
* keys currently in the map. |
2327 |
< |
* @throws NullPointerException if key is <tt>null</tt>. |
2326 |
> |
* keys currently in the map |
2327 |
> |
* @throws NullPointerException if key is <tt>null</tt> |
2328 |
|
*/ |
2329 |
|
public Map.Entry<K,V> ceilingEntry(K key) { |
2330 |
|
return getNear(key, GT|EQ); |
2334 |
|
* Returns least key greater than or equal to the given key, or |
2335 |
|
* <tt>null</tt> if there is no such key. |
2336 |
|
* |
2337 |
< |
* @param key the key. |
2337 |
> |
* @param key the key |
2338 |
|
* @return the ceiling key, or <tt>null</tt> |
2339 |
< |
* if there is no such key. |
2339 |
> |
* if there is no such key |
2340 |
|
* @throws ClassCastException if key cannot be compared with the keys |
2341 |
< |
* currently in the map. |
2342 |
< |
* @throws NullPointerException if key is <tt>null</tt>. |
2341 |
> |
* currently in the map |
2342 |
> |
* @throws NullPointerException if key is <tt>null</tt> |
2343 |
|
*/ |
2344 |
|
public K ceilingKey(K key) { |
2345 |
|
Node<K,V> n = findNear(key, GT|EQ); |
2352 |
|
* such entry. The returned entry does <em>not</em> support |
2353 |
|
* the <tt>Entry.setValue</tt> method. |
2354 |
|
* |
2355 |
< |
* @param key the key. |
2355 |
> |
* @param key the key |
2356 |
|
* @return an Entry with greatest key less than the given |
2357 |
< |
* key, or <tt>null</tt> if there is no such Entry. |
2357 |
> |
* key, or <tt>null</tt> if there is no such Entry |
2358 |
|
* @throws ClassCastException if key cannot be compared with the keys |
2359 |
< |
* currently in the map. |
2360 |
< |
* @throws NullPointerException if key is <tt>null</tt>. |
2359 |
> |
* currently in the map |
2360 |
> |
* @throws NullPointerException if key is <tt>null</tt> |
2361 |
|
*/ |
2362 |
|
public Map.Entry<K,V> lowerEntry(K key) { |
2363 |
|
return getNear(key, LT); |
2367 |
|
* Returns the greatest key strictly less than the given key, or |
2368 |
|
* <tt>null</tt> if there is no such key. |
2369 |
|
* |
2370 |
< |
* @param key the key. |
2370 |
> |
* @param key the key |
2371 |
|
* @return the greatest key less than the given |
2372 |
< |
* key, or <tt>null</tt> if there is no such key. |
2372 |
> |
* key, or <tt>null</tt> if there is no such key |
2373 |
|
* @throws ClassCastException if key cannot be compared with the keys |
2374 |
< |
* currently in the map. |
2375 |
< |
* @throws NullPointerException if key is <tt>null</tt>. |
2374 |
> |
* currently in the map |
2375 |
> |
* @throws NullPointerException if key is <tt>null</tt> |
2376 |
|
*/ |
2377 |
|
public K lowerKey(K key) { |
2378 |
|
Node<K,V> n = findNear(key, LT); |
2385 |
|
* is no such entry. The returned entry does <em>not</em> support |
2386 |
|
* the <tt>Entry.setValue</tt> method. |
2387 |
|
* |
2388 |
< |
* @param key the key. |
2388 |
> |
* @param key the key |
2389 |
|
* @return an Entry associated with floor of given key, or <tt>null</tt> |
2390 |
< |
* if there is no such Entry. |
2390 |
> |
* if there is no such Entry |
2391 |
|
* @throws ClassCastException if key cannot be compared with the keys |
2392 |
< |
* currently in the map. |
2393 |
< |
* @throws NullPointerException if key is <tt>null</tt>. |
2392 |
> |
* currently in the map |
2393 |
> |
* @throws NullPointerException if key is <tt>null</tt> |
2394 |
|
*/ |
2395 |
|
public Map.Entry<K,V> floorEntry(K key) { |
2396 |
|
return getNear(key, LT|EQ); |
2401 |
|
* less than or equal to the given key, or <tt>null</tt> if there |
2402 |
|
* is no such key. |
2403 |
|
* |
2404 |
< |
* @param key the key. |
2404 |
> |
* @param key the key |
2405 |
|
* @return the floor of given key, or <tt>null</tt> if there is no |
2406 |
< |
* such key. |
2406 |
> |
* such key |
2407 |
|
* @throws ClassCastException if key cannot be compared with the keys |
2408 |
< |
* currently in the map. |
2409 |
< |
* @throws NullPointerException if key is <tt>null</tt>. |
2408 |
> |
* currently in the map |
2409 |
> |
* @throws NullPointerException if key is <tt>null</tt> |
2410 |
|
*/ |
2411 |
|
public K floorKey(K key) { |
2412 |
|
Node<K,V> n = findNear(key, LT|EQ); |
2419 |
|
* is no such entry. The returned entry does <em>not</em> support |
2420 |
|
* the <tt>Entry.setValue</tt> method. |
2421 |
|
* |
2422 |
< |
* @param key the key. |
2422 |
> |
* @param key the key |
2423 |
|
* @return an Entry with least key greater than the given key, or |
2424 |
< |
* <tt>null</tt> if there is no such Entry. |
2424 |
> |
* <tt>null</tt> if there is no such Entry |
2425 |
|
* @throws ClassCastException if key cannot be compared with the keys |
2426 |
< |
* currently in the map. |
2427 |
< |
* @throws NullPointerException if key is <tt>null</tt>. |
2426 |
> |
* currently in the map |
2427 |
> |
* @throws NullPointerException if key is <tt>null</tt> |
2428 |
|
*/ |
2429 |
|
public Map.Entry<K,V> higherEntry(K key) { |
2430 |
|
return getNear(key, GT); |
2434 |
|
* Returns the least key strictly greater than the given key, or |
2435 |
|
* <tt>null</tt> if there is no such key. |
2436 |
|
* |
2437 |
< |
* @param key the key. |
2437 |
> |
* @param key the key |
2438 |
|
* @return the least key greater than the given key, or |
2439 |
< |
* <tt>null</tt> if there is no such key. |
2439 |
> |
* <tt>null</tt> if there is no such key |
2440 |
|
* @throws ClassCastException if key cannot be compared with the keys |
2441 |
< |
* currently in the map. |
2442 |
< |
* @throws NullPointerException if key is <tt>null</tt>. |
2441 |
> |
* currently in the map |
2442 |
> |
* @throws NullPointerException if key is <tt>null</tt> |
2443 |
|
*/ |
2444 |
|
public K higherKey(K key) { |
2445 |
|
Node<K,V> n = findNear(key, GT); |
2453 |
|
* the <tt>Entry.setValue</tt> method. |
2454 |
|
* |
2455 |
|
* @return an Entry with least key, or <tt>null</tt> |
2456 |
< |
* if the map is empty. |
2456 |
> |
* if the map is empty |
2457 |
|
*/ |
2458 |
|
public Map.Entry<K,V> firstEntry() { |
2459 |
|
for (;;) { |
2473 |
|
* the <tt>Entry.setValue</tt> method. |
2474 |
|
* |
2475 |
|
* @return an Entry with greatest key, or <tt>null</tt> |
2476 |
< |
* if the map is empty. |
2476 |
> |
* if the map is empty |
2477 |
|
*/ |
2478 |
|
public Map.Entry<K,V> lastEntry() { |
2479 |
|
for (;;) { |
2493 |
|
* the <tt>Entry.setValue</tt> method. |
2494 |
|
* |
2495 |
|
* @return the removed first entry of this map, or <tt>null</tt> |
2496 |
< |
* if the map is empty. |
2496 |
> |
* if the map is empty |
2497 |
|
*/ |
2498 |
|
public Map.Entry<K,V> pollFirstEntry() { |
2499 |
|
return (SnapshotEntry<K,V>)doRemoveFirst(false); |
2506 |
|
* the <tt>Entry.setValue</tt> method. |
2507 |
|
* |
2508 |
|
* @return the removed last entry of this map, or <tt>null</tt> |
2509 |
< |
* if the map is empty. |
2509 |
> |
* if the map is empty |
2510 |
|
*/ |
2511 |
|
public Map.Entry<K,V> pollLastEntry() { |
2512 |
|
return (SnapshotEntry<K,V>)doRemoveLast(false); |