PageRenderTime 60ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 1ms

/jdk-7u76-docs-all/docs/api/java/util/TreeMap.html

https://gitlab.com/PNNutkung/Java-API
HTML | 1713 lines | 1591 code | 19 blank | 103 comment | 0 complexity | 3fe722f2ee217972186416b5c7f86534 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <!-- NewPage -->
  3. <html lang="en">
  4. <head>
  5. <!-- Generated by javadoc (version 1.6.0_18) on Thu Dec 18 17:17:19 PST 2014 -->
  6. <title>TreeMap (Java Platform SE 7 )</title>
  7. <meta name="date" content="2014-12-18">
  8. <meta name="keywords" content="java.util.TreeMap class">
  9. <meta name="keywords" content="size()">
  10. <meta name="keywords" content="containsKey()">
  11. <meta name="keywords" content="containsValue()">
  12. <meta name="keywords" content="get()">
  13. <meta name="keywords" content="comparator()">
  14. <meta name="keywords" content="firstKey()">
  15. <meta name="keywords" content="lastKey()">
  16. <meta name="keywords" content="putAll()">
  17. <meta name="keywords" content="put()">
  18. <meta name="keywords" content="remove()">
  19. <meta name="keywords" content="clear()">
  20. <meta name="keywords" content="clone()">
  21. <meta name="keywords" content="firstEntry()">
  22. <meta name="keywords" content="lastEntry()">
  23. <meta name="keywords" content="pollFirstEntry()">
  24. <meta name="keywords" content="pollLastEntry()">
  25. <meta name="keywords" content="lowerEntry()">
  26. <meta name="keywords" content="lowerKey()">
  27. <meta name="keywords" content="floorEntry()">
  28. <meta name="keywords" content="floorKey()">
  29. <meta name="keywords" content="ceilingEntry()">
  30. <meta name="keywords" content="ceilingKey()">
  31. <meta name="keywords" content="higherEntry()">
  32. <meta name="keywords" content="higherKey()">
  33. <meta name="keywords" content="keySet()">
  34. <meta name="keywords" content="navigableKeySet()">
  35. <meta name="keywords" content="descendingKeySet()">
  36. <meta name="keywords" content="values()">
  37. <meta name="keywords" content="entrySet()">
  38. <meta name="keywords" content="descendingMap()">
  39. <meta name="keywords" content="subMap()">
  40. <meta name="keywords" content="headMap()">
  41. <meta name="keywords" content="tailMap()">
  42. <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
  43. </head>
  44. <body>
  45. <script type="text/javascript"><!--
  46. if (location.href.indexOf('is-external=true') == -1) {
  47. parent.document.title="TreeMap (Java Platform SE 7 )";
  48. }
  49. //-->
  50. </script>
  51. <noscript>
  52. <div>JavaScript is disabled on your browser.</div>
  53. </noscript>
  54. <!-- ========= START OF TOP NAVBAR ======= -->
  55. <div class="topNav"><a name="navbar_top">
  56. <!-- -->
  57. </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
  58. <!-- -->
  59. </a>
  60. <ul class="navList" title="Navigation">
  61. <li><a href="../../overview-summary.html">Overview</a></li>
  62. <li><a href="package-summary.html">Package</a></li>
  63. <li class="navBarCell1Rev">Class</li>
  64. <li><a href="class-use/TreeMap.html">Use</a></li>
  65. <li><a href="package-tree.html">Tree</a></li>
  66. <li><a href="../../deprecated-list.html">Deprecated</a></li>
  67. <li><a href="../../index-files/index-1.html">Index</a></li>
  68. <li><a href="../../help-doc.html">Help</a></li>
  69. </ul>
  70. <div class="aboutLanguage"><em><strong>Java&trade;&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;7</strong></em></div>
  71. </div>
  72. <div class="subNav">
  73. <ul class="navList">
  74. <li><a href="../../java/util/TooManyListenersException.html" title="class in java.util"><span class="strong">Prev Class</span></a></li>
  75. <li><a href="../../java/util/TreeSet.html" title="class in java.util"><span class="strong">Next Class</span></a></li>
  76. </ul>
  77. <ul class="navList">
  78. <li><a href="../../index.html?java/util/TreeMap.html" target="_top">Frames</a></li>
  79. <li><a href="TreeMap.html" target="_top">No Frames</a></li>
  80. </ul>
  81. <ul class="navList" id="allclasses_navbar_top">
  82. <li><a href="../../allclasses-noframe.html">All Classes</a></li>
  83. </ul>
  84. <div>
  85. <script type="text/javascript"><!--
  86. allClassesLink = document.getElementById("allclasses_navbar_top");
  87. if(window==top) {
  88. allClassesLink.style.display = "block";
  89. }
  90. else {
  91. allClassesLink.style.display = "none";
  92. }
  93. //-->
  94. </script>
  95. </div>
  96. <div>
  97. <ul class="subNavList">
  98. <li>Summary:&nbsp;</li>
  99. <li><a href="#nested_classes_inherited_from_class_java.util.AbstractMap">Nested</a>&nbsp;|&nbsp;</li>
  100. <li>Field&nbsp;|&nbsp;</li>
  101. <li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
  102. <li><a href="#method_summary">Method</a></li>
  103. </ul>
  104. <ul class="subNavList">
  105. <li>Detail:&nbsp;</li>
  106. <li>Field&nbsp;|&nbsp;</li>
  107. <li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
  108. <li><a href="#method_detail">Method</a></li>
  109. </ul>
  110. </div>
  111. <a name="skip-navbar_top">
  112. <!-- -->
  113. </a></div>
  114. <!-- ========= END OF TOP NAVBAR ========= -->
  115. <!-- ======== START OF CLASS DATA ======== -->
  116. <div class="header">
  117. <div class="subTitle">java.util</div>
  118. <h2 title="Class TreeMap" class="title">Class TreeMap&lt;K,V&gt;</h2>
  119. </div>
  120. <div class="contentContainer">
  121. <ul class="inheritance">
  122. <li><a href="../../java/lang/Object.html" title="class in java.lang">java.lang.Object</a></li>
  123. <li>
  124. <ul class="inheritance">
  125. <li><a href="../../java/util/AbstractMap.html" title="class in java.util">java.util.AbstractMap</a>&lt;K,V&gt;</li>
  126. <li>
  127. <ul class="inheritance">
  128. <li>java.util.TreeMap&lt;K,V&gt;</li>
  129. </ul>
  130. </li>
  131. </ul>
  132. </li>
  133. </ul>
  134. <div class="description">
  135. <ul class="blockList">
  136. <li class="blockList">
  137. <dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>K</code> - the type of keys maintained by this map</dd><dd><code>V</code> - the type of mapped values</dd></dl>
  138. <dl>
  139. <dt>All Implemented Interfaces:</dt>
  140. <dd><a href="../../java/io/Serializable.html" title="interface in java.io">Serializable</a>, <a href="../../java/lang/Cloneable.html" title="interface in java.lang">Cloneable</a>, <a href="../../java/util/Map.html" title="interface in java.util">Map</a>&lt;K,V&gt;, <a href="../../java/util/NavigableMap.html" title="interface in java.util">NavigableMap</a>&lt;K,V&gt;, <a href="../../java/util/SortedMap.html" title="interface in java.util">SortedMap</a>&lt;K,V&gt;</dd>
  141. </dl>
  142. <hr>
  143. <br>
  144. <pre>public class <span class="strong">TreeMap&lt;K,V&gt;</span>
  145. extends <a href="../../java/util/AbstractMap.html" title="class in java.util">AbstractMap</a>&lt;K,V&gt;
  146. implements <a href="../../java/util/NavigableMap.html" title="interface in java.util">NavigableMap</a>&lt;K,V&gt;, <a href="../../java/lang/Cloneable.html" title="interface in java.lang">Cloneable</a>, <a href="../../java/io/Serializable.html" title="interface in java.io">Serializable</a></pre>
  147. <div class="block">A Red-Black tree based <a href="../../java/util/NavigableMap.html" title="interface in java.util"><code>NavigableMap</code></a> implementation.
  148. The map is sorted according to the <a href="../../java/lang/Comparable.html" title="interface in java.lang">natural
  149. ordering</a> of its keys, or by a <a href="../../java/util/Comparator.html" title="interface in java.util"><code>Comparator</code></a> provided at map
  150. creation time, depending on which constructor is used.
  151. <p>This implementation provides guaranteed log(n) time cost for the
  152. <code>containsKey</code>, <code>get</code>, <code>put</code> and <code>remove</code>
  153. operations. Algorithms are adaptations of those in Cormen, Leiserson, and
  154. Rivest's <em>Introduction to Algorithms</em>.
  155. <p>Note that the ordering maintained by a tree map, like any sorted map, and
  156. whether or not an explicit comparator is provided, must be <em>consistent
  157. with <code>equals</code></em> if this sorted map is to correctly implement the
  158. <code>Map</code> interface. (See <code>Comparable</code> or <code>Comparator</code> for a
  159. precise definition of <em>consistent with equals</em>.) This is so because
  160. the <code>Map</code> interface is defined in terms of the <code>equals</code>
  161. operation, but a sorted map performs all key comparisons using its <code>compareTo</code> (or <code>compare</code>) method, so two keys that are deemed equal by
  162. this method are, from the standpoint of the sorted map, equal. The behavior
  163. of a sorted map <em>is</em> well-defined even if its ordering is
  164. inconsistent with <code>equals</code>; it just fails to obey the general contract
  165. of the <code>Map</code> interface.
  166. <p><strong>Note that this implementation is not synchronized.</strong>
  167. If multiple threads access a map concurrently, and at least one of the
  168. threads modifies the map structurally, it <em>must</em> be synchronized
  169. externally. (A structural modification is any operation that adds or
  170. deletes one or more mappings; merely changing the value associated
  171. with an existing key is not a structural modification.) This is
  172. typically accomplished by synchronizing on some object that naturally
  173. encapsulates the map.
  174. If no such object exists, the map should be "wrapped" using the
  175. <a href="../../java/util/Collections.html#synchronizedSortedMap(java.util.SortedMap)"><code>Collections.synchronizedSortedMap</code></a>
  176. method. This is best done at creation time, to prevent accidental
  177. unsynchronized access to the map: <pre>
  178. SortedMap m = Collections.synchronizedSortedMap(new TreeMap(...));</pre>
  179. <p>The iterators returned by the <code>iterator</code> method of the collections
  180. returned by all of this class's "collection view methods" are
  181. <em>fail-fast</em>: if the map is structurally modified at any time after
  182. the iterator is created, in any way except through the iterator's own
  183. <code>remove</code> method, the iterator will throw a <a href="../../java/util/ConcurrentModificationException.html" title="class in java.util"><code>ConcurrentModificationException</code></a>. Thus, in the face of concurrent
  184. modification, the iterator fails quickly and cleanly, rather than risking
  185. arbitrary, non-deterministic behavior at an undetermined time in the future.
  186. <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
  187. as it is, generally speaking, impossible to make any hard guarantees in the
  188. presence of unsynchronized concurrent modification. Fail-fast iterators
  189. throw <code>ConcurrentModificationException</code> on a best-effort basis.
  190. Therefore, it would be wrong to write a program that depended on this
  191. exception for its correctness: <em>the fail-fast behavior of iterators
  192. should be used only to detect bugs.</em>
  193. <p>All <code>Map.Entry</code> pairs returned by methods in this class
  194. and its views represent snapshots of mappings at the time they were
  195. produced. They do <strong>not</strong> support the <code>Entry.setValue</code>
  196. method. (Note however that it is possible to change mappings in the
  197. associated map using <code>put</code>.)
  198. <p>This class is a member of the
  199. <a href="../../../technotes/guides/collections/index.html">
  200. Java Collections Framework</a>.</div>
  201. <dl><dt><span class="strong">Since:</span></dt>
  202. <dd>1.2</dd>
  203. <dt><span class="strong">See Also:</span></dt><dd><a href="../../java/util/Map.html" title="interface in java.util"><code>Map</code></a>,
  204. <a href="../../java/util/HashMap.html" title="class in java.util"><code>HashMap</code></a>,
  205. <a href="../../java/util/Hashtable.html" title="class in java.util"><code>Hashtable</code></a>,
  206. <a href="../../java/lang/Comparable.html" title="interface in java.lang"><code>Comparable</code></a>,
  207. <a href="../../java/util/Comparator.html" title="interface in java.util"><code>Comparator</code></a>,
  208. <a href="../../java/util/Collection.html" title="interface in java.util"><code>Collection</code></a>,
  209. <a href="../../serialized-form.html#java.util.TreeMap">Serialized Form</a></dd></dl>
  210. </li>
  211. </ul>
  212. </div>
  213. <div class="summary">
  214. <ul class="blockList">
  215. <li class="blockList">
  216. <!-- ======== NESTED CLASS SUMMARY ======== -->
  217. <ul class="blockList">
  218. <li class="blockList"><a name="nested_class_summary">
  219. <!-- -->
  220. </a>
  221. <h3>Nested Class Summary</h3>
  222. <ul class="blockList">
  223. <li class="blockList"><a name="nested_classes_inherited_from_class_java.util.AbstractMap">
  224. <!-- -->
  225. </a>
  226. <h3>Nested classes/interfaces inherited from class&nbsp;java.util.<a href="../../java/util/AbstractMap.html" title="class in java.util">AbstractMap</a></h3>
  227. <code><a href="../../java/util/AbstractMap.SimpleEntry.html" title="class in java.util">AbstractMap.SimpleEntry</a>&lt;<a href="../../java/util/AbstractMap.SimpleEntry.html" title="type parameter in AbstractMap.SimpleEntry">K</a>,<a href="../../java/util/AbstractMap.SimpleEntry.html" title="type parameter in AbstractMap.SimpleEntry">V</a>&gt;, <a href="../../java/util/AbstractMap.SimpleImmutableEntry.html" title="class in java.util">AbstractMap.SimpleImmutableEntry</a>&lt;<a href="../../java/util/AbstractMap.SimpleImmutableEntry.html" title="type parameter in AbstractMap.SimpleImmutableEntry">K</a>,<a href="../../java/util/AbstractMap.SimpleImmutableEntry.html" title="type parameter in AbstractMap.SimpleImmutableEntry">V</a>&gt;</code></li>
  228. </ul>
  229. </li>
  230. </ul>
  231. <!-- ======== CONSTRUCTOR SUMMARY ======== -->
  232. <ul class="blockList">
  233. <li class="blockList"><a name="constructor_summary">
  234. <!-- -->
  235. </a>
  236. <h3>Constructor Summary</h3>
  237. <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
  238. <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
  239. <tr>
  240. <th class="colOne" scope="col">Constructor and Description</th>
  241. </tr>
  242. <tr class="altColor">
  243. <td class="colOne"><code><strong><a href="../../java/util/TreeMap.html#TreeMap()">TreeMap</a></strong>()</code>
  244. <div class="block">Constructs a new, empty tree map, using the natural ordering of its
  245. keys.</div>
  246. </td>
  247. </tr>
  248. <tr class="rowColor">
  249. <td class="colOne"><code><strong><a href="../../java/util/TreeMap.html#TreeMap(java.util.Comparator)">TreeMap</a></strong>(<a href="../../java/util/Comparator.html" title="interface in java.util">Comparator</a>&lt;? super <a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&gt;&nbsp;comparator)</code>
  250. <div class="block">Constructs a new, empty tree map, ordered according to the given
  251. comparator.</div>
  252. </td>
  253. </tr>
  254. <tr class="altColor">
  255. <td class="colOne"><code><strong><a href="../../java/util/TreeMap.html#TreeMap(java.util.Map)">TreeMap</a></strong>(<a href="../../java/util/Map.html" title="interface in java.util">Map</a>&lt;? extends <a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,? extends <a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;&nbsp;m)</code>
  256. <div class="block">Constructs a new tree map containing the same mappings as the given
  257. map, ordered according to the <em>natural ordering</em> of its keys.</div>
  258. </td>
  259. </tr>
  260. <tr class="rowColor">
  261. <td class="colOne"><code><strong><a href="../../java/util/TreeMap.html#TreeMap(java.util.SortedMap)">TreeMap</a></strong>(<a href="../../java/util/SortedMap.html" title="interface in java.util">SortedMap</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,? extends <a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;&nbsp;m)</code>
  262. <div class="block">Constructs a new tree map containing the same mappings and
  263. using the same ordering as the specified sorted map.</div>
  264. </td>
  265. </tr>
  266. </table>
  267. </li>
  268. </ul>
  269. <!-- ========== METHOD SUMMARY =========== -->
  270. <ul class="blockList">
  271. <li class="blockList"><a name="method_summary">
  272. <!-- -->
  273. </a>
  274. <h3>Method Summary</h3>
  275. <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
  276. <caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
  277. <tr>
  278. <th class="colFirst" scope="col">Modifier and Type</th>
  279. <th class="colLast" scope="col">Method and Description</th>
  280. </tr>
  281. <tr class="altColor">
  282. <td class="colFirst"><code><a href="../../java/util/Map.Entry.html" title="interface in java.util">Map.Entry</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></td>
  283. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#ceilingEntry(K)">ceilingEntry</a></strong>(<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&nbsp;key)</code>
  284. <div class="block">Returns a key-value mapping associated with the least key
  285. greater than or equal to the given key, or <code>null</code> if
  286. there is no such key.</div>
  287. </td>
  288. </tr>
  289. <tr class="rowColor">
  290. <td class="colFirst"><code><a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a></code></td>
  291. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#ceilingKey(K)">ceilingKey</a></strong>(<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&nbsp;key)</code>
  292. <div class="block">Returns the least key greater than or equal to the given key,
  293. or <code>null</code> if there is no such key.</div>
  294. </td>
  295. </tr>
  296. <tr class="altColor">
  297. <td class="colFirst"><code>void</code></td>
  298. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#clear()">clear</a></strong>()</code>
  299. <div class="block">Removes all of the mappings from this map.</div>
  300. </td>
  301. </tr>
  302. <tr class="rowColor">
  303. <td class="colFirst"><code><a href="../../java/lang/Object.html" title="class in java.lang">Object</a></code></td>
  304. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#clone()">clone</a></strong>()</code>
  305. <div class="block">Returns a shallow copy of this <code>TreeMap</code> instance.</div>
  306. </td>
  307. </tr>
  308. <tr class="altColor">
  309. <td class="colFirst"><code><a href="../../java/util/Comparator.html" title="interface in java.util">Comparator</a>&lt;? super <a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&gt;</code></td>
  310. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#comparator()">comparator</a></strong>()</code>
  311. <div class="block">Returns the comparator used to order the keys in this map, or
  312. <code>null</code> if this map uses the <a href="../../java/lang/Comparable.html" title="interface in java.lang">natural ordering</a> of its keys.</div>
  313. </td>
  314. </tr>
  315. <tr class="rowColor">
  316. <td class="colFirst"><code>boolean</code></td>
  317. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#containsKey(java.lang.Object)">containsKey</a></strong>(<a href="../../java/lang/Object.html" title="class in java.lang">Object</a>&nbsp;key)</code>
  318. <div class="block">Returns <code>true</code> if this map contains a mapping for the specified
  319. key.</div>
  320. </td>
  321. </tr>
  322. <tr class="altColor">
  323. <td class="colFirst"><code>boolean</code></td>
  324. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#containsValue(java.lang.Object)">containsValue</a></strong>(<a href="../../java/lang/Object.html" title="class in java.lang">Object</a>&nbsp;value)</code>
  325. <div class="block">Returns <code>true</code> if this map maps one or more keys to the
  326. specified value.</div>
  327. </td>
  328. </tr>
  329. <tr class="rowColor">
  330. <td class="colFirst"><code><a href="../../java/util/NavigableSet.html" title="interface in java.util">NavigableSet</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&gt;</code></td>
  331. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#descendingKeySet()">descendingKeySet</a></strong>()</code>
  332. <div class="block">Returns a reverse order <a href="../../java/util/NavigableSet.html" title="interface in java.util"><code>NavigableSet</code></a> view of the keys contained in this map.</div>
  333. </td>
  334. </tr>
  335. <tr class="altColor">
  336. <td class="colFirst"><code><a href="../../java/util/NavigableMap.html" title="interface in java.util">NavigableMap</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></td>
  337. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#descendingMap()">descendingMap</a></strong>()</code>
  338. <div class="block">Returns a reverse order view of the mappings contained in this map.</div>
  339. </td>
  340. </tr>
  341. <tr class="rowColor">
  342. <td class="colFirst"><code><a href="../../java/util/Set.html" title="interface in java.util">Set</a>&lt;<a href="../../java/util/Map.Entry.html" title="interface in java.util">Map.Entry</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;&gt;</code></td>
  343. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#entrySet()">entrySet</a></strong>()</code>
  344. <div class="block">Returns a <a href="../../java/util/Set.html" title="interface in java.util"><code>Set</code></a> view of the mappings contained in this map.</div>
  345. </td>
  346. </tr>
  347. <tr class="altColor">
  348. <td class="colFirst"><code><a href="../../java/util/Map.Entry.html" title="interface in java.util">Map.Entry</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></td>
  349. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#firstEntry()">firstEntry</a></strong>()</code>
  350. <div class="block">Returns a key-value mapping associated with the least
  351. key in this map, or <code>null</code> if the map is empty.</div>
  352. </td>
  353. </tr>
  354. <tr class="rowColor">
  355. <td class="colFirst"><code><a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a></code></td>
  356. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#firstKey()">firstKey</a></strong>()</code>
  357. <div class="block">Returns the first (lowest) key currently in this map.</div>
  358. </td>
  359. </tr>
  360. <tr class="altColor">
  361. <td class="colFirst"><code><a href="../../java/util/Map.Entry.html" title="interface in java.util">Map.Entry</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></td>
  362. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#floorEntry(K)">floorEntry</a></strong>(<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&nbsp;key)</code>
  363. <div class="block">Returns a key-value mapping associated with the greatest key
  364. less than or equal to the given key, or <code>null</code> if there
  365. is no such key.</div>
  366. </td>
  367. </tr>
  368. <tr class="rowColor">
  369. <td class="colFirst"><code><a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a></code></td>
  370. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#floorKey(K)">floorKey</a></strong>(<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&nbsp;key)</code>
  371. <div class="block">Returns the greatest key less than or equal to the given key,
  372. or <code>null</code> if there is no such key.</div>
  373. </td>
  374. </tr>
  375. <tr class="altColor">
  376. <td class="colFirst"><code><a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a></code></td>
  377. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#get(java.lang.Object)">get</a></strong>(<a href="../../java/lang/Object.html" title="class in java.lang">Object</a>&nbsp;key)</code>
  378. <div class="block">Returns the value to which the specified key is mapped,
  379. or <code>null</code> if this map contains no mapping for the key.</div>
  380. </td>
  381. </tr>
  382. <tr class="rowColor">
  383. <td class="colFirst"><code><a href="../../java/util/SortedMap.html" title="interface in java.util">SortedMap</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></td>
  384. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#headMap(K)">headMap</a></strong>(<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&nbsp;toKey)</code>
  385. <div class="block">Returns a view of the portion of this map whose keys are
  386. strictly less than <code>toKey</code>.</div>
  387. </td>
  388. </tr>
  389. <tr class="altColor">
  390. <td class="colFirst"><code><a href="../../java/util/NavigableMap.html" title="interface in java.util">NavigableMap</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></td>
  391. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#headMap(K,%20boolean)">headMap</a></strong>(<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&nbsp;toKey,
  392. boolean&nbsp;inclusive)</code>
  393. <div class="block">Returns a view of the portion of this map whose keys are less than (or
  394. equal to, if <code>inclusive</code> is true) <code>toKey</code>.</div>
  395. </td>
  396. </tr>
  397. <tr class="rowColor">
  398. <td class="colFirst"><code><a href="../../java/util/Map.Entry.html" title="interface in java.util">Map.Entry</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></td>
  399. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#higherEntry(K)">higherEntry</a></strong>(<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&nbsp;key)</code>
  400. <div class="block">Returns a key-value mapping associated with the least key
  401. strictly greater than the given key, or <code>null</code> if there
  402. is no such key.</div>
  403. </td>
  404. </tr>
  405. <tr class="altColor">
  406. <td class="colFirst"><code><a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a></code></td>
  407. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#higherKey(K)">higherKey</a></strong>(<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&nbsp;key)</code>
  408. <div class="block">Returns the least key strictly greater than the given key, or
  409. <code>null</code> if there is no such key.</div>
  410. </td>
  411. </tr>
  412. <tr class="rowColor">
  413. <td class="colFirst"><code><a href="../../java/util/Set.html" title="interface in java.util">Set</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&gt;</code></td>
  414. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#keySet()">keySet</a></strong>()</code>
  415. <div class="block">Returns a <a href="../../java/util/Set.html" title="interface in java.util"><code>Set</code></a> view of the keys contained in this map.</div>
  416. </td>
  417. </tr>
  418. <tr class="altColor">
  419. <td class="colFirst"><code><a href="../../java/util/Map.Entry.html" title="interface in java.util">Map.Entry</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></td>
  420. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#lastEntry()">lastEntry</a></strong>()</code>
  421. <div class="block">Returns a key-value mapping associated with the greatest
  422. key in this map, or <code>null</code> if the map is empty.</div>
  423. </td>
  424. </tr>
  425. <tr class="rowColor">
  426. <td class="colFirst"><code><a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a></code></td>
  427. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#lastKey()">lastKey</a></strong>()</code>
  428. <div class="block">Returns the last (highest) key currently in this map.</div>
  429. </td>
  430. </tr>
  431. <tr class="altColor">
  432. <td class="colFirst"><code><a href="../../java/util/Map.Entry.html" title="interface in java.util">Map.Entry</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></td>
  433. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#lowerEntry(K)">lowerEntry</a></strong>(<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&nbsp;key)</code>
  434. <div class="block">Returns a key-value mapping associated with the greatest key
  435. strictly less than the given key, or <code>null</code> if there is
  436. no such key.</div>
  437. </td>
  438. </tr>
  439. <tr class="rowColor">
  440. <td class="colFirst"><code><a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a></code></td>
  441. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#lowerKey(K)">lowerKey</a></strong>(<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&nbsp;key)</code>
  442. <div class="block">Returns the greatest key strictly less than the given key, or
  443. <code>null</code> if there is no such key.</div>
  444. </td>
  445. </tr>
  446. <tr class="altColor">
  447. <td class="colFirst"><code><a href="../../java/util/NavigableSet.html" title="interface in java.util">NavigableSet</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&gt;</code></td>
  448. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#navigableKeySet()">navigableKeySet</a></strong>()</code>
  449. <div class="block">Returns a <a href="../../java/util/NavigableSet.html" title="interface in java.util"><code>NavigableSet</code></a> view of the keys contained in this map.</div>
  450. </td>
  451. </tr>
  452. <tr class="rowColor">
  453. <td class="colFirst"><code><a href="../../java/util/Map.Entry.html" title="interface in java.util">Map.Entry</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></td>
  454. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#pollFirstEntry()">pollFirstEntry</a></strong>()</code>
  455. <div class="block">Removes and returns a key-value mapping associated with
  456. the least key in this map, or <code>null</code> if the map is empty.</div>
  457. </td>
  458. </tr>
  459. <tr class="altColor">
  460. <td class="colFirst"><code><a href="../../java/util/Map.Entry.html" title="interface in java.util">Map.Entry</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></td>
  461. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#pollLastEntry()">pollLastEntry</a></strong>()</code>
  462. <div class="block">Removes and returns a key-value mapping associated with
  463. the greatest key in this map, or <code>null</code> if the map is empty.</div>
  464. </td>
  465. </tr>
  466. <tr class="rowColor">
  467. <td class="colFirst"><code><a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a></code></td>
  468. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#put(K,%20V)">put</a></strong>(<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&nbsp;key,
  469. <a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&nbsp;value)</code>
  470. <div class="block">Associates the specified value with the specified key in this map.</div>
  471. </td>
  472. </tr>
  473. <tr class="altColor">
  474. <td class="colFirst"><code>void</code></td>
  475. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#putAll(java.util.Map)">putAll</a></strong>(<a href="../../java/util/Map.html" title="interface in java.util">Map</a>&lt;? extends <a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,? extends <a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;&nbsp;map)</code>
  476. <div class="block">Copies all of the mappings from the specified map to this map.</div>
  477. </td>
  478. </tr>
  479. <tr class="rowColor">
  480. <td class="colFirst"><code><a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a></code></td>
  481. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#remove(java.lang.Object)">remove</a></strong>(<a href="../../java/lang/Object.html" title="class in java.lang">Object</a>&nbsp;key)</code>
  482. <div class="block">Removes the mapping for this key from this TreeMap if present.</div>
  483. </td>
  484. </tr>
  485. <tr class="altColor">
  486. <td class="colFirst"><code>int</code></td>
  487. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#size()">size</a></strong>()</code>
  488. <div class="block">Returns the number of key-value mappings in this map.</div>
  489. </td>
  490. </tr>
  491. <tr class="rowColor">
  492. <td class="colFirst"><code><a href="../../java/util/NavigableMap.html" title="interface in java.util">NavigableMap</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></td>
  493. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#subMap(K,%20boolean,%20K,%20boolean)">subMap</a></strong>(<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&nbsp;fromKey,
  494. boolean&nbsp;fromInclusive,
  495. <a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&nbsp;toKey,
  496. boolean&nbsp;toInclusive)</code>
  497. <div class="block">Returns a view of the portion of this map whose keys range from
  498. <code>fromKey</code> to <code>toKey</code>.</div>
  499. </td>
  500. </tr>
  501. <tr class="altColor">
  502. <td class="colFirst"><code><a href="../../java/util/SortedMap.html" title="interface in java.util">SortedMap</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></td>
  503. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#subMap(K,%20K)">subMap</a></strong>(<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&nbsp;fromKey,
  504. <a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&nbsp;toKey)</code>
  505. <div class="block">Returns a view of the portion of this map whose keys range from
  506. <code>fromKey</code>, inclusive, to <code>toKey</code>, exclusive.</div>
  507. </td>
  508. </tr>
  509. <tr class="rowColor">
  510. <td class="colFirst"><code><a href="../../java/util/SortedMap.html" title="interface in java.util">SortedMap</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></td>
  511. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#tailMap(K)">tailMap</a></strong>(<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&nbsp;fromKey)</code>
  512. <div class="block">Returns a view of the portion of this map whose keys are
  513. greater than or equal to <code>fromKey</code>.</div>
  514. </td>
  515. </tr>
  516. <tr class="altColor">
  517. <td class="colFirst"><code><a href="../../java/util/NavigableMap.html" title="interface in java.util">NavigableMap</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></td>
  518. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#tailMap(K,%20boolean)">tailMap</a></strong>(<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&nbsp;fromKey,
  519. boolean&nbsp;inclusive)</code>
  520. <div class="block">Returns a view of the portion of this map whose keys are greater than (or
  521. equal to, if <code>inclusive</code> is true) <code>fromKey</code>.</div>
  522. </td>
  523. </tr>
  524. <tr class="rowColor">
  525. <td class="colFirst"><code><a href="../../java/util/Collection.html" title="interface in java.util">Collection</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></td>
  526. <td class="colLast"><code><strong><a href="../../java/util/TreeMap.html#values()">values</a></strong>()</code>
  527. <div class="block">Returns a <a href="../../java/util/Collection.html" title="interface in java.util"><code>Collection</code></a> view of the values contained in this map.</div>
  528. </td>
  529. </tr>
  530. </table>
  531. <ul class="blockList">
  532. <li class="blockList"><a name="methods_inherited_from_class_java.util.AbstractMap">
  533. <!-- -->
  534. </a>
  535. <h3>Methods inherited from class&nbsp;java.util.<a href="../../java/util/AbstractMap.html" title="class in java.util">AbstractMap</a></h3>
  536. <code><a href="../../java/util/AbstractMap.html#equals(java.lang.Object)">equals</a>, <a href="../../java/util/AbstractMap.html#hashCode()">hashCode</a>, <a href="../../java/util/AbstractMap.html#isEmpty()">isEmpty</a>, <a href="../../java/util/AbstractMap.html#toString()">toString</a></code></li>
  537. </ul>
  538. <ul class="blockList">
  539. <li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
  540. <!-- -->
  541. </a>
  542. <h3>Methods inherited from class&nbsp;java.lang.<a href="../../java/lang/Object.html" title="class in java.lang">Object</a></h3>
  543. <code><a href="../../java/lang/Object.html#finalize()">finalize</a>, <a href="../../java/lang/Object.html#getClass()">getClass</a>, <a href="../../java/lang/Object.html#notify()">notify</a>, <a href="../../java/lang/Object.html#notifyAll()">notifyAll</a>, <a href="../../java/lang/Object.html#wait()">wait</a>, <a href="../../java/lang/Object.html#wait(long)">wait</a>, <a href="../../java/lang/Object.html#wait(long,%20int)">wait</a></code></li>
  544. </ul>
  545. <ul class="blockList">
  546. <li class="blockList"><a name="methods_inherited_from_class_java.util.Map">
  547. <!-- -->
  548. </a>
  549. <h3>Methods inherited from interface&nbsp;java.util.<a href="../../java/util/Map.html" title="interface in java.util">Map</a></h3>
  550. <code><a href="../../java/util/Map.html#equals(java.lang.Object)">equals</a>, <a href="../../java/util/Map.html#hashCode()">hashCode</a>, <a href="../../java/util/Map.html#isEmpty()">isEmpty</a></code></li>
  551. </ul>
  552. </li>
  553. </ul>
  554. </li>
  555. </ul>
  556. </div>
  557. <div class="details">
  558. <ul class="blockList">
  559. <li class="blockList">
  560. <!-- ========= CONSTRUCTOR DETAIL ======== -->
  561. <ul class="blockList">
  562. <li class="blockList"><a name="constructor_detail">
  563. <!-- -->
  564. </a>
  565. <h3>Constructor Detail</h3>
  566. <a name="TreeMap()">
  567. <!-- -->
  568. </a>
  569. <ul class="blockList">
  570. <li class="blockList">
  571. <h4>TreeMap</h4>
  572. <pre>public&nbsp;TreeMap()</pre>
  573. <div class="block">Constructs a new, empty tree map, using the natural ordering of its
  574. keys. All keys inserted into the map must implement the <a href="../../java/lang/Comparable.html" title="interface in java.lang"><code>Comparable</code></a> interface. Furthermore, all such keys must be
  575. <em>mutually comparable</em>: <code>k1.compareTo(k2)</code> must not throw
  576. a <code>ClassCastException</code> for any keys <code>k1</code> and
  577. <code>k2</code> in the map. If the user attempts to put a key into the
  578. map that violates this constraint (for example, the user attempts to
  579. put a string key into a map whose keys are integers), the
  580. <code>put(Object key, Object value)</code> call will throw a
  581. <code>ClassCastException</code>.</div>
  582. </li>
  583. </ul>
  584. <a name="TreeMap(java.util.Comparator)">
  585. <!-- -->
  586. </a>
  587. <ul class="blockList">
  588. <li class="blockList">
  589. <h4>TreeMap</h4>
  590. <pre>public&nbsp;TreeMap(<a href="../../java/util/Comparator.html" title="interface in java.util">Comparator</a>&lt;? super <a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>&gt;&nbsp;comparator)</pre>
  591. <div class="block">Constructs a new, empty tree map, ordered according to the given
  592. comparator. All keys inserted into the map must be <em>mutually
  593. comparable</em> by the given comparator: <code>comparator.compare(k1,
  594. k2)</code> must not throw a <code>ClassCastException</code> for any keys
  595. <code>k1</code> and <code>k2</code> in the map. If the user attempts to put
  596. a key into the map that violates this constraint, the <code>put(Object
  597. key, Object value)</code> call will throw a
  598. <code>ClassCastException</code>.</div>
  599. <dl><dt><span class="strong">Parameters:</span></dt><dd><code>comparator</code> - the comparator that will be used to order this map.
  600. If <code>null</code>, the <a href="../../java/lang/Comparable.html" title="interface in java.lang">natural
  601. ordering</a> of the keys will be used.</dd></dl>
  602. </li>
  603. </ul>
  604. <a name="TreeMap(java.util.Map)">
  605. <!-- -->
  606. </a>
  607. <ul class="blockList">
  608. <li class="blockList">
  609. <h4>TreeMap</h4>
  610. <pre>public&nbsp;TreeMap(<a href="../../java/util/Map.html" title="interface in java.util">Map</a>&lt;? extends <a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,? extends <a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;&nbsp;m)</pre>
  611. <div class="block">Constructs a new tree map containing the same mappings as the given
  612. map, ordered according to the <em>natural ordering</em> of its keys.
  613. All keys inserted into the new map must implement the <a href="../../java/lang/Comparable.html" title="interface in java.lang"><code>Comparable</code></a> interface. Furthermore, all such keys must be
  614. <em>mutually comparable</em>: <code>k1.compareTo(k2)</code> must not throw
  615. a <code>ClassCastException</code> for any keys <code>k1</code> and
  616. <code>k2</code> in the map. This method runs in n*log(n) time.</div>
  617. <dl><dt><span class="strong">Parameters:</span></dt><dd><code>m</code> - the map whose mappings are to be placed in this map</dd>
  618. <dt><span class="strong">Throws:</span></dt>
  619. <dd><code><a href="../../java/lang/ClassCastException.html" title="class in java.lang">ClassCastException</a></code> - if the keys in m are not <a href="../../java/lang/Comparable.html" title="interface in java.lang"><code>Comparable</code></a>,
  620. or are not mutually comparable</dd>
  621. <dd><code><a href="../../java/lang/NullPointerException.html" title="class in java.lang">NullPointerException</a></code> - if the specified map is null</dd></dl>
  622. </li>
  623. </ul>
  624. <a name="TreeMap(java.util.SortedMap)">
  625. <!-- -->
  626. </a>
  627. <ul class="blockListLast">
  628. <li class="blockList">
  629. <h4>TreeMap</h4>
  630. <pre>public&nbsp;TreeMap(<a href="../../java/util/SortedMap.html" title="interface in java.util">SortedMap</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,? extends <a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;&nbsp;m)</pre>
  631. <div class="block">Constructs a new tree map containing the same mappings and
  632. using the same ordering as the specified sorted map. This
  633. method runs in linear time.</div>
  634. <dl><dt><span class="strong">Parameters:</span></dt><dd><code>m</code> - the sorted map whose mappings are to be placed in this map,
  635. and whose comparator is to be used to sort this map</dd>
  636. <dt><span class="strong">Throws:</span></dt>
  637. <dd><code><a href="../../java/lang/NullPointerException.html" title="class in java.lang">NullPointerException</a></code> - if the specified map is null</dd></dl>
  638. </li>
  639. </ul>
  640. </li>
  641. </ul>
  642. <!-- ============ METHOD DETAIL ========== -->
  643. <ul class="blockList">
  644. <li class="blockList"><a name="method_detail">
  645. <!-- -->
  646. </a>
  647. <h3>Method Detail</h3>
  648. <a name="size()">
  649. <!-- -->
  650. </a>
  651. <ul class="blockList">
  652. <li class="blockList">
  653. <h4>size</h4>
  654. <pre>public&nbsp;int&nbsp;size()</pre>
  655. <div class="block">Returns the number of key-value mappings in this map.</div>
  656. <dl>
  657. <dt><strong>Specified by:</strong></dt>
  658. <dd><code><a href="../../java/util/Map.html#size()">size</a></code>&nbsp;in interface&nbsp;<code><a href="../../java/util/Map.html" title="interface in java.util">Map</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></dd>
  659. <dt><strong>Overrides:</strong></dt>
  660. <dd><code><a href="../../java/util/AbstractMap.html#size()">size</a></code>&nbsp;in class&nbsp;<code><a href="../../java/util/AbstractMap.html" title="class in java.util">AbstractMap</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></dd>
  661. <dt><span class="strong">Returns:</span></dt><dd>the number of key-value mappings in this map</dd></dl>
  662. </li>
  663. </ul>
  664. <a name="containsKey(java.lang.Object)">
  665. <!-- -->
  666. </a>
  667. <ul class="blockList">
  668. <li class="blockList">
  669. <h4>containsKey</h4>
  670. <pre>public&nbsp;boolean&nbsp;containsKey(<a href="../../java/lang/Object.html" title="class in java.lang">Object</a>&nbsp;key)</pre>
  671. <div class="block">Returns <code>true</code> if this map contains a mapping for the specified
  672. key.</div>
  673. <dl>
  674. <dt><strong>Specified by:</strong></dt>
  675. <dd><code><a href="../../java/util/Map.html#containsKey(java.lang.Object)">containsKey</a></code>&nbsp;in interface&nbsp;<code><a href="../../java/util/Map.html" title="interface in java.util">Map</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></dd>
  676. <dt><strong>Overrides:</strong></dt>
  677. <dd><code><a href="../../java/util/AbstractMap.html#containsKey(java.lang.Object)">containsKey</a></code>&nbsp;in class&nbsp;<code><a href="../../java/util/AbstractMap.html" title="class in java.util">AbstractMap</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></dd>
  678. <dt><span class="strong">Parameters:</span></dt><dd><code>key</code> - key whose presence in this map is to be tested</dd>
  679. <dt><span class="strong">Returns:</span></dt><dd><code>true</code> if this map contains a mapping for the
  680. specified key</dd>
  681. <dt><span class="strong">Throws:</span></dt>
  682. <dd><code><a href="../../java/lang/ClassCastException.html" title="class in java.lang">ClassCastException</a></code> - if the specified key cannot be compared
  683. with the keys currently in the map</dd>
  684. <dd><code><a href="../../java/lang/NullPointerException.html" title="class in java.lang">NullPointerException</a></code> - if the specified key is null
  685. and this map uses natural ordering, or its comparator
  686. does not permit null keys</dd></dl>
  687. </li>
  688. </ul>
  689. <a name="containsValue(java.lang.Object)">
  690. <!-- -->
  691. </a>
  692. <ul class="blockList">
  693. <li class="blockList">
  694. <h4>containsValue</h4>
  695. <pre>public&nbsp;boolean&nbsp;containsValue(<a href="../../java/lang/Object.html" title="class in java.lang">Object</a>&nbsp;value)</pre>
  696. <div class="block">Returns <code>true</code> if this map maps one or more keys to the
  697. specified value. More formally, returns <code>true</code> if and only if
  698. this map contains at least one mapping to a value <code>v</code> such
  699. that <code>(value==null ? v==null : value.equals(v))</code>. This
  700. operation will probably require time linear in the map size for
  701. most implementations.</div>
  702. <dl>
  703. <dt><strong>Specified by:</strong></dt>
  704. <dd><code><a href="../../java/util/Map.html#containsValue(java.lang.Object)">containsValue</a></code>&nbsp;in interface&nbsp;<code><a href="../../java/util/Map.html" title="interface in java.util">Map</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></dd>
  705. <dt><strong>Overrides:</strong></dt>
  706. <dd><code><a href="../../java/util/AbstractMap.html#containsValue(java.lang.Object)">containsValue</a></code>&nbsp;in class&nbsp;<code><a href="../../java/util/AbstractMap.html" title="class in java.util">AbstractMap</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></dd>
  707. <dt><span class="strong">Parameters:</span></dt><dd><code>value</code> - value whose presence in this map is to be tested</dd>
  708. <dt><span class="strong">Returns:</span></dt><dd><code>true</code> if a mapping to <code>value</code> exists;
  709. <code>false</code> otherwise</dd><dt><span class="strong">Since:</span></dt>
  710. <dd>1.2</dd></dl>
  711. </li>
  712. </ul>
  713. <a name="get(java.lang.Object)">
  714. <!-- -->
  715. </a>
  716. <ul class="blockList">
  717. <li class="blockList">
  718. <h4>get</h4>
  719. <pre>public&nbsp;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&nbsp;get(<a href="../../java/lang/Object.html" title="class in java.lang">Object</a>&nbsp;key)</pre>
  720. <div class="block">Returns the value to which the specified key is mapped,
  721. or <code>null</code> if this map contains no mapping for the key.
  722. <p>More formally, if this map contains a mapping from a key
  723. <code>k</code> to a value <code>v</code> such that <code>key</code> compares
  724. equal to <code>k</code> according to the map's ordering, then this
  725. method returns <code>v</code>; otherwise it returns <code>null</code>.
  726. (There can be at most one such mapping.)
  727. <p>A return value of <code>null</code> does not <em>necessarily</em>
  728. indicate that the map contains no mapping for the key; it's also
  729. possible that the map explicitly maps the key to <code>null</code>.
  730. The <a href="../../java/util/TreeMap.html#containsKey(java.lang.Object)"><code>containsKey</code></a> operation may be used to
  731. distinguish these two cases.</div>
  732. <dl>
  733. <dt><strong>Specified by:</strong></dt>
  734. <dd><code><a href="../../java/util/Map.html#get(java.lang.Object)">get</a></code>&nbsp;in interface&nbsp;<code><a href="../../java/util/Map.html" title="interface in java.util">Map</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></dd>
  735. <dt><strong>Overrides:</strong></dt>
  736. <dd><code><a href="../../java/util/AbstractMap.html#get(java.lang.Object)">get</a></code>&nbsp;in class&nbsp;<code><a href="../../java/util/AbstractMap.html" title="class in java.util">AbstractMap</a>&lt;<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">K</a>,<a href="../../java/util/TreeMap.html" title="type parameter in TreeMap">V</a>&gt;</code></dd>
  737. <dt><span class="strong">Parameters:</span></dt><dd><code>key</code> - the key whose associated value is to be returned</dd>
  738. <dt><span class="strong">Returns:</span></dt><dd>the value to which the specified key is mapped, or
  739. <code>null</code> if this map contains no mapping for the key</dd>
  740. <dt><span class="strong">Throws:</span></dt>
  741. <dd><code><a href="../../java/lang/ClassCastException.html" title="class in java.lang">ClassCastException</a></code> - if the specified key cannot be compared
  742. with the keys currently in the map</dd>
  743. <dd><code><a href="../../java/lang/NullPointerException.html" title="class in java.lang">NullPointerException</a></code> - if the specified key is nul

Large files files are truncated, but you can click here to view the full file