📄 sortedmap.html
字号:
<TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="comparator()"><!-- --></A><H3>comparator</H3><PRE>public <A HREF="../../java/util/Comparator.html">Comparator</A> <B>comparator</B>()</PRE><DL><DD>Returns the comparator associated with this sorted map, or <tt>null</tt> if it uses its keys' natural ordering.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the comparator associated with this sorted map, or <tt>null</tt> if it uses its keys' natural ordering.</DL></DD></DL><HR><A NAME="subMap(java.lang.Object, java.lang.Object)"><!-- --></A><H3>subMap</H3><PRE>public <A HREF="../../java/util/SortedMap.html">SortedMap</A> <B>subMap</B>(<A HREF="../../java/lang/Object.html">Object</A> fromKey, <A HREF="../../java/lang/Object.html">Object</A> toKey)</PRE><DL><DD>Returns a view of the portion of this sorted map whose keys range from <tt>fromKey</tt>, inclusive, to <tt>toKey</tt>, exclusive. (If <tt>fromKey</tt> and <tt>toKey</tt> are equal, the returned sorted map is empty.) The returned sorted map is backed by this sorted map, so changes in the returned sorted map are reflected in this sorted map, and vice-versa. The returned Map supports all optional map operations that this sorted map supports.<p> The map returned by this method will throw an <tt>IllegalArgumentException</tt> if the user attempts to insert a key outside the specified range.<p> Note: this method always returns a <i>half-open range</i> (which includes its low endpoint but not its high endpoint). If you need a <i>closed range</i> (which includes both endpoints), and the key type allows for calculation of the successor a given key, merely request the subrange from <tt>lowEndpoint</tt> to <tt>successor(highEndpoint)</tt>. For example, suppose that <tt>m</tt> is a map whose keys are strings. The following idiom obtains a view containing all of the key-value mappings in <tt>m</tt> whose keys are between <tt>low</tt> and <tt>high</tt>, inclusive: <pre> Map sub = m.subMap(low, high+"\0");</pre> A similarly technique can be used to generate an <i>open range</i> (which contains neither endpoint). The following idiom obtains a view containing all of the key-value mappings in <tt>m</tt> whose keys are between <tt>low</tt> and <tt>high</tt>, exclusive: <pre> Map sub = m.subMap(low+"\0", high);</pre><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>fromKey</CODE> - low endpoint (inclusive) of the subMap.<DD><CODE>toKey</CODE> - high endpoint (exclusive) of the subMap.<DT><B>Returns:</B><DD>a view of the specified range within this sorted map.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if <tt>fromKey</tt> and <tt>toKey</tt> cannot be compared to one another using this map's comparator (or, if the map has no comparator, using natural ordering). Implementations may, but are not required to, throw this exception if <tt>fromKey</tt> or <tt>toKey</tt> cannot be compared to keys currently in the map.<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if <tt>fromKey</tt> is greater than <tt>toKey</tt>; or if this map is itself a subMap, headMap, or tailMap, and <tt>fromKey</tt> or <tt>toKey</tt> are not within the specified range of the subMap, headMap, or tailMap.<DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <tt>fromKey</tt> or <tt>toKey</tt> is <tt>null</tt> and this sorted map does not tolerate <tt>null</tt> keys.</DL></DD></DL><HR><A NAME="headMap(java.lang.Object)"><!-- --></A><H3>headMap</H3><PRE>public <A HREF="../../java/util/SortedMap.html">SortedMap</A> <B>headMap</B>(<A HREF="../../java/lang/Object.html">Object</A> toKey)</PRE><DL><DD>Returns a view of the portion of this sorted map whose keys are strictly less than toKey. The returned sorted map is backed by this sorted map, so changes in the returned sorted map are reflected in this sorted map, and vice-versa. The returned map supports all optional map operations that this sorted map supports.<p> The map returned by this method will throw an IllegalArgumentException if the user attempts to insert a key outside the specified range.<p> Note: this method always returns a view that does not contain its (high) endpoint. If you need a view that does contain this endpoint, and the key type allows for calculation of the successor a given key, merely request a headMap bounded by successor(highEndpoint). For example, suppose that suppose that <tt>m</tt> is a map whose keys are strings. The following idiom obtains a view containing all of the key-value mappings in <tt>m</tt> whose keys are less than or equal to <tt>high</tt>: <pre> Map head = m.headMap(high+"\0");</pre><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>toKey</CODE> - high endpoint (exclusive) of the subMap.<DT><B>Returns:</B><DD>a view of the specified initial range of this sorted map.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if <tt>toKey</tt> is not compatible with this map's comparator (or, if the map has no comparator, if <tt>toKey</tt> does not implement <tt>Comparable</tt>). Implementations may, but are not required to, throw this exception if <tt>toKey</tt> cannot be compared to keys currently in the map.<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if this map is itself a subMap, headMap, or tailMap, and <tt>toKey</tt> is not within the specified range of the subMap, headMap, or tailMap.<DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <tt>toKey</tt> is <tt>null</tt> and this sorted map does not tolerate <tt>null</tt> keys.</DL></DD></DL><HR><A NAME="tailMap(java.lang.Object)"><!-- --></A><H3>tailMap</H3><PRE>public <A HREF="../../java/util/SortedMap.html">SortedMap</A> <B>tailMap</B>(<A HREF="../../java/lang/Object.html">Object</A> fromKey)</PRE><DL><DD>Returns a view of the portion of this sorted map whose keys are greater than or equal to <tt>fromKey</tt>. The returned sorted map is backed by this sorted map, so changes in the returned sorted map are reflected in this sorted map, and vice-versa. The returned map supports all optional map operations that this sorted map supports.<p> The map returned by this method will throw an <tt>IllegalArgumentException</tt> if the user attempts to insert a key outside the specified range.<p> Note: this method always returns a view that contains its (low) endpoint. If you need a view that does not contain this endpoint, and the element type allows for calculation of the successor a given value, merely request a tailMap bounded by <tt>successor(lowEndpoint)</tt>. For example, suppose that suppose that <tt>m</tt> is a map whose keys are strings. The following idiom obtains a view containing all of the key-value mappings in <tt>m</tt> whose keys are strictly greater than <tt>low</tt>: <pre> Map tail = m.tailMap(low+"\0");</pre><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>fromKey</CODE> - low endpoint (inclusive) of the tailMap.<DT><B>Returns:</B><DD>a view of the specified final range of this sorted map.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if <tt>fromKey</tt> is not compatible with this map's comparator (or, if the map has no comparator, if <tt>fromKey</tt> does not implement <tt>Comparable</tt>). Implementations may, but are not required to, throw this exception if <tt>fromKey</tt> cannot be compared to keys currently in the map.<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if this map is itself a subMap, headMap, or tailMap, and <tt>fromKey</tt> is not within the specified range of the subMap, headMap, or tailMap.<DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <tt>fromKey</tt> is <tt>null</tt> and this sorted map does not tolerate <tt>null</tt> keys.</DL></DD></DL><HR><A NAME="firstKey()"><!-- --></A><H3>firstKey</H3><PRE>public <A HREF="../../java/lang/Object.html">Object</A> <B>firstKey</B>()</PRE><DL><DD>Returns the first (lowest) key currently in this sorted map.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the first (lowest) key currently in this sorted map.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/util/NoSuchElementException.html">NoSuchElementException</A></CODE> - if this map is empty.</DL></DD></DL><HR><A NAME="lastKey()"><!-- --></A><H3>lastKey</H3><PRE>public <A HREF="../../java/lang/Object.html">Object</A> <B>lastKey</B>()</PRE><DL><DD>Returns the last (highest) key currently in this sorted map.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the last (highest) key currently in this sorted map.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/util/NoSuchElementException.html">NoSuchElementException</A></CODE> - if this map is empty.</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SortedMap.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../java/util/Set.html"><B>PREV CLASS</B></A> <A HREF="../../java/util/SortedSet.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="SortedMap.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -