⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 collection.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 3 页
字号:
</DD></DL><HR><A NAME="remove(java.lang.Object)"><!-- --></A><H3>remove</H3><PRE>public boolean <B>remove</B>(<A HREF="../../java/lang/Object.html">Object</A>&nbsp;o)</PRE><DL><DD>Removes a single instance of the specified element from this collection, if it is present (optional operation).  More formally, removes an element <tt>e</tt> such that <tt>(o==null ?  e==null : o.equals(e))</tt>, if this collection contains one or more such elements.  Returns true if this collection contained the specified element (or equivalently, if this collection changed as a result of the call).<DD><DL><DT><B>Parameters:</B><DD><CODE>o</CODE> - element to be removed from this collection, if present.<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> - remove is not supported by this         collection.</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 collection contains all of the elements in the specified collection.<DD><DL><DT><B>Parameters:</B><DD><CODE>c</CODE> - collection to be checked for containment in this collection.<DT><B>Returns:</B><DD><tt>true</tt> if this collection contains all of the elements	       in the specified collection<DT><B>See Also: </B><DD><A HREF="../../java/util/Collection.html#contains(java.lang.Object)"><CODE>contains(Object)</CODE></A></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 collection (optional operation).  The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this collection, and this collection is nonempty.)<DD><DL><DT><B>Parameters:</B><DD><CODE>c</CODE> - elements to be inserted into this collection.<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 this collection does not         support the <tt>addAll</tt> method.<DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if the class of an element of the specified 	       collection prevents it from being added to this collection.<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - some aspect of an element of the	       specified collection prevents it from being added to this	       collection.<DT><B>See Also: </B><DD><A HREF="../../java/util/Collection.html#add(java.lang.Object)"><CODE>add(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 all this collection's elements that are also contained in the specified collection (optional operation).  After this call returns, this collection will contain no elements in common with the specified collection.<DD><DL><DT><B>Parameters:</B><DD><CODE>c</CODE> - elements to be removed from this collection.<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>removeAll</tt> method 	       is not supported by this collection.<DT><B>See Also: </B><DD><A HREF="../../java/util/Collection.html#remove(java.lang.Object)"><CODE>remove(Object)</CODE></A>, <A HREF="../../java/util/Collection.html#contains(java.lang.Object)"><CODE>contains(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 collection that are contained in the specified collection (optional operation).  In other words, removes from this collection all of its elements that are not contained in the specified collection.<DD><DL><DT><B>Parameters:</B><DD><CODE>c</CODE> - elements to be retained in this collection.<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/Collection.html#remove(java.lang.Object)"><CODE>remove(Object)</CODE></A>, <A HREF="../../java/util/Collection.html#contains(java.lang.Object)"><CODE>contains(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 collection (optional operation). This collection will be empty after this method returns unless it throws an exception.<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 collection.</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 collection for equality. <p> While the <tt>Collection</tt> interface adds no stipulations to the general contract for the <tt>Object.equals</tt>, programmers who implement the <tt>Collection</tt> interface "directly" (in other words, create a class that is a <tt>Collection</tt> but is not a <tt>Set</tt> or a <tt>List</tt>) must exercise care if they choose to override the <tt>Object.equals</tt>.  It is not necessary to do so, and the simplest course of action is to rely on <tt>Object</tt>'s implementation, but the implementer may wish to implement a "value comparison" in place of the default "reference comparison."  (The <tt>List</tt> and <tt>Set</tt> interfaces mandate such value comparisons.)<p> The general contract for the <tt>Object.equals</tt> method states that equals must be symmetric (in other words, <tt>a.equals(b)</tt> if and only if <tt>b.equals(a)</tt>).  The contracts for <tt>List.equals</tt> and <tt>Set.equals</tt> state that lists are only equal to other lists, and sets to other sets.  Thus, a custom <tt>equals</tt> method for a collection class that implements neither the <tt>List</tt> nor <tt>Set</tt> interface must return <tt>false</tt> when this collection is compared to any list or set.  (By the same logic, it is not possible to write a class that correctly implements both the <tt>Set</tt> and <tt>List</tt> interfaces.)<DD><DL><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 collection.<DT><B>Returns:</B><DD><tt>true</tt> if the specified object is equal to this collection<DT><B>See Also: </B><DD><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>Set.equals(Object)</CODE></A>, <A HREF="../../java/util/List.html#equals(java.lang.Object)"><CODE>List.equals(Object)</CODE></A></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 collection.  While the <tt>Collection</tt> interface adds no stipulations to the general contract for the <tt>Object.hashCode</tt> method, programmers should take note that any class that overrides the <tt>Object.equals</tt> method must also override the <tt>Object.hashCode</tt> method in order to satisfy the general contract for the <tt>Object.hashCode</tt>method. In particular, <tt>c1.equals(c2)</tt> implies that <tt>c1.hashCode()==c2.hashCode()</tt>.<DD><DL><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 collection<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></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/Collection.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;PREV CLASS&nbsp;&nbsp;<A HREF="../../java/util/Comparator.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="Collection.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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -