set.html
来自「API資料大全」· HTML 代码 · 共 612 行 · 第 1/3 页
HTML
612 行
<CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Set.html#remove(java.lang.Object)">remove</A></B>(<A HREF="../../java/lang/Object.html">Object</A> o)</CODE><BR> Removes the specified element from this set if it is present (optional operation).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Set.html#removeAll(java.util.Collection)">removeAll</A></B>(<A HREF="../../java/util/Collection.html">Collection</A> c)</CODE><BR> Removes from this set all of its elements that are contained in the specified collection (optional operation).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Set.html#retainAll(java.util.Collection)">retainAll</A></B>(<A HREF="../../java/util/Collection.html">Collection</A> c)</CODE><BR> Retains only the elements in this set that are contained in the specified collection (optional operation).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Set.html#size()">size</A></B>()</CODE><BR> Returns the number of elements in this set (its cardinality).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/Object.html">Object</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Set.html#toArray()">toArray</A></B>()</CODE><BR> Returns an array containing all of the elements in this set.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/Object.html">Object</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Set.html#toArray(java.lang.Object[])">toArray</A></B>(<A HREF="../../java/lang/Object.html">Object</A>[] a)</CODE><BR> Returns an array containing all of the elements in this set whose runtime type is that of the specified array.</TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="size()"><!-- --></A><H3>size</H3><PRE>public int <B>size</B>()</PRE><DL><DD>Returns the number of elements in this set (its cardinality). If this set contains more than <tt>Integer.MAX_VALUE</tt> elements, returns <tt>Integer.MAX_VALUE</tt>.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Collection.html#size()">size</A></CODE> in interface <CODE><A HREF="../../java/util/Collection.html">Collection</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the number of elements in this set (its cardinality).</DL></DD></DL><HR><A NAME="isEmpty()"><!-- --></A><H3>isEmpty</H3><PRE>public boolean <B>isEmpty</B>()</PRE><DL><DD>Returns <tt>true</tt> if this set contains no elements.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Collection.html#isEmpty()">isEmpty</A></CODE> in interface <CODE><A HREF="../../java/util/Collection.html">Collection</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD><tt>true</tt> if this set contains no elements.</DL></DD></DL><HR><A NAME="contains(java.lang.Object)"><!-- --></A><H3>contains</H3><PRE>public boolean <B>contains</B>(<A HREF="../../java/lang/Object.html">Object</A> o)</PRE><DL><DD>Returns <tt>true</tt> if this set contains the specified element. More formally, returns <tt>true</tt> if and only if this set contains an element <code>e</code> such that <code>(o==null ? e==null : o.equals(e))</code>.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Collection.html#contains(java.lang.Object)">contains</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> - element whose presence in this set is to be tested.<DT><B>Returns:</B><DD><tt>true</tt> if this set contains the specified element.</DL></DD></DL><HR><A NAME="iterator()"><!-- --></A><H3>iterator</H3><PRE>public <A HREF="../../java/util/Iterator.html">Iterator</A> <B>iterator</B>()</PRE><DL><DD>Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee).<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Collection.html#iterator()">iterator</A></CODE> in interface <CODE><A HREF="../../java/util/Collection.html">Collection</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>an iterator over the elements in this set.</DL></DD></DL><HR><A NAME="toArray()"><!-- --></A><H3>toArray</H3><PRE>public <A HREF="../../java/lang/Object.html">Object</A>[] <B>toArray</B>()</PRE><DL><DD>Returns an array containing all of the elements in this set. Obeys the general contract of the <tt>Collection.toArray</tt> method.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Collection.html#toArray()">toArray</A></CODE> in interface <CODE><A HREF="../../java/util/Collection.html">Collection</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>an array containing all of the elements in this set.</DL></DD></DL><HR><A NAME="toArray(java.lang.Object[])"><!-- --></A><H3>toArray</H3><PRE>public <A HREF="../../java/lang/Object.html">Object</A>[] <B>toArray</B>(<A HREF="../../java/lang/Object.html">Object</A>[] a)</PRE><DL><DD>Returns an array containing all of the elements in this set whose runtime type is that of the specified array. Obeys the general contract of the <tt>Collection.toArray(Object[])</tt> method.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Collection.html#toArray(java.lang.Object[])">toArray</A></CODE> in interface <CODE><A HREF="../../java/util/Collection.html">Collection</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - the array into which the elements of this set are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.<DT><B>Returns:</B><DD>an array containing the elements of this set.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ArrayStoreException.html">ArrayStoreException</A></CODE> - the runtime type of a is not a supertype of the runtime type of every element in this set.</DL></DD></DL><HR><A NAME="add(java.lang.Object)"><!-- --></A><H3>add</H3><PRE>public boolean <B>add</B>(<A HREF="../../java/lang/Object.html">Object</A> o)</PRE><DL><DD>Adds the specified element to this set if it is not already present (optional operation). More formally, adds the specified element, <code>o</code>, to this set if this set contains no element <code>e</code> such that <code>(o==null ? e==null : o.equals(e))</code>. If this set already contains the specified element, the call leaves this set unchanged and returns <tt>false</tt>. In combination with the restriction on constructors, this ensures that sets never contain duplicate elements.<p> The stipulation above does not imply that sets must accept all elements; sets may refuse to add any particular element, including <tt>null</tt>, and throwing an exception, as described in the specification for <tt>Collection.add</tt>. Individual set implementations should clearly document any restrictions on the the elements that they may contain.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/util/Collection.html#add(java.lang.Object)">add</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> - element to be added to this set.<DT><B>Returns:</B><DD><tt>true</tt> if this set did not already contain the specified element.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/UnsupportedOperationException.html">UnsupportedOperationException</A></CODE> - if the <tt>add</tt> method is not supported by this set.<DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if the class of the specified element prevents it from being added to this set.<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if some aspect of this element prevents it from being added to this set.</DL></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> o)</PRE><DL>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?