新聞中心
Arrays

成都網(wǎng)站建設哪家好,找成都創(chuàng)新互聯(lián)公司!專注于網(wǎng)頁設計、網(wǎng)站建設、微信開發(fā)、微信小程序、集團企業(yè)網(wǎng)站制作等服務項目。核心團隊均擁有互聯(lián)網(wǎng)行業(yè)多年經(jīng)驗,服務眾多知名企業(yè)客戶;涵蓋的客戶類型包括:墻體彩繪等眾多領域,積累了大量豐富的經(jīng)驗,同時也獲得了客戶的一致贊美!
java.lang.Object
|---java.util.Arrays
public class Arrays
extends Object此類包含用于操作數(shù)組(例如排序和搜索)的各種方法。 此類還包含一個允許將數(shù)組視為列表的靜態(tài)工廠。
如果指定的數(shù)組引用為空,則此類中的方法都會拋出 NullPointerException,除非另有說明。
此類中包含的方法的文檔包括實現(xiàn)的簡要說明。 此類描述應被視為實現(xiàn)說明,而不是規(guī)范的一部分。 只要遵守規(guī)范本身,實現(xiàn)者應該可以隨意替換其他算法。 (例如,sort(Object[]) 使用的算法不必是 MergeSort,但它必須是穩(wěn)定的。)
此類是 Java 集合框架的成員。
方法總結(jié)
| 修飾符和類型 | 方法 | 描述 |
|---|---|---|
| static | asList(T... a) | 返回由指定數(shù)組支持的固定大小的列表。 |
| static int | binarySearch(byte[] a, byte key) | 使用二進制搜索算法在指定的字節(jié)數(shù)組中搜索指定的值。 |
| static int | binarySearch(byte[] a, int fromIndex, int toIndex, byte key) | 使用二進制搜索算法在指定字節(jié)數(shù)組的范圍內(nèi)搜索指定值。 |
| static int | binarySearch(char[] a, char key) | 使用二進制搜索算法在指定的字符數(shù)組中搜索指定的值。 |
| static int | binarySearch(char[] a, int fromIndex, int toIndex, char key) | 使用二進制搜索算法在指定字符數(shù)組的范圍內(nèi)搜索指定值。 |
| static int | binarySearch(double[] a, double key) | 使用二進制搜索算法在指定的雙精度數(shù)組中搜索指定的值。 |
| static int | binarySearch(double[] a, int fromIndex, int toIndex, double key) | 使用二分搜索算法在指定的雙精度數(shù)組范圍內(nèi)搜索指定值。 |
| static int | binarySearch(float[] a, float key) | 使用二進制搜索算法在指定的浮點數(shù)數(shù)組中搜索指定的值。 |
| static int | binarySearch(float[] a, int fromIndex, int toIndex, float key) | 使用二分搜索算法在指定浮點數(shù)數(shù)組的范圍內(nèi)搜索指定值。 |
| static int | binarySearch(int[] a, int key) | 使用二進制搜索算法在指定的整數(shù)數(shù)組中搜索指定的值。 |
| static int | binarySearch(int[] a, int fromIndex, int toIndex, int key) | 使用二進制搜索算法在指定整數(shù)數(shù)組的范圍內(nèi)搜索指定值。 |
| static int | binarySearch(long[] a, int fromIndex, int toIndex, long key) | 使用二進制搜索算法在指定的 long 數(shù)組的范圍內(nèi)搜索指定值。 |
| static int | binarySearch(long[] a, long key) | 使用二進制搜索算法在指定的 long 數(shù)組中搜索指定的值。 |
| static int | binarySearch(short[] a, int fromIndex, int toIndex, short key) | 使用二分搜索算法在指定的 short 數(shù)組的范圍內(nèi)搜索指定的值。 |
| static int | binarySearch(short[] a, short key) | 使用二分搜索算法在指定的 short 數(shù)組中搜索指定的值。 |
| static int | binarySearch(Object[] a, int fromIndex, int toIndex, Object key) | 使用二分搜索算法在指定數(shù)組的范圍內(nèi)搜索指定對象。 |
| static int | binarySearch(Object[] a, Object key) | 使用二分搜索算法在指定數(shù)組中搜索指定對象。 |
| static | binarySearch(T[] a, int fromIndex, int toIndex, T key, Comparator super T> c) | 使用二分搜索算法在指定數(shù)組的范圍內(nèi)搜索指定對象。 |
| static | binarySearch(T[] a, T key, Comparator super T> c) | 使用二分搜索算法在指定數(shù)組中搜索指定對象。 |
| static boolean[] | copyOf(boolean[] original, int newLength) | 復制指定的數(shù)組,用 false 截斷或填充(如果需要),使副本具有指定的長度。 |
| static byte[] | copyOf(byte[] original, int newLength) | 復制指定的數(shù)組,用零截斷或填充(如有必要),以便副本具有指定的長度。 |
| static char[] | copyOf(char[] original, int newLength) | 復制指定的數(shù)組,用空字符截斷或填充(如有必要),使副本具有指定的長度。 |
| static double[] | copyOf(double[] original, int newLength) | 復制指定的數(shù)組,用零截斷或填充(如有必要),以便副本具有指定的長度。 |
| static float[] | copyOf(float[] original, int newLength) | 復制指定的數(shù)組,用零截斷或填充(如有必要),以便副本具有指定的長度。 |
| static int[] | copyOf(int[] original, int newLength) | 復制指定的數(shù)組,用零截斷或填充(如有必要),以便副本具有指定的長度。 |
| static long[] | copyOf(long[] original, int newLength) | 復制指定的數(shù)組,用零截斷或填充(如有必要),以便副本具有指定的長度。 |
| static short[] | copyOf(short[] original, int newLength) | 復制指定的數(shù)組,用零截斷或填充(如有必要),以便副本具有指定的長度。 |
| static | copyOf(T[] original, int newLength) | 復制指定的數(shù)組,截斷或填充空值(如有必要),使副本具有指定的長度。 |
| static | copyOf(U[] original, int newLength, Class extends T[]> newType) | 復制指定的數(shù)組,截斷或填充空值(如有必要),使副本具有指定的長度。 |
| static boolean[] | copyOfRange(boolean[] original, int from, int to) | 將指定數(shù)組的指定范圍復制到新數(shù)組中。 |
| static byte[] | copyOfRange(byte[] original, int from, int to) | 將指定數(shù)組的指定范圍復制到新數(shù)組中。 |
| static char[] | copyOfRange(char[] original, int from, int to) | 將指定數(shù)組的指定范圍復制到新數(shù)組中。 |
| static double[] | copyOfRange(double[] original, int from, int to) | 將指定數(shù)組的指定范圍復制到新數(shù)組中。 |
| static float[] | copyOfRange(float[] original, int from, int to) | 將指定數(shù)組的指定范圍復制到新數(shù)組中。 |
| static int[] | copyOfRange(int[] original, int from, int to) | 將指定數(shù)組的指定范圍復制到新數(shù)組中。 |
| static long[] | copyOfRange(long[] original, int from, int to) | 將指定數(shù)組的指定范圍復制到新數(shù)組中。 |
| static short[] | copyOfRange(short[] original, int from, int to) | 將指定數(shù)組的指定范圍復制到新數(shù)組中。 |
| static | copyOfRange(T[] original, int from, int to) | 將指定數(shù)組的指定范圍復制到新數(shù)組中。 |
| static | copyOfRange(U[] original, int from, int to, Class extends T[]> newType) | 將指定數(shù)組的指定范圍復制到新數(shù)組中。 |
| static boolean | deepEquals(Object[] a1, Object[] a2) | 如果兩個指定的數(shù)組彼此深度相等,則返回 true。 |
| static int | deepHashCode(Object[] a) | 根據(jù)指定數(shù)組的“深層內(nèi)容”返回哈希碼。 |
| static String | deepToString(Object[] a) | 返回指定數(shù)組的“深層內(nèi)容”的字符串表示形式。 |
| static boolean | equals(boolean[] a, boolean[] a2) | 如果兩個指定的布爾值數(shù)組彼此相等,則返回 true。 |
| static boolean | equals(byte[] a, byte[] a2) | 如果兩個指定的字節(jié)數(shù)組彼此相等,則返回 true。 |
| static boolean | equals(char[] a, char[] a2) | 如果兩個指定的字符數(shù)組彼此相等,則返回 true。 |
| static boolean | equals(double[] a, double[] a2) | 如果兩個指定的雙精度數(shù)組彼此相等,則返回 true。 |
| static boolean | equals(float[] a, float[] a2) | 如果兩個指定的浮點數(shù)組彼此相等,則返回 true。 |
| static boolean | equals(int[] a, int[] a2) | 如果兩個指定的 int 數(shù)組彼此相等,則返回 true。 |
| static boolean | equals(long[] a, long[] a2) | 如果兩個指定的 long 數(shù)組彼此相等,則返回 true。 |
| static boolean | equals(short[] a, short[] a2) | 如果兩個指定的 short 數(shù)組彼此相等,則返回 true。 |
| static boolean | equals(Object[] a, Object[] a2) | 如果兩個指定的 Objects 數(shù)組彼此相等,則返回 true。 |
| static void | fill(boolean[] a, boolean val) | 將指定的布爾值分配給指定的布爾數(shù)組的每個元素。 |
| static void | fill(boolean[] a, int fromIndex, int toIndex, boolean val) | 將指定的布爾值分配給指定布爾數(shù)組的指定范圍的每個元素。 |
| static void | fill(byte[] a, byte val) | 將指定的字節(jié)值分配給指定字節(jié)數(shù)組的每個元素。 |
| static void | fill(byte[] a, int fromIndex, int toIndex, byte val) | 將指定的字節(jié)值分配給指定字節(jié)數(shù)組的指定范圍的每個元素。 |
| static void | fill(char[] a, char val) | 將指定的 char 值分配給指定的 char 數(shù)組的每個元素。 |
| static void | fill(char[] a, int fromIndex, int toIndex, char val) | 將指定的 char 值分配給指定字符數(shù)組的指定范圍的每個元素。 |
| static void | fill(double[] a, double val) | 將指定的 double 值分配給指定的 double 數(shù)組的每個元素。 |
| static void | fill(double[] a, int fromIndex, int toIndex, double val) | 將指定的 double 值分配給指定的 double 數(shù)組的指定范圍內(nèi)的每個元素。 |
| static void | fill(float[] a, float val) | 將指定的浮點值分配給指定浮點數(shù)組的每個元素。 |
| static void | fill(float[] a, int fromIndex, int toIndex, float val) | 將指定的浮點值分配給指定浮點數(shù)組的指定范圍的每個元素。 |
| static void | fill(int[] a, int val) | 將指定的 int 值分配給指定的 int 數(shù)組的每個元素。 |
| static void | fill(int[] a, int fromIndex, int toIndex, int val) | 將指定的 int 值分配給指定 int 數(shù)組的指定范圍的每個元素。 |
| static void | fill(long[] a, int fromIndex, int toIndex, long val) | 將指定的 long 值分配給指定 long 數(shù)組的指定范圍的每個元素。 |
| static void | fill(long[] a, long val) | 將指定的 long 值分配給指定的 long 數(shù)組的每個元素。 |
| static void | fill(short[] a, int fromIndex, int toIndex, short val) | 將指定的 short 值分配給指定的 short 數(shù)組的指定范圍的每個元素。 |
| static void | fill(short[] a, short val) | 將指定的 short 值分配給指定的 short 數(shù)組的每個元素。 |
| static void | fill(Object[] a, int fromIndex, int toIndex, Object val) | 將指定的 Object 引用分配給指定的 Objects 數(shù)組的指定范圍內(nèi)的每個元素。 |
| static void | fill(Object[] a, Object val) | 將指定的 Object 引用分配給指定的 Objects 數(shù)組的每個元素。 |
| static int | hashCode(boolean[] a) | 根據(jù)指定數(shù)組的內(nèi)容返回哈希碼。 |
| static int | hashCode(byte[] a) | 根據(jù)指定數(shù)組的內(nèi)容返回哈希碼。 |
| static int | hashCode(char[] a) | 根據(jù)指定數(shù)組的內(nèi)容返回哈希碼。 |
| static int | hashCode(double[] a) | 根據(jù)指定數(shù)組的內(nèi)容返回哈希碼。 |
| static int | hashCode(float[] a) | 根據(jù)指定數(shù)組的內(nèi)容返回哈希碼。 |
| static int | hashCode(int[] a) | 根據(jù)指定數(shù)組的內(nèi)容返回哈希碼。 |
| static int | hashCode(long[] a) | 根據(jù)指定數(shù)組的內(nèi)容返回哈希碼。 |
| static int | hashCode(short[] a) | 根據(jù)指定數(shù)組的內(nèi)容返回哈希碼。 |
| static int | hashCode(Object[] a) | 根據(jù)指定數(shù)組的內(nèi)容返回哈希碼。 |
| static void | parallelPrefix(double[] array, int fromIndex, int toIndex, DoubleBinaryOperator op) | 對數(shù)組的給定子范圍執(zhí)行 [parallelPrefix(double],java.util.function.DoubleBinaryOperator)。 |
| static void | parallelPrefix(double[] array, DoubleBinaryOperator op) | 使用提供的函數(shù)并行累積給定數(shù)組的每個元素。 |
| static void | parallelPrefix(int[] array, int fromIndex, int toIndex, IntBinaryOperator op) | 對數(shù)組的給定子范圍執(zhí)行 [parallelPrefix(int],java.util.function.IntBinaryOperator)。 |
| static void | parallelPrefix(int[] array, IntBinaryOperator op) | 使用提供的函數(shù)并行累積給定數(shù)組的每個元素。 |
| static void | parallelPrefix(long[] array, int fromIndex, int toIndex, LongBinaryOperator op) | 對數(shù)組的給定子范圍執(zhí)行 [parallelPrefix(long],java.util.function.LongBinaryOperator)。 |
| static void | parallelPrefix(long[] array, LongBinaryOperator op) | 使用提供的函數(shù)并行累積給定數(shù)組的每個元素。 |
| static | parallelPrefix(T[] array, int fromIndex, int toIndex, BinaryOperator | 對數(shù)組的給定子范圍執(zhí)行 [parallelPrefix(java.lang.Object],java.util.function.BinaryOperator)。 |
| static | parallelPrefix(T[] array, BinaryOperator | 使用提供的函數(shù)并行累積給定數(shù)組的每個元素。 |
| static void | parallelSetAll(double[] array, IntToDoubleFunction generator) | 使用提供的生成器函數(shù)并行設置指定數(shù)組的所有元素來計算每個元素。 |
| static void | parallelSetAll(int[] array, IntUnaryOperator generator) | 使用提供的生成器函數(shù)并行設置指定數(shù)組的所有元素來計算每個元素。 |
| static void | parallelSetAll(long[] array, IntToLongFunction generator) | 使用提供的生成器函數(shù)并行設置指定數(shù)組的所有元素來計算每個元素。 |
| static | parallelSetAll(T[] array, IntFunction extends T> generator) | 使用提供的生成器函數(shù)并行設置指定數(shù)組的所有元素來計算每個元素。 |
| static void | parallelSort(byte[] a) | 將指定的數(shù)組按數(shù)字升序排序。 |
| static void | parallelSort(byte[] a, int fromIndex, int toIndex) | 將數(shù)組的指定范圍按數(shù)字升序排序。 |
| static void | parallelSort(char[] a) | 將指定的數(shù)組按數(shù)字升序排序。 |
| static void | parallelSort(char[] a, int fromIndex, int toIndex) | 將數(shù)組的指定范圍按數(shù)字升序排序。 |
| static void | parallelSort(double[] a) | 將指定的數(shù)組按數(shù)字升序排序。 |
| static void | parallelSort(double[] a, int fromIndex, int toIndex) | 將數(shù)組的指定范圍按數(shù)字升序排序。 |
| static void | parallelSort(float[] a) | 將指定的數(shù)組按數(shù)字升序排序。 |
| static void | parallelSort(float[] a, int fromIndex, int toIndex) | 將數(shù)組的指定范圍按數(shù)字升序排序。 |
| static void | parallelSort(int[] a) | 將指定的數(shù)組按數(shù)字升序排序。 |
| static void | parallelSort(int[] a, int fromIndex, int toIndex) | 將數(shù)組的指定范圍按數(shù)字升序排序。 |
| static void | parallelSort(long[] a) | 將指定的數(shù)組按數(shù)字升序排序。 |
| static void | parallelSort(long[] a, int fromIndex, int toIndex) | 將數(shù)組的指定范圍按數(shù)字升序排序。 |
| static void | parallelSort(short[] a) | 將指定的數(shù)組按數(shù)字升序排序。 |
| static void | parallelSort(short[] a, int fromIndex, int toIndex) | 將數(shù)組的指定范圍按數(shù)字升序排序。 |
| static | parallelSort(T[] a) | 根據(jù)其元素的 Comparable 對指定的對象數(shù)組進行升序排序。 |
| static | parallelSort(T[] a, int fromIndex, int toIndex) | 根據(jù)其元素的 Comparable 對指定對象數(shù)組的指定范圍進行升序排序。 |
| static | parallelSort(T[] a, int fromIndex, int toIndex, Comparator super T> cmp) | 根據(jù)指定比較器的順序?qū)χ付▽ο髷?shù)組的指定范圍進行排序。 |
| static | parallelSort(T[] a, Comparator super T> cmp) | 根據(jù)指定比較器產(chǎn)生的順序?qū)χ付ǖ膶ο髷?shù)組進行排序。 |
| static void | setAll(double[] array, IntToDoubleFunction generator) | 設置指定數(shù)組的所有元素,使用提供的生成器函數(shù)計算每個元素。 |
| static void | setAll(int[] array, IntUnaryOperator generator) | 設置指定數(shù)組的所有元素,使用提供的生成器函數(shù)計算每個元素。 |
| static void | setAll(long[] array, IntToLongFunction generator) | 設置指定數(shù)組的所有元素,使用提供的生成器函數(shù)計算每個元素。 |
| static | setAll(T[] array, IntFunction extends T> generator) | 設置指定數(shù)組的所有元素,使用提供的生成器函數(shù)計算每個元素。 |
| static void | sort(byte[] a) | 將指定的數(shù)組按數(shù)字升序排序。 |
| static void | sort(byte[] a, int fromIndex, int toIndex) | 將數(shù)組的指定范圍按升序排序。 |
| static void | sort(char[] a) | 將指定的數(shù)組按數(shù)字升序排序。 |
| static void | sort(char[] a, int fromIndex, int toIndex) | 將數(shù)組的指定范圍按升序排序。 |
| static void | sort(double[] a) | 將指定的數(shù)組按數(shù)字升序排序。 |
| static void | sort(double[] a, int fromIndex, int toIndex) | 將數(shù)組的指定范圍按升序排序。 |
| static void | sort(float[] a) | 將指定的數(shù)組按數(shù)字升序排序。 |
| static void | sort(float[] a, int fromIndex, int toIndex) | 將數(shù)組的指定范圍按升序排序。 |
| static void | sort(int[] a) | 將指定的數(shù)組按數(shù)字升序排序。 |
| static void | sort(int[] a, int fromIndex, int toIndex) | 將數(shù)組的指定范圍按升序排序。 |
| static void | sort(long[] a) | 將指定的數(shù)組按數(shù)字升序排序。 |
| static void | sort(long[] a, int fromIndex, int toIndex) | 將數(shù)組的指定范圍按升序排序。 |
| static void | sort(short[] a) | 將指定的數(shù)組按數(shù)字升序排序。 |
| static void | sort(short[] a, int fromIndex, int toIndex) | 將數(shù)組的指定范圍按升序排序。 |
| static void | sort(Object[] a) | 根據(jù)其元素的 Comparable 對指定的對象數(shù)組進行升序排序。 |
| static void | sort(Object[] a, int fromIndex, int toIndex) | 根據(jù)其元素的 Comparable 對指定對象數(shù)組的指定范圍進行升序排序。 |
| static | sort(T[] a, int fromIndex, int toIndex, Comparator super T> c) | 根據(jù)指定比較器的順序?qū)χ付▽ο髷?shù)組的指定范圍進行排序。 |
| static | sort(T[] a, Comparator super T> c) | 根據(jù)指定比較器產(chǎn)生的順序?qū)χ付ǖ膶ο髷?shù)組進行排序。 |
| static Spliterator.OfDouble | spliterator(double[] array) | 返回一個 Spliterator.OfDouble 覆蓋所有指定的數(shù)組。 |
| static Spliterator.OfDouble | spliterator(double[] array, int startInclusive, int endExclusive) | 返回一個 Spliterator.OfDouble 覆蓋指定數(shù)組的指定范圍。 |
| static Spliterator.OfInt | spliterator(int[] array) | 返回一個 Spliterator.OfInt 覆蓋所有指定的數(shù)組。 |
| static Spliterator.OfInt | spliterator(int[] array, int startInclusive, int endExclusive) | 返回一個 Spliterator.OfInt 覆蓋指定數(shù)組的指定范圍。 |
| static Spliterator.OfLong | spliterator(long[] array) | 返回一個 Spliterator.OfLong 覆蓋所有指定的數(shù)組。 |
| static Spliterator.OfLong | spliterator(long[] array, int startInclusive, int endExclusive) | 返回一個 Spliterator.OfLong 覆蓋指定數(shù)組的指定范圍。 |
| static | spliterator(T[] array) | 返回一個涵蓋所有指定數(shù)組的 Spliterator。 |
| static | spliterator(T[] array, int startInclusive, int endExclusive) | 返回一個Spliterator,覆蓋指定數(shù)組的指定范圍。 |
| static DoubleStream | stream(double[] array) | 返回以指定數(shù)組為源的順序 DoubleStream。 |
| static DoubleStream | stream(double[] array, int startInclusive, int endExclusive) | 返回以指定數(shù)組的指定范圍作為源的順序 DoubleStream。 |
| static IntStream | stream(int[] array) | 返回以指定數(shù)組作為源的順序 IntStream。 |
| static IntStream | stream(int[] array, int startInclusive, int endExclusive) | 返回以指定數(shù)組的指定范圍作為源的順序 IntStream。 |
| static LongStream | stream(long[] array) | 返回以指定數(shù)組為源的順序 LongStream。 |
| static LongStream | stream(long[] array, int startInclusive, int endExclusive) | 返回以指定數(shù)組的指定范圍作為源的順序 LongStream。 |
| static | stream(T[] array) | 返回以指定數(shù)組為源的順序流。 |
| static | stream(T[] array, int startInclusive, int endExclusive) | 返回以指定數(shù)組的指定范圍作為源的順序流。 |
| static String | toString(boolean[] a) | 返回指定數(shù)組內(nèi)容的字符串表示形式。 |
| static String | toString(byte[] a) | 返回指定數(shù)組內(nèi)容的字符串表示形式。 |
| static String | toString(char[] a) | 返回指定數(shù)組內(nèi)容的字符串表示形式。 |
| static String | toString(double[] a) | 返回指定數(shù)組內(nèi)容的字符串表示形式。 |
| static String | toString(float[] a) | 返回指定數(shù)組內(nèi)容的字符串表示形式。 |
| static String | toString(int[] a) | 返回指定數(shù)組內(nèi)容的字符串表示形式。 |
| static String | toString(long[] a) | 返回指定數(shù)組內(nèi)容的字符串表示形式。 |
| static String | toString(short[] a) | 返回指定數(shù)組內(nèi)容的字符串表示形式。 |
| static String | toString(Object[] a) | 返回指定數(shù)組內(nèi)容的字符串表示形式。 |
| 從類 java.lang.Object 繼承的方法 |
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
方法詳情
sort
public static void sort(int[] a)
將指定的數(shù)組按數(shù)字升序排序。
實施說明:排序算法是 Vladimir Yaroslavskiy、Jon Bentley 和 Joshua Bloch 的 Dual-Pivot Quicksort。 該算法在許多數(shù)據(jù)集上提供 O(n log(n)) 性能,導致其他快速排序降低到二次性能,并且通常比傳統(tǒng)的(單軸)快速排序?qū)崿F(xiàn)更快。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
sort
public static void sort(int[] a, int fromIndex, int toIndex)
將數(shù)組的指定范圍按升序排序。 要排序的范圍從索引 fromIndex(含)延伸到索引 toIndex(不含)。 如果 fromIndex == toIndex,則要排序的范圍為空。
實施說明:排序算法是 Vladimir Yaroslavskiy、Jon Bentley 和 Joshua Bloch 的 Dual-Pivot Quicksort。 該算法在許多數(shù)據(jù)集上提供 O(n log(n)) 性能,導致其他快速排序降低到二次性能,并且通常比傳統(tǒng)的(單軸)快速排序?qū)崿F(xiàn)更快。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
| fromIndex | 要排序的第一個元素(包括)的索引 |
| toIndex | 要排序的最后一個元素的索引,排他性 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果 fromIndex > toIndex |
| ArrayIndexOutOfBoundsException | 如果 fromIndex < 0 或 toIndex > a.length |
sort
public static void sort(long[] a)
將指定的數(shù)組按數(shù)字升序排序。
實施說明:排序算法是 Vladimir Yaroslavskiy、Jon Bentley 和 Joshua Bloch 的 Dual-Pivot Quicksort。 該算法在許多數(shù)據(jù)集上提供 O(n log(n)) 性能,導致其他快速排序降低到二次性能,并且通常比傳統(tǒng)的(單軸)快速排序?qū)崿F(xiàn)更快。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
sort
public static void sort(long[] a, int fromIndex, int toIndex)
將數(shù)組的指定范圍按升序排序。 要排序的范圍從索引 fromIndex(含)延伸到索引 toIndex(不含)。 如果 fromIndex == toIndex,則要排序的范圍為空。
實施說明:排序算法是 Vladimir Yaroslavskiy、Jon Bentley 和 Joshua Bloch 的 Dual-Pivot Quicksort。 該算法在許多數(shù)據(jù)集上提供 O(n log(n)) 性能,導致其他快速排序降低到二次性能,并且通常比傳統(tǒng)的(單軸)快速排序?qū)崿F(xiàn)更快。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
| fromIndex | 要排序的第一個元素(包括)的索引 |
| toIndex | 要排序的最后一個元素的索引,排他性 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果 fromIndex > toIndex |
| ArrayIndexOutOfBoundsException | 如果 fromIndex < 0 或 toIndex > a.length |
sort
public static void sort(short[] a)
將指定的數(shù)組按數(shù)字升序排序。
實施說明:排序算法是 Vladimir Yaroslavskiy、Jon Bentley 和 Joshua Bloch 的 Dual-Pivot Quicksort。 該算法在許多數(shù)據(jù)集上提供 O(n log(n)) 性能,導致其他快速排序降低到二次性能,并且通常比傳統(tǒng)的(單軸)快速排序?qū)崿F(xiàn)更快。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
sort
public static void sort(short[] a, int fromIndex, int toIndex)
將數(shù)組的指定范圍按升序排序。 要排序的范圍從索引 fromIndex(含)延伸到索引 toIndex(不含)。 如果 fromIndex == toIndex,則要排序的范圍為空。
實施說明:排序算法是 Vladimir Yaroslavskiy、Jon Bentley 和 Joshua Bloch 的 Dual-Pivot Quicksort。 該算法在許多數(shù)據(jù)集上提供 O(n log(n)) 性能,導致其他快速排序降低到二次性能,并且通常比傳統(tǒng)的(單軸)快速排序?qū)崿F(xiàn)更快。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
| fromIndex | 要排序的第一個元素(包括)的索引 |
| toIndex | 要排序的最后一個元素的索引,排他性 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果 fromIndex > toIndex |
| ArrayIndexOutOfBoundsException | 如果 fromIndex < 0 或 toIndex > a.length |
sort
public static void sort(char[] a)
將指定的數(shù)組按數(shù)字升序排序。
實施說明:排序算法是 Vladimir Yaroslavskiy、Jon Bentley 和 Joshua Bloch 的 Dual-Pivot Quicksort。 該算法在許多數(shù)據(jù)集上提供 O(n log(n)) 性能,導致其他快速排序降低到二次性能,并且通常比傳統(tǒng)的(單軸)快速排序?qū)崿F(xiàn)更快。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
sort
public static void sort(char[] a, int fromIndex, int toIndex)
將數(shù)組的指定范圍按升序排序。 要排序的范圍從索引 fromIndex(含)延伸到索引 toIndex(不含)。 如果 fromIndex == toIndex,則要排序的范圍為空。
實施說明:排序算法是 Vladimir Yaroslavskiy、Jon Bentley 和 Joshua Bloch 的 Dual-Pivot Quicksort。 該算法在許多數(shù)據(jù)集上提供 O(n log(n)) 性能,導致其他快速排序降低到二次性能,并且通常比傳統(tǒng)的(單軸)快速排序?qū)崿F(xiàn)更快。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
| fromIndex | 要排序的第一個元素(包括)的索引 |
| toIndex | 要排序的最后一個元素的索引,排他性 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果 fromIndex > toIndex |
| ArrayIndexOutOfBoundsException | 如果 fromIndex < 0 或 toIndex > a.length |
sort
public static void sort(byte[] a)
將指定的數(shù)組按數(shù)字升序排序。
實施說明:排序算法是 Vladimir Yaroslavskiy、Jon Bentley 和 Joshua Bloch 的 Dual-Pivot Quicksort。 該算法在許多數(shù)據(jù)集上提供 O(n log(n)) 性能,導致其他快速排序降低到二次性能,并且通常比傳統(tǒng)的(單軸)快速排序?qū)崿F(xiàn)更快。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
sort
public static void sort(byte[] a, int fromIndex, int toIndex)
將數(shù)組的指定范圍按升序排序。 要排序的范圍從索引 fromIndex(含)延伸到索引 toIndex(不含)。 如果 fromIndex == toIndex,則要排序的范圍為空。
實施說明:排序算法是 Vladimir Yaroslavskiy、Jon Bentley 和 Joshua Bloch 的 Dual-Pivot Quicksort。 該算法在許多數(shù)據(jù)集上提供 O(n log(n)) 性能,導致其他快速排序降低到二次性能,并且通常比傳統(tǒng)的(單軸)快速排序?qū)崿F(xiàn)更快。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
| fromIndex | 要排序的第一個元素(包括)的索引 |
| toIndex | 要排序的最后一個元素的索引,排他性 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果 fromIndex > toIndex |
| ArrayIndexOutOfBoundsException | 如果 fromIndex < 0 或 toIndex > a.length |
sort
public static void sort(float[] a)
將指定的數(shù)組按數(shù)字升序排序。
< 關系不提供所有浮點值的總順序:-0.0f == 0.0f 為真,并且 Float.NaN 值比較不小于、大于或等于任何值,甚至它本身。 此方法使用 Float#compareTo 方法施加的總順序:-0.0f 被視為小于值 0.0f,F(xiàn)loat.NaN 被視為大于任何其他值,并且所有 Float.NaN 值被視為相等。
實施說明:排序算法是 Vladimir Yaroslavskiy、Jon Bentley 和 Joshua Bloch 的 Dual-Pivot Quicksort。 該算法在許多數(shù)據(jù)集上提供 O(n log(n)) 性能,導致其他快速排序降低到二次性能,并且通常比傳統(tǒng)的(單軸)快速排序?qū)崿F(xiàn)更快。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
sort
public static void sort(float[] a, int fromIndex, int toIndex)
將數(shù)組的指定范圍按升序排序。 要排序的范圍從索引 fromIndex(含)延伸到索引 toIndex(不含)。 如果 fromIndex == toIndex,則要排序的范圍為空。
< 關系不提供所有浮點值的總順序:-0.0f == 0.0f 為真,并且 Float.NaN 值比較不小于、大于或等于任何值,甚至它本身。 此方法使用 Float#compareTo 方法施加的總順序:-0.0f 被視為小于值 0.0f,F(xiàn)loat.NaN 被視為大于任何其他值,并且所有 Float.NaN 值被視為相等。
實施說明:排序算法是 Vladimir Yaroslavskiy、Jon Bentley 和 Joshua Bloch 的 Dual-Pivot Quicksort。 該算法在許多數(shù)據(jù)集上提供 O(n log(n)) 性能,導致其他快速排序降低到二次性能,并且通常比傳統(tǒng)的(單軸)快速排序?qū)崿F(xiàn)更快。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
| fromIndex | 要排序的第一個元素(包括)的索引 |
| toIndex | 要排序的最后一個元素的索引,排他性 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果 fromIndex > toIndex |
| ArrayIndexOutOfBoundsException | 如果 fromIndex < 0 或 toIndex > a.length |
sort
public static void sort(double[] a)
將指定的數(shù)組按數(shù)字升序排序。
< 關系不提供所有雙精度值的總順序:-0.0d == 0.0d 為真,并且 Double.NaN 值比較不小于、大于或等于任何值,甚至它本身。 此方法使用 Double#compareTo 方法施加的總順序:-0.0d 被視為小于值 0.0d,Double.NaN 被視為大于任何其他值,并且所有 Double.NaN 值被視為相等。
實施說明:排序算法是 Vladimir Yaroslavskiy、Jon Bentley 和 Joshua Bloch 的 Dual-Pivot Quicksort。 該算法在許多數(shù)據(jù)集上提供 O(n log(n)) 性能,導致其他快速排序降低到二次性能,并且通常比傳統(tǒng)的(單軸)快速排序?qū)崿F(xiàn)更快。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
sort
public static void sort(double[] a, int fromIndex, int toIndex)
將數(shù)組的指定范圍按升序排序。 要排序的范圍從索引 fromIndex(含)延伸到索引 toIndex(不含)。 如果 fromIndex == toIndex,則要排序的范圍為空。
< 關系不提供所有雙精度值的總順序:-0.0d == 0.0d 為真,并且 Double.NaN 值比較不小于、大于或等于任何值,甚至它本身。 此方法使用 Double#compareTo 方法施加的總順序:-0.0d 被視為小于值 0.0d,Double.NaN 被視為大于任何其他值,并且所有 Double.NaN 值被視為相等。
實施說明:排序算法是 Vladimir Yaroslavskiy、Jon Bentley 和 Joshua Bloch 的 Dual-Pivot Quicksort。 該算法在許多數(shù)據(jù)集上提供 O(n log(n)) 性能,導致其他快速排序降低到二次性能,并且通常比傳統(tǒng)的(單軸)快速排序?qū)崿F(xiàn)更快。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
| fromIndex | 要排序的第一個元素(包括)的索引 |
| toIndex | 要排序的最后一個元素的索引,排他性 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果 fromIndex > toIndex |
| ArrayIndexOutOfBoundsException | 如果 fromIndex < 0 或 toIndex > a.length |
parallelSort
public static void parallelSort(byte[] a)
將指定的數(shù)組按數(shù)字升序排序。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
parallelSort
public static void parallelSort(byte[] a, int fromIndex, int toIndex)
將數(shù)組的指定范圍按數(shù)字升序排序。 要排序的范圍從索引 fromIndex(含)延伸到索引 toIndex(不含)。 如果 fromIndex == toIndex,則要排序的范圍為空。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
| fromIndex | 要排序的第一個元素(包括)的索引 |
| toIndex | 要排序的最后一個元素的索引,排他性 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果 fromIndex > toIndex |
| ArrayIndexOutOfBoundsException | 如果 fromIndex < 0 或 toIndex > a.length |
parallelSort
public static void parallelSort(char[] a)
將指定的數(shù)組按數(shù)字升序排序。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
parallelSort
public static void parallelSort(char[] a, int fromIndex, int toIndex)
將數(shù)組的指定范圍按數(shù)字升序排序。 要排序的范圍從索引 fromIndex(含)延伸到索引 toIndex(不含)。 如果 fromIndex == toIndex,則要排序的范圍為空。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
| fromIndex | 要排序的第一個元素(包括)的索引 |
| toIndex | 要排序的最后一個元素的索引,排他性 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果 fromIndex > toIndex |
| ArrayIndexOutOfBoundsException | 如果 fromIndex < 0 或 toIndex > a.length |
parallelSort
public static void parallelSort(short[] a)
將指定的數(shù)組按數(shù)字升序排序。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
parallelSort
public static void parallelSort(short[] a, int fromIndex, int toIndex)
將數(shù)組的指定范圍按數(shù)字升序排序。 要排序的范圍從索引 fromIndex(含)延伸到索引 toIndex(不含)。 如果 fromIndex == toIndex,則要排序的范圍為空。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
| fromIndex | 要排序的第一個元素(包括)的索引 |
| toIndex | 要排序的最后一個元素的索引,排他性 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果 fromIndex > toIndex |
| ArrayIndexOutOfBoundsException | 如果 fromIndex < 0 或 toIndex > a.length |
parallelSort
public static void parallelSort(int[] a)
將指定的數(shù)組按數(shù)字升序排序。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
parallelSort
public static void parallelSort(int[] a, int fromIndex, int toIndex)
將數(shù)組的指定范圍按數(shù)字升序排序。 要排序的范圍從索引 fromIndex(含)延伸到索引 toIndex(不含)。 如果 fromIndex == toIndex,則要排序的范圍為空。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
| fromIndex | 要排序的第一個元素(包括)的索引 |
| toIndex | 要排序的最后一個元素的索引,排他性 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果 fromIndex > toIndex |
| ArrayIndexOutOfBoundsException | 如果 fromIndex < 0 或 toIndex > a.length |
parallelSort
public static void parallelSort(long[] a)
將指定的數(shù)組按數(shù)字升序排序。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
parallelSort
public static void parallelSort(long[] a, int fromIndex, int toIndex)
將數(shù)組的指定范圍按數(shù)字升序排序。 要排序的范圍從索引 fromIndex(含)延伸到索引 toIndex(不含)。 如果 fromIndex == toIndex,則要排序的范圍為空。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
| fromIndex | 要排序的第一個元素(包括)的索引 |
| toIndex | 要排序的最后一個元素的索引,排他性 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果 fromIndex > toIndex |
| ArrayIndexOutOfBoundsException | 如果 fromIndex < 0 或 toIndex > a.length |
parallelSort
public static void parallelSort(float[] a)
將指定的數(shù)組按數(shù)字升序排序。
< 關系不提供所有浮點值的總順序:-0.0f == 0.0f 為真,并且 Float.NaN 值比較不小于、大于或等于任何值,甚至它本身。 此方法使用 Float#compareTo 方法施加的總順序:-0.0f 被視為小于值 0.0f,F(xiàn)loat.NaN 被視為大于任何其他值,并且所有 Float.NaN 值被視為相等。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
parallelSort
public static void parallelSort(float[] a, int fromIndex, int toIndex)
將數(shù)組的指定范圍按數(shù)字升序排序。 要排序的范圍從索引 fromIndex(含)延伸到索引 toIndex(不含)。 如果 fromIndex == toIndex,則要排序的范圍為空。
< 關系不提供所有浮點值的總順序:-0.0f == 0.0f 為真,并且 Float.NaN 值比較不小于、大于或等于任何值,甚至它本身。 此方法使用 Float#compareTo 方法施加的總順序:-0.0f 被視為小于值 0.0f,F(xiàn)loat.NaN 被視為大于任何其他值,并且所有 Float.NaN 值被視為相等。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
| fromIndex | 要排序的第一個元素(包括)的索引 |
| toIndex | 要排序的最后一個元素的索引,排他性 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果 fromIndex > toIndex |
| ArrayIndexOutOfBoundsException | 如果 fromIndex < 0 或 toIndex > a.length |
parallelSort
public static void parallelSort(double[] a)
將指定的數(shù)組按數(shù)字升序排序。
< 關系不提供所有雙精度值的總順序:-0.0d == 0.0d 為真,并且 Double.NaN 值比較不小于、大于或等于任何值,甚至它本身。 此方法使用 Double#compareTo 方法施加的總順序:-0.0d 被視為小于值 0.0d,Double.NaN 被視為大于任何其他值,并且所有 Double.NaN 值被視為相等。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
parallelSort
public static void parallelSort(double[] a, int fromIndex, int toIndex)
將數(shù)組的指定范圍按數(shù)字升序排序。 要排序的范圍從索引 fromIndex(含)延伸到索引 toIndex(不含)。 如果 fromIndex == toIndex,則要排序的范圍為空。
< 關系不提供所有雙精度值的總順序:-0.0d == 0.0d 為真,并且 Double.NaN 值比較不小于、大于或等于任何值,甚至它本身。 此方法使用 Double#compareTo 方法施加的總順序:-0.0d 被視為小于值 0.0d,Double.NaN 被視為大于任何其他值,并且所有 Double.NaN 值被視為相等。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
| fromIndex | 要排序的第一個元素(包括)的索引 |
| toIndex | 要排序的最后一個元素的索引,排他性 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果 fromIndex > toIndex |
| ArrayIndexOutOfBoundsException | 如果 fromIndex < 0 或 toIndex > a.length |
parallelSort
public static
根據(jù)其元素的 Comparable 對指定的對象數(shù)組進行升序排序。 數(shù)組中的所有元素都必須實現(xiàn) Comparable 接口。 此外,數(shù)組中的所有元素必須相互可比較(即,e1.compareTo(e2) 不得為數(shù)組中的任何元素 e1 和 e2 拋出 ClassCastException)。
這種排序保證是穩(wěn)定的:相同的元素不會因為排序而重新排序。
類型參數(shù):
| 類型參數(shù)名稱 | 類型參數(shù)描述 |
|---|---|
| T | 要排序的對象的類 |
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| ClassCastException | 如果數(shù)組包含不可相互比較的元素(例如,字符串和整數(shù)) |
| IllegalArgumentException | (可選)如果發(fā)現(xiàn)數(shù)組元素的自然順序違反了 Comparable 合約 |
parallelSort
public static
根據(jù)其元素的 Comparable 對指定對象數(shù)組的指定范圍進行升序排序。 要排序的范圍從 index fromIndex(包括)擴展到 index toIndex(不包括)。 (如果fromIndex==toIndex,則要排序的范圍為空。)該范圍內(nèi)的所有元素都必須實現(xiàn)Comparable接口。 此外,此范圍內(nèi)的所有元素必須相互可比較(即,e1.compareTo(e2) 不得為數(shù)組中的任何元素 e1 和 e2 拋出 ClassCastException)。
這種排序保證是穩(wěn)定的:相同的元素不會因為排序而重新排序。
類型參數(shù):
| 類型參數(shù)名稱 | 類型參數(shù)描述 |
|---|---|
| T | 要排序的對象的類 |
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| a | 要排序的數(shù)組 |
| fromIndex | 要排序的第一個元素(包括)的索引 |
| toIndex | 要排序的最后一個元素(不包括)的索引 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果 fromIndex > toIndex 或(可選)如果發(fā)現(xiàn)數(shù)組元素的 本文名稱:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSArrays 網(wǎng)頁鏈接:http://www.dlmjj.cn/article/codcgoj.html |


咨詢
建站咨詢
