set.html

来自「API資料大全」· HTML 代码 · 共 612 行 · 第 1/3 页

HTML
612 行
字号
<DD>Removes the specified element from this set if it is present (optional operation).  More formally, removes an element <code>e</code> such that <code>(o==null ?  e==null : o.equals(e))</code>, if the set contains such an element.  Returns <tt>true</tt> if the set contained the specified element (or equivalently, if the set changed as a result of the call).  (The set will not contain the specified element once the call returns.)<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Collection.html#remove(java.lang.Object)">remove</A></CODE> in interface <CODE><A HREF="../../java/util/Collection.html">Collection</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>o</CODE> - object to be removed from this set, if present.<DT><B>Returns:</B><DD>true if the set contained the specified element.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/UnsupportedOperationException.html">UnsupportedOperationException</A></CODE> - if the <tt>remove</tt> method is         not supported by this set.</DL></DD></DL><HR><A NAME="containsAll(java.util.Collection)"><!-- --></A><H3>containsAll</H3><PRE>public boolean <B>containsAll</B>(<A HREF="../../java/util/Collection.html">Collection</A>&nbsp;c)</PRE><DL><DD>Returns <tt>true</tt> if this set contains all of the elements of the specified collection.  If the specified collection is also a set, this method returns <tt>true</tt> if it is a <i>subset</i> of this set.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Collection.html#containsAll(java.util.Collection)">containsAll</A></CODE> in interface <CODE><A HREF="../../java/util/Collection.html">Collection</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>c</CODE> - collection to be checked for containment in this set.<DT><B>Returns:</B><DD><tt>true</tt> if this set contains all of the elements of the 	       specified collection.</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>&nbsp;c)</PRE><DL><DD>Adds all of the elements in the specified collection to this set if they're not already present (optional operation).  If the specified collection is also a set, the <tt>addAll</tt> operation effectively modifies this set so that its value is the <i>union</i> of the two sets.  The behavior of this operation is unspecified if the specified collection is modified while the operation is in progress.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Collection.html#addAll(java.util.Collection)">addAll</A></CODE> in interface <CODE><A HREF="../../java/util/Collection.html">Collection</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>c</CODE> - collection whose elements are to be added to this set.<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/UnsupportedOperationException.html">UnsupportedOperationException</A></CODE> - if the <tt>addAll</tt> method is 		  not supported by this set.<DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if the class of some element of the 		  specified collection prevents it from being added to this 		  set.<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if some aspect of some element of the		  specified collection prevents it from being added to this		  set.<DT><B>See Also: </B><DD><A HREF="../../java/util/Set.html#add(java.lang.Object)"><CODE>add(Object)</CODE></A></DL></DD></DL><HR><A NAME="retainAll(java.util.Collection)"><!-- --></A><H3>retainAll</H3><PRE>public boolean <B>retainAll</B>(<A HREF="../../java/util/Collection.html">Collection</A>&nbsp;c)</PRE><DL><DD>Retains only the elements in this set that are contained in the specified collection (optional operation).  In other words, removes from this set all of its elements that are not contained in the specified collection.  If the specified collection is also a set, this operation effectively modifies this set so that its value is the <i>intersection</i> of the two sets.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Collection.html#retainAll(java.util.Collection)">retainAll</A></CODE> in interface <CODE><A HREF="../../java/util/Collection.html">Collection</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>c</CODE> - collection that defines which elements this set will retain.<DT><B>Returns:</B><DD><tt>true</tt> if this collection changed as a result of the         call.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/UnsupportedOperationException.html">UnsupportedOperationException</A></CODE> - if the <tt>retainAll</tt> method 		  is not supported by this Collection.<DT><B>See Also: </B><DD><A HREF="../../java/util/Set.html#remove(java.lang.Object)"><CODE>remove(Object)</CODE></A></DL></DD></DL><HR><A NAME="removeAll(java.util.Collection)"><!-- --></A><H3>removeAll</H3><PRE>public boolean <B>removeAll</B>(<A HREF="../../java/util/Collection.html">Collection</A>&nbsp;c)</PRE><DL><DD>Removes from this set all of its elements that are contained in the specified collection (optional operation).  If the specified collection is also a set, this operation effectively modifies this set so that its value is the <i>asymmetric set difference</i> of the two sets.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Collection.html#removeAll(java.util.Collection)">removeAll</A></CODE> in interface <CODE><A HREF="../../java/util/Collection.html">Collection</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>c</CODE> - collection that defines which elements will be removed from          this set.<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/UnsupportedOperationException.html">UnsupportedOperationException</A></CODE> - if the <tt>removeAll</tt> 		  method is not supported by this Collection.<DT><B>See Also: </B><DD><A HREF="../../java/util/Set.html#remove(java.lang.Object)"><CODE>remove(Object)</CODE></A></DL></DD></DL><HR><A NAME="clear()"><!-- --></A><H3>clear</H3><PRE>public void <B>clear</B>()</PRE><DL><DD>Removes all of the elements from this set (optional operation). This set will be empty after this call returns (unless it throws an exception).<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Collection.html#clear()">clear</A></CODE> in interface <CODE><A HREF="../../java/util/Collection.html">Collection</A></CODE></DL></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="equals(java.lang.Object)"><!-- --></A><H3>equals</H3><PRE>public boolean <B>equals</B>(<A HREF="../../java/lang/Object.html">Object</A>&nbsp;o)</PRE><DL><DD>Compares the specified object with this set for equality.  Returns <tt>true</tt> if the specified object is also a set, the two sets have the same size, and every member of the specified set is contained in this set (or equivalently, every member of this set is contained in the specified set).  This definition ensures that the equals method works properly across different implementations of the set interface.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Collection.html#equals(java.lang.Object)">equals</A></CODE> in interface <CODE><A HREF="../../java/util/Collection.html">Collection</A></CODE><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>o</CODE> - Object to be compared for equality with this set.<DT><B>Returns:</B><DD><tt>true</tt> if the specified Object is equal to this set.</DL></DD></DL><HR><A NAME="hashCode()"><!-- --></A><H3>hashCode</H3><PRE>public int <B>hashCode</B>()</PRE><DL><DD>Returns the hash code value for this set.  The hash code of a set is defined to be the sum of the hash codes of the elements in the set, where the hashcode of a <tt>null</tt> element is defined to be zero. This ensures that <code>s1.equals(s2)</code> implies that <code>s1.hashCode()==s2.hashCode()</code> for any two sets <code>s1</code> and <code>s2</code>, as required by the general contract of the <tt>Object.hashCode</tt> method.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Collection.html#hashCode()">hashCode</A></CODE> in interface <CODE><A HREF="../../java/util/Collection.html">Collection</A></CODE><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#hashCode()">hashCode</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the hash code value for this set.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Object.html#hashCode()"><CODE>Object.hashCode()</CODE></A>, <A HREF="../../java/lang/Object.html#equals(java.lang.Object)"><CODE>Object.equals(Object)</CODE></A>, <A HREF="../../java/util/Set.html#equals(java.lang.Object)"><CODE>equals(Object)</CODE></A></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>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Set.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../java/util/Observer.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../java/util/SortedMap.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>  &nbsp;&nbsp;<A HREF="Set.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<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 + =
减小字号Ctrl + -
显示快捷键?