📄 treeset.html
字号:
<DD>Removes all of the elements from this set.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Set.html#clear()">clear</A></CODE> in interface <CODE><A HREF="../../java/util/Set.html">Set</A></CODE><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/util/AbstractCollection.html#clear()">clear</A></CODE> in class <CODE><A HREF="../../java/util/AbstractCollection.html">AbstractCollection</A></CODE></DL></DD><DD>Following copied from interface: <CODE>java.util.Set</CODE></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/UnsupportedOperationException.html">UnsupportedOperationException</A></CODE> - if the <tt>clear</tt> method is not supported by this set.</DL></DD></DL><HR><A NAME="addAll(java.util.Collection)"><!-- --></A><H3>addAll</H3><PRE>public boolean <B>addAll</B>(<A HREF="../../java/util/Collection.html">Collection</A> c)</PRE><DL><DD>Adds all of the elements in the specified collection to this set.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Set.html#addAll(java.util.Collection)">addAll</A></CODE> in interface <CODE><A HREF="../../java/util/Set.html">Set</A></CODE><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/util/AbstractCollection.html#addAll(java.util.Collection)">addAll</A></CODE> in class <CODE><A HREF="../../java/util/AbstractCollection.html">AbstractCollection</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>c</CODE> - elements to be added<DT><B>Returns:</B><DD><tt>true</tt> if this set changed as a result of the call.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if the elements provided cannot be compared with the elements currently in the set.</DL></DD></DL><HR><A NAME="subSet(java.lang.Object, java.lang.Object)"><!-- --></A><H3>subSet</H3><PRE>public <A HREF="../../java/util/SortedSet.html">SortedSet</A> <B>subSet</B>(<A HREF="../../java/lang/Object.html">Object</A> fromElement, <A HREF="../../java/lang/Object.html">Object</A> toElement)</PRE><DL><DD>Returns a view of the portion of this set whose elements range from <tt>fromElement</tt>, inclusive, to <tt>toElement</tt>, exclusive. (If <tt>fromElement</tt> and <tt>toElement</tt> are equal, the returned sorted set is empty.) The returned sorted set is backed by this set, so changes in the returned sorted set are reflected in this set, and vice-versa. The returned sorted set supports all optional Set operations.<p> The sorted set returned by this method will throw an <tt>IllegalArgumentException</tt> if the user attempts to insert an element 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 element type allows for calculation of the successor a given value, merely request the subrange from <tt>lowEndpoint</tt> to <tt>successor(highEndpoint)</tt>. For example, suppose that <tt>s</tt> is a sorted set of strings. The following idiom obtains a view containing all of the strings in <tt>s</tt> from <tt>low</tt> to <tt>high</tt>, inclusive: <pre> SortedSet sub = s.subSet(low, high+"\0"); </pre> A similar 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 strings in <tt>s</tt> from <tt>low</tt> to <tt>high</tt>, exclusive: <pre> SortedSet sub = s.subSet(low+"\0", high); </pre><DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/SortedSet.html#subSet(java.lang.Object, java.lang.Object)">subSet</A></CODE> in interface <CODE><A HREF="../../java/util/SortedSet.html">SortedSet</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>fromElement</CODE> - low endpoint (inclusive) of the subSet.<DD><CODE>toElement</CODE> - high endpoint (exclusive) of the subSet.<DT><B>Returns:</B><DD>a view of the portion of this set whose elements range from <tt>fromElement</tt>, inclusive, to <tt>toElement</tt>, exclusive.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if <tt>fromElement</tt> and <tt>toElement</tt> cannot be compared to one another using this set's comparator (or, if the set has no comparator, using natural ordering).<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if <tt>fromElement</tt> is greater than <tt>toElement</tt>.<DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <tt>fromElement</tt> or <tt>toElement</tt> is <tt>null</tt> and this set uses natural order, or its comparator does not tolerate <tt>null</tt> elements.</DL></DD></DL><HR><A NAME="headSet(java.lang.Object)"><!-- --></A><H3>headSet</H3><PRE>public <A HREF="../../java/util/SortedSet.html">SortedSet</A> <B>headSet</B>(<A HREF="../../java/lang/Object.html">Object</A> toElement)</PRE><DL><DD>Returns a view of the portion of this set whose elements are strictly less than <tt>toElement</tt>. The returned sorted set is backed by this set, so changes in the returned sorted set are reflected in this set, and vice-versa. The returned sorted set supports all optional set operations.<p> The sorted set returned by this method will throw an <tt>IllegalArgumentException</tt> if the user attempts to insert an element greater than or equal to <tt>toElement</tt>.<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 element type allows for calculation of the successor a given value, merely request a headSet bounded by <tt>successor(highEndpoint)</tt>. For example, suppose that <tt>s</tt> is a sorted set of strings. The following idiom obtains a view containing all of the strings in <tt>s</tt> that are less than or equal to <tt>high</tt>: <pre> SortedSet head = s.headSet(high+"\0");</pre><DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/SortedSet.html#headSet(java.lang.Object)">headSet</A></CODE> in interface <CODE><A HREF="../../java/util/SortedSet.html">SortedSet</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>toElement</CODE> - high endpoint (exclusive) of the headSet.<DT><B>Returns:</B><DD>a view of the portion of this set whose elements are strictly less than toElement.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if <tt>toElement</tt> is not compatible with this set's comparator (or, if the set has no comparator, if <tt>toElement</tt> does not implement <tt>Comparable</tt>).<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if this set is itself a subSet, headSet, or tailSet, and <tt>toElement</tt> is not within the specified range of the subSet, headSet, or tailSet.<DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <tt>toElement</tt> is <tt>null</tt> and this set uses natural ordering, or its comparator does not tolerate <tt>null</tt> elements.</DL></DD></DL><HR><A NAME="tailSet(java.lang.Object)"><!-- --></A><H3>tailSet</H3><PRE>public <A HREF="../../java/util/SortedSet.html">SortedSet</A> <B>tailSet</B>(<A HREF="../../java/lang/Object.html">Object</A> fromElement)</PRE><DL><DD>Returns a view of the portion of this set whose elements are greater than or equal to <tt>fromElement</tt>. The returned sorted set is backed by this set, so changes in the returned sorted set are reflected in this set, and vice-versa. The returned sorted set supports all optional set operations.<p> The sorted set returned by this method will throw an <tt>IllegalArgumentException</tt> if the user attempts to insert an element less than <tt>fromElement</tt>. 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 tailSet bounded by <tt>successor(lowEndpoint)</tt>. For example, suppose that <tt>s</tt> is a sorted set of strings. The following idiom obtains a view containing all of the strings in <tt>s</tt> that are strictly greater than <tt>low</tt>: <pre> SortedSet tail = s.tailSet(low+"\0"); </pre><DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/SortedSet.html#tailSet(java.lang.Object)">tailSet</A></CODE> in interface <CODE><A HREF="../../java/util/SortedSet.html">SortedSet</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>fromElement</CODE> - low endpoint (inclusive) of the tailSet.<DT><B>Returns:</B><DD>a view of the portion of this set whose elements are greater than or equal to <tt>fromElement</tt>.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if <tt>fromElement</tt> is not compatible with this set's comparator (or, if the set has no comparator, if <tt>fromElement</tt> does not implement <tt>Comparable</tt>).<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if this set is itself a subSet, headSet, or tailSet, and <tt>fromElement</tt> is not within the specified range of the subSet, headSet, or tailSet.<DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <tt>fromElement</tt> is <tt>null</tt> and this set uses natural ordering, or its comparator does not tolerate <tt>null</tt> elements.</DL></DD></DL><HR><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 used to order this sorted set, or <tt>null</tt> if this tree set uses its elements natural ordering.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/SortedSet.html#comparator()">comparator</A></CODE> in interface <CODE><A HREF="../../java/util/SortedSet.html">SortedSet</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the comparator used to order this sorted set, or <tt>null</tt> if this tree set uses its elements natural ordering.</DL></DD></DL><HR><A NAME="first()"><!-- --></A><H3>first</H3><PRE>public <A HREF="../../java/lang/Object.html">Object</A> <B>first</B>()</PRE><DL><DD>Returns the first (lowest) element currently in this sorted set.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/SortedSet.html#first()">first</A></CODE> in interface <CODE><A HREF="../../java/util/SortedSet.html">SortedSet</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the first (lowest) element currently in this sorted set.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/util/NoSuchElementException.html">NoSuchElementException</A></CODE> - sorted set is empty.</DL></DD></DL><HR><A NAME="last()"><!-- --></A><H3>last</H3><PRE>public <A HREF="../../java/lang/Object.html">Object</A> <B>last</B>()</PRE><DL><DD>Returns the last (highest) element currently in this sorted set.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/SortedSet.html#last()">last</A></CODE> in interface <CODE><A HREF="../../java/util/SortedSet.html">SortedSet</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the last (highest) element currently in this sorted set.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/util/NoSuchElementException.html">NoSuchElementException</A></CODE> - sorted set is empty.</DL></DD></DL><HR><A NAME="clone()"><!-- --></A><H3>clone</H3><PRE>public <A HREF="../../java/lang/Object.html">Object</A> <B>clone</B>()</PRE><DL><DD>Returns a shallow copy of this <tt>TreeSet</tt> instance. (The elements themselves are not cloned.)<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#clone()">clone</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>a shallow copy of this set.</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/TreeSet.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/TreeMap.html"><B>PREV CLASS</B></A> <A HREF="../../java/util/Vector.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="TreeSet.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <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 + -