📄 arrays.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:48 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class Arrays</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/Arrays.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/ArrayList.html"><B>PREV CLASS</B></A> <A HREF="../../java/util/BitSet.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="Arrays.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | 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 Arrays</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A> | +--<B>java.util.Arrays</B></PRE><HR><DL><DT>public class <B>Arrays</B><DT>extends <A HREF="../../java/lang/Object.html">Object</A></DL><P>This class contains various methods for manipulating arrays (such as sorting and searching). It also contains a static factory that allows arrays to be viewed as lists.<p> The documentation for the sorting and searching methods contained in this class includes briefs description of the <i>implementations</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(Object[])</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/lang/Comparable.html"><CODE>Comparable</CODE></A>, <A HREF="../../java/util/Comparator.html"><CODE>Comparator</CODE></A></DL><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>static <A HREF="../../java/util/List.html">List</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Arrays.html#asList(java.lang.Object[])">asList</A></B>(<A HREF="../../java/lang/Object.html">Object</A>[] a)</CODE><BR> Returns a fixed-size list backed by the specified array.</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/Arrays.html#binarySearch(byte[], byte)">binarySearch</A></B>(byte[] a, byte key)</CODE><BR> Searches the specified array of bytes for the specified value 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/Arrays.html#binarySearch(char[], char)">binarySearch</A></B>(char[] a, char key)</CODE><BR> Searches the specified array of chars for the specified value 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/Arrays.html#binarySearch(double[], double)">binarySearch</A></B>(double[] a, double key)</CODE><BR> Searches the specified array of doubles for the specified value 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/Arrays.html#binarySearch(float[], float)">binarySearch</A></B>(float[] a, float key)</CODE><BR> Searches the specified array of floats for the specified value 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/Arrays.html#binarySearch(int[], int)">binarySearch</A></B>(int[] a, int key)</CODE><BR> Searches the specified array of ints for the specified value 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/Arrays.html#binarySearch(long[], long)">binarySearch</A></B>(long[] a, long key)</CODE><BR> Searches the specified array of longs for the specified value 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/Arrays.html#binarySearch(java.lang.Object[], java.lang.Object)">binarySearch</A></B>(<A HREF="../../java/lang/Object.html">Object</A>[] a, <A HREF="../../java/lang/Object.html">Object</A> key)</CODE><BR> Searches the specified array 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/Arrays.html#binarySearch(java.lang.Object[], java.lang.Object, java.util.Comparator)">binarySearch</A></B>(<A HREF="../../java/lang/Object.html">Object</A>[] a, <A HREF="../../java/lang/Object.html">Object</A> key, <A HREF="../../java/util/Comparator.html">Comparator</A> c)</CODE><BR> Searches the specified array 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/Arrays.html#binarySearch(short[], short)">binarySearch</A></B>(short[] a, short key)</CODE><BR> Searches the specified array of shorts for the specified value using the binary search algorithm.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Arrays.html#equals(boolean[], boolean[])">equals</A></B>(boolean[] a, boolean[] a2)</CODE><BR> Returns <tt>true</tt> if the two specified arrays of equals are <i>equal</i> to one another.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Arrays.html#equals(byte[], byte[])">equals</A></B>(byte[] a, byte[] a2)</CODE><BR> Returns <tt>true</tt> if the two specified arrays of bytes are <i>equal</i> to one another.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Arrays.html#equals(char[], char[])">equals</A></B>(char[] a, char[] a2)</CODE><BR> Returns <tt>true</tt> if the two specified arrays of chars are <i>equal</i> to one another.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Arrays.html#equals(double[], double[])">equals</A></B>(double[] a, double[] a2)</CODE><BR> Returns <tt>true</tt> if the two specified arrays of doubles are <i>equal</i> to one another.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Arrays.html#equals(float[], float[])">equals</A></B>(float[] a, float[] a2)</CODE><BR> Returns <tt>true</tt> if the two specified arrays of floats are <i>equal</i> to one another.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/util/Arrays.html#equals(int[], int[])">equals</A></B>(int[] a,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -