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

📄 set.html

📁 学习JAVA的很好的JAVA包和文档包
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Fri Aug 23 13:18:10 EDT 2002 --><TITLE>: Interface  Set</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">  <TR ALIGN="center" VALIGN="top">  <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="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-all.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><a href=../copyright.html target=_top>&copy; 1998-2002 McGraw-Hill</a></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../structure/Queue.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../structure/Stack.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><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">structure</FONT><BR>Interface  Set</H2><DL><DT><B>All Superinterfaces:</B> <DD><A HREF="../structure/Structure.html">Structure</A></DD></DL><DL><DT><B>All Known Implementing Classes:</B> <DD><A HREF="../structure/AbstractSet.html">AbstractSet</A></DD></DL><HR><DL><DT>public interface <B>Set</B><DT>extends <A HREF="../structure/Structure.html">Structure</A></DL><P>Implementation of a set of elements. As with the mathematical object, the elements of the set are not duplicated.  No order is implied or enforced in this structure, but simple set operations such as intersection, union, difference, and subset are provided.  <P> Example Usage: Given a list of students who completed a computer science thesis in the 2001-2002 academic year at Williams College and a list of graduating  computer science majors who are continuing on to graduate school, we could determine which thesis students are planning to attend graduate school as follows: <P> <pre> public static void main(String[] argv){	//thesis students in the class of '02	String[] thesis = new String[]{"Doug", "Evan", "Feng"};		//students continuing on to grad school	String[] grad = new String[]{"Doug", "Feng", "Lida"};	//instantiate our sets	Set thesisSet = new <A HREF="../structure/SetVector.html#SetVector()"><CODE>SetVector.SetVector()</CODE></A>, 	    gradSet = new <A HREF="../structure/SetVector.html#SetVector()"><CODE>SetVector.SetVector()</CODE></A>;			//build sets up	for(int i = 0; i < thesis.length; i++) thesisSet.<A HREF="../structure/SetVector.html#add(java.lang.Object)"><CODE>add(thesis[i])</CODE></A>;	for(int i = 0; i < grad.length; i++) gradSet.<A HREF="../structure/SetVector.html#add(java.lang.Object)"><CODE>add(grad[i])</CODE></A>;		//calculate the intersection of the two sets	thesisSet.<A HREF="../structure/SetVector.html#retainAll(structure.Structure)"><CODE>retainAll(gradSet)</CODE></A>;	System.out.println(thesisSet); } </pre><P><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../structure/Set.html#addAll(structure.Structure)">addAll</A></B>(<A HREF="../structure/Structure.html">Structure</A>&nbsp;other)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Union other set into this set.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../structure/Set.html#containsAll(structure.Structure)">containsAll</A></B>(<A HREF="../structure/Structure.html">Structure</A>&nbsp;other)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Check to see if this set is contained in the other structure.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../structure/Set.html#removeAll(structure.Structure)">removeAll</A></B>(<A HREF="../structure/Structure.html">Structure</A>&nbsp;other)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Computes the difference between this set and the other structure</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../structure/Set.html#retainAll(structure.Structure)">retainAll</A></B>(<A HREF="../structure/Structure.html">Structure</A>&nbsp;other)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Computes the intersection between this set and the other structure.</TD></TR></TABLE>&nbsp;<A NAME="methods_inherited_from_class_structure.Structure"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from interface structure.<A HREF="../structure/Structure.html">Structure</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../structure/Structure.html#add(java.lang.Object)">add</A>, <A HREF="../structure/Structure.html#clear()">clear</A>, <A HREF="../structure/Structure.html#contains(java.lang.Object)">contains</A>, <A HREF="../structure/Structure.html#elements()">elements</A>, <A HREF="../structure/Structure.html#isEmpty()">isEmpty</A>, <A HREF="../structure/Structure.html#iterator()">iterator</A>, <A HREF="../structure/Structure.html#remove(java.lang.Object)">remove</A>, <A HREF="../structure/Structure.html#size()">size</A>, <A HREF="../structure/Structure.html#values()">values</A></CODE></TD></TR></TABLE>&nbsp;<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="addAll(structure.Structure)"><!-- --></A><H3>addAll</H3><PRE>public void <B>addAll</B>(<A HREF="../structure/Structure.html">Structure</A>&nbsp;other)</PRE><DL><DD>Union other set into this set.<DD><DL></DL></DD><DD><DL><DT><B>Precondition:</B><DD>other is non-null<DT><B>Postcondition:</B><DD>values from other are added into this set</DL></DD></DL><HR><A NAME="containsAll(structure.Structure)"><!-- --></A><H3>containsAll</H3><PRE>public boolean <B>containsAll</B>(<A HREF="../structure/Structure.html">Structure</A>&nbsp;other)</PRE><DL><DD>Check to see if this set is contained in the other structure.<DD><DL></DL></DD><DD><DL><DT><B>Precondition:</B><DD>other is non-null<DT><B>Postcondition:</B><DD>returns true if every value in set is in other</DL></DD></DL><HR><A NAME="removeAll(structure.Structure)"><!-- --></A><H3>removeAll</H3><PRE>public void <B>removeAll</B>(<A HREF="../structure/Structure.html">Structure</A>&nbsp;other)</PRE><DL><DD>Computes the difference between this set and the other structure<DD><DL></DL></DD><DD><DL><DT><B>Precondition:</B><DD>other is non-null<DT><B>Postcondition:</B><DD>values of this set contained in other are removed</DL></DD></DL><HR><A NAME="retainAll(structure.Structure)"><!-- --></A><H3>retainAll</H3><PRE>public void <B>retainAll</B>(<A HREF="../structure/Structure.html">Structure</A>&nbsp;other)</PRE><DL><DD>Computes the intersection between this set and the other structure.<DD><DL></DL></DD><DD><DL><DT><B>Precondition:</B><DD>other is non-null<DT><B>Postcondition:</B><DD>values not appearing in the other structure are removed</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="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="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-all.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><a href=../copyright.html target=_top>&copy; 1998-2002 McGraw-Hill</a></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../structure/Queue.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../structure/Stack.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></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -