📄 arrays.html
字号:
<A NAME="sort(short[])"><!-- --></A><H3>sort</H3><PRE>public static void <B>sort</B>(short[] a)</PRE><DL><DD>Sorts the specified array of shorts into ascending numerical order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - the array to be sorted.</DL></DD></DL><HR><A NAME="sort(short[], int, int)"><!-- --></A><H3>sort</H3><PRE>public static void <B>sort</B>(short[] a, int fromIndex, int toIndex)</PRE><DL><DD>Sorts the specified range of the specified array of shorts into ascending numerical order. The range to be sorted extends from index <tt>fromIndex</tt>, inclusive, to index <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the range to be sorted is empty.)<p> The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - the array to be sorted.<DD><CODE>fromIndex</CODE> - the index of the first element (inclusive) to be sorted.<DD><CODE>toIndex</CODE> - the index of the last element (exclusive) to be sorted.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if <tt>fromIndex > toIndex</tt><DD><CODE><A HREF="../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if <tt>fromIndex < 0</tt> or <tt>toIndex > a.length</tt></DL></DD></DL><HR><A NAME="sort(char[])"><!-- --></A><H3>sort</H3><PRE>public static void <B>sort</B>(char[] a)</PRE><DL><DD>Sorts the specified array of chars into ascending numerical order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - the array to be sorted.</DL></DD></DL><HR><A NAME="sort(char[], int, int)"><!-- --></A><H3>sort</H3><PRE>public static void <B>sort</B>(char[] a, int fromIndex, int toIndex)</PRE><DL><DD>Sorts the specified range of the specified array of chars into ascending numerical order. The range to be sorted extends from index <tt>fromIndex</tt>, inclusive, to index <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the range to be sorted is empty.)<p> The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - the array to be sorted.<DD><CODE>fromIndex</CODE> - the index of the first element (inclusive) to be sorted.<DD><CODE>toIndex</CODE> - the index of the last element (exclusive) to be sorted.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if <tt>fromIndex > toIndex</tt><DD><CODE><A HREF="../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if <tt>fromIndex < 0</tt> or <tt>toIndex > a.length</tt></DL></DD></DL><HR><A NAME="sort(byte[])"><!-- --></A><H3>sort</H3><PRE>public static void <B>sort</B>(byte[] a)</PRE><DL><DD>Sorts the specified array of bytes into ascending numerical order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - the array to be sorted.</DL></DD></DL><HR><A NAME="sort(byte[], int, int)"><!-- --></A><H3>sort</H3><PRE>public static void <B>sort</B>(byte[] a, int fromIndex, int toIndex)</PRE><DL><DD>Sorts the specified range of the specified array of bytes into ascending numerical order. The range to be sorted extends from index <tt>fromIndex</tt>, inclusive, to index <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the range to be sorted is empty.)<p> The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - the array to be sorted.<DD><CODE>fromIndex</CODE> - the index of the first element (inclusive) to be sorted.<DD><CODE>toIndex</CODE> - the index of the last element (exclusive) to be sorted.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if <tt>fromIndex > toIndex</tt><DD><CODE><A HREF="../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if <tt>fromIndex < 0</tt> or <tt>toIndex > a.length</tt></DL></DD></DL><HR><A NAME="sort(double[])"><!-- --></A><H3>sort</H3><PRE>public static void <B>sort</B>(double[] a)</PRE><DL><DD>Sorts the specified array of doubles into ascending numerical order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - the array to be sorted.</DL></DD></DL><HR><A NAME="sort(double[], int, int)"><!-- --></A><H3>sort</H3><PRE>public static void <B>sort</B>(double[] a, int fromIndex, int toIndex)</PRE><DL><DD>Sorts the specified range of the specified array of doubles into ascending numerical order. The range to be sorted extends from index <tt>fromIndex</tt>, inclusive, to index <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the range to be sorted is empty.)<p> The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - the array to be sorted.<DD><CODE>fromIndex</CODE> - the index of the first element (inclusive) to be sorted.<DD><CODE>toIndex</CODE> - the index of the last element (exclusive) to be sorted.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if <tt>fromIndex > toIndex</tt><DD><CODE><A HREF="../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if <tt>fromIndex < 0</tt> or <tt>toIndex > a.length</tt></DL></DD></DL><HR><A NAME="sort(float[])"><!-- --></A><H3>sort</H3><PRE>public static void <B>sort</B>(float[] a)</PRE><DL><DD>Sorts the specified array of floats into ascending numerical order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - the array to be sorted.</DL></DD></DL><HR><A NAME="sort(float[], int, int)"><!-- --></A><H3>sort</H3><PRE>public static void <B>sort</B>(float[] a, int fromIndex, int toIndex)</PRE><DL><DD>Sorts the specified range of the specified array of floats into ascending numerical order. The range to be sorted extends from index <tt>fromIndex</tt>, inclusive, to index <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the range to be sorted is empty.)<p> The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - the array to be sorted.<DD><CODE>fromIndex</CODE> - the index of the first element (inclusive) to be sorted.<DD><CODE>toIndex</CODE> - the index of the last element (exclusive) to be sorted.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if <tt>fromIndex > toIndex</tt><DD><CODE><A HREF="../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if <tt>fromIndex < 0</tt> or <tt>toIndex > a.length</tt></DL></DD></DL><HR><A NAME="sort(java.lang.Object[])"><!-- --></A><H3>sort</H3><PRE>public static void <B>sort</B>(<A HREF="../../java/lang/Object.html">Object</A>[] a)</PRE><DL><DD>Sorts the specified array of objects into ascending order, according to the <i>natural ordering</i> of its elements. All elements in the array must implement the <tt>Comparable</tt> interface. Furthermore, all elements in the array must be <i>mutually comparable</i> (that is, <tt>e1.compareTo(e2)</tt> must not throw a <tt>ClassCastException</tt> for any elements <tt>e1</tt> and <tt>e2</tt> in the array).<p> This sort is guaranteed to be <i>stable</i>: equal elements will not be reordered as a result of the sort.<p> The sorting algorithm is a modified mergesort (in which the merge is omitted if the highest element in the low sublist is less than the lowest element in the high sublist). This algorithm offers guaranteed n*log(n) performance, and can approach linear performance on nearly sorted lists.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - the array to be sorted.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if the array contains elements that are not <i>mutually comparable</i> (for example, strings and integers).<DT><B>See Also: </B><DD><A HREF="../../java/lang/Comparable.html"><CODE>Comparable</CODE></A></DL></DD></DL><HR><A NAME="sort(java.lang.Object[], int, int)"><!-- --></A><H3>sort</H3><PRE>public static void <B>sort</B>(<A HREF="../../java/lang/Object.html">Object</A>[] a, int fromIndex, int toIndex)</PRE><DL><DD>Sorts the specified range of the specified array of objects into ascending order, according to the <i>natural ordering</i> of its elements. The range to be sorted extends from index <tt>fromIndex</tt>, inclusive, to index <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the range to be sorted is empty.) All elements in this range must implement the <tt>Comparable</tt> interface. Furthermore, all elements in this range must be <i>mutually comparable</i> (that is, <tt>e1.compareTo(e2)</tt> must not throw a <tt>ClassCastException</tt> for any elements <tt>e1</tt> and <tt>e2</tt> in the array).<p> This sort is guaranteed to be <i>stable</i>: equal elements will not be reordered as a result of the sort.<p> The sorting algorithm is a modified mergesort (in which the merge is omitted if the highest element in the low sublist is less than the lowest element in the high sublist). This algorithm offers guaranteed n*log(n) performance, and can approach linear performance on nearly sorted lists.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - the array to be sorted.<DD><CODE>fromIndex</CODE> - the index of the first element (inclusive) to be sorted.<DD><CODE>toIndex</CODE> - the index of the last element (exclusive) to be sorted.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if <tt>fromIndex > toIndex</tt><DD><CODE><A HREF="../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if <tt>fromIndex < 0</tt> or <tt>toIndex > a.length</tt><DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if the array contains elements that are not <i>mutually comparable</i> (for example, strings and integers).<DT><B>See Also: </B><DD><A HREF="../../java/lang/Comparable.html"><CODE>Comparable</CODE></A></DL></DD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -