📄 collections.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 Thu Apr 27 23:36:52 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class Collections</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="../../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/Collections.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/Calendar.html"><B>PREV CLASS</B></A> <A HREF="../../java/util/Date.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="Collections.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.util</FONT><BR>Class Collections</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A> | +--<B>java.util.Collections</B></PRE><HR><DL><DT>public class <B>Collections</B><DT>extends <A HREF="../../java/lang/Object.html">Object</A></DL><P>This class consists exclusively of static methods that operate on or return collections. It contains polymorphic algorithms that operate on collections, "wrappers", which return a new collection backed by a specified collection, and a few other odds and ends.<p> The documentation for the polymorphic algorithms contained in this class generally includes a brief description of the <i>implementation</i>. Such descriptions should be regarded as <i>implementation notes</i>, rather than parts of the <i>specification</i>. Implementors should feel free to substitute other algorithms, so long as the specification itself is adhered to. (For example, the algorithm used by <tt>sort</tt> does not have to be a mergesort, but it does have to be <i>stable</i>.)<P><DL><DT><B>Since: </B><DD>1.2</DD><DT><B>See Also: </B><DD><A HREF="../../java/util/Collection.html"><CODE>Collection</CODE></A>, <A HREF="../../java/util/Set.html"><CODE>Set</CODE></A>, <A HREF="../../java/util/List.html"><CODE>List</CODE></A>, <A HREF="../../java/util/Map.html"><CODE>Map</CODE></A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/util/List.html">List</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Collections.html#EMPTY_LIST">EMPTY_LIST</A></B></CODE><BR> The empty list (immutable).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/util/Map.html">Map</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Collections.html#EMPTY_MAP">EMPTY_MAP</A></B></CODE><BR> The empty map (immutable).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/util/Set.html">Set</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Collections.html#EMPTY_SET">EMPTY_SET</A></B></CODE><BR> The empty set (immutable).</TD></TR></TABLE> <!-- ======== 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>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Collections.html#binarySearch(java.util.List, java.lang.Object)">binarySearch</A></B>(<A HREF="../../java/util/List.html">List</A> list, <A HREF="../../java/lang/Object.html">Object</A> key)</CODE><BR> Searches the specified list for the specified object using the binary search algorithm.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Collections.html#binarySearch(java.util.List, java.lang.Object, java.util.Comparator)">binarySearch</A></B>(<A HREF="../../java/util/List.html">List</A> list, <A HREF="../../java/lang/Object.html">Object</A> key, <A HREF="../../java/util/Comparator.html">Comparator</A> c)</CODE><BR> Searches the specified list for the specified object using the binary search algorithm.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Collections.html#copy(java.util.List, java.util.List)">copy</A></B>(<A HREF="../../java/util/List.html">List</A> dest, <A HREF="../../java/util/List.html">List</A> src)</CODE><BR> Copies all of the elements from one list into another.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/util/Enumeration.html">Enumeration</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Collections.html#enumeration(java.util.Collection)">enumeration</A></B>(<A HREF="../../java/util/Collection.html">Collection</A> c)</CODE><BR> Returns an enumeration over the specified collection.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Collections.html#fill(java.util.List, java.lang.Object)">fill</A></B>(<A HREF="../../java/util/List.html">List</A> list, <A HREF="../../java/lang/Object.html">Object</A> o)</CODE><BR> Replaces all of the elements of the specified list with the specified element.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/Object.html">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Collections.html#max(java.util.Collection)">max</A></B>(<A HREF="../../java/util/Collection.html">Collection</A> coll)</CODE><BR> Returns the maximum element of the given collection, according to the <i>natural ordering</i> of its elements.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/Object.html">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Collections.html#max(java.util.Collection, java.util.Comparator)">max</A></B>(<A HREF="../../java/util/Collection.html">Collection</A> coll, <A HREF="../../java/util/Comparator.html">Comparator</A> comp)</CODE><BR> Returns the maximum element of the given collection, according to the order induced by the specified comparator.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/Object.html">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Collections.html#min(java.util.Collection)">min</A></B>(<A HREF="../../java/util/Collection.html">Collection</A> coll)</CODE><BR> Returns the minimum element of the given collection, according to the <i>natural ordering</i> of its elements.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/Object.html">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Collections.html#min(java.util.Collection, java.util.Comparator)">min</A></B>(<A HREF="../../java/util/Collection.html">Collection</A> coll, <A HREF="../../java/util/Comparator.html">Comparator</A> comp)</CODE><BR> Returns the minimum element of the given collection, according to the order induced by the specified comparator.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/util/List.html">List</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Collections.html#nCopies(int, java.lang.Object)">nCopies</A></B>(int n, <A HREF="../../java/lang/Object.html">Object</A> o)</CODE><BR> Returns an immutable list consisting of <tt>n</tt> copies of the specified object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Collections.html#reverse(java.util.List)">reverse</A></B>(<A HREF="../../java/util/List.html">List</A> l)</CODE><BR> Reverses the order of the elements in the specified list.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/util/Comparator.html">Comparator</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Collections.html#reverseOrder()">reverseOrder</A></B>()</CODE><BR> Returns a comparator that imposes the reverse of the <i>natural ordering</i> on a collection of objects that implement the <tt>Comparable</tt> interface.</TD></TR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -