Lines Matching refs:fromIndex
81 * to be sorted extends from the index {@code fromIndex}, inclusive, to
82 * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
92 * @param fromIndex the index of the first element, inclusive, to be sorted
95 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
97 * if {@code fromIndex < 0} or {@code toIndex > a.length}
99 public static void sort(int[] a, int fromIndex, int toIndex) {
100 rangeCheck(a.length, fromIndex, toIndex);
101 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1);
121 * to be sorted extends from the index {@code fromIndex}, inclusive, to
122 * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
132 * @param fromIndex the index of the first element, inclusive, to be sorted
135 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
137 * if {@code fromIndex < 0} or {@code toIndex > a.length}
139 public static void sort(long[] a, int fromIndex, int toIndex) {
140 rangeCheck(a.length, fromIndex, toIndex);
141 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1);
161 * to be sorted extends from the index {@code fromIndex}, inclusive, to
162 * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
172 * @param fromIndex the index of the first element, inclusive, to be sorted
175 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
177 * if {@code fromIndex < 0} or {@code toIndex > a.length}
179 public static void sort(short[] a, int fromIndex, int toIndex) {
180 rangeCheck(a.length, fromIndex, toIndex);
181 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1);
201 * to be sorted extends from the index {@code fromIndex}, inclusive, to
202 * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
212 * @param fromIndex the index of the first element, inclusive, to be sorted
215 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
217 * if {@code fromIndex < 0} or {@code toIndex > a.length}
219 public static void sort(char[] a, int fromIndex, int toIndex) {
220 rangeCheck(a.length, fromIndex, toIndex);
221 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1);
241 * to be sorted extends from the index {@code fromIndex}, inclusive, to
242 * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
252 * @param fromIndex the index of the first element, inclusive, to be sorted
255 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
257 * if {@code fromIndex < 0} or {@code toIndex > a.length}
259 public static void sort(byte[] a, int fromIndex, int toIndex) {
260 rangeCheck(a.length, fromIndex, toIndex);
261 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1);
289 * to be sorted extends from the index {@code fromIndex}, inclusive, to
290 * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
308 * @param fromIndex the index of the first element, inclusive, to be sorted
311 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
313 * if {@code fromIndex < 0} or {@code toIndex > a.length}
315 public static void sort(float[] a, int fromIndex, int toIndex) {
316 rangeCheck(a.length, fromIndex, toIndex);
317 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1);
345 * to be sorted extends from the index {@code fromIndex}, inclusive, to
346 * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
364 * @param fromIndex the index of the first element, inclusive, to be sorted
367 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
369 * if {@code fromIndex < 0} or {@code toIndex > a.length}
371 public static void sort(double[] a, int fromIndex, int toIndex) {
372 rangeCheck(a.length, fromIndex, toIndex);
373 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1);
422 // public static void sort(Object[] a, int fromIndex, int toIndex) {
423 // sort(a, fromIndex, toIndex, NATURAL_ORDER);
486 * {@code fromIndex}, inclusive, to index {@code toIndex}, exclusive.
487 * (If {@code fromIndex==toIndex}, the range to be sorted is empty.) All
521 * @param fromIndex the index of the first element (inclusive) to be
524 * @throws IllegalArgumentException if {@code fromIndex > toIndex} or
527 * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or
533 public static void sort(Object[] a, int fromIndex, int toIndex) {
535 legacyMergeSort(a, fromIndex, toIndex);
537 ComparableTimSort.sort(a, fromIndex, toIndex);
542 int fromIndex, int toIndex) {
543 rangeCheck(a.length, fromIndex, toIndex);
544 Object[] aux = copyOfRange(a, fromIndex, toIndex);
545 mergeSort(aux, a, fromIndex, toIndex, -fromIndex);
674 * sorted extends from index {@code fromIndex}, inclusive, to index
675 * {@code toIndex}, exclusive. (If {@code fromIndex==toIndex}, the
708 * @param fromIndex the index of the first element (inclusive) to be
716 * @throws IllegalArgumentException if {@code fromIndex > toIndex} or
719 * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or
722 public static <T> void sort(T[] a, int fromIndex, int toIndex,
725 legacyMergeSort(a, fromIndex, toIndex, c);
727 TimSort.sort(a, fromIndex, toIndex, c);
731 private static <T> void legacyMergeSort(T[] a, int fromIndex, int toIndex,
733 rangeCheck(a.length, fromIndex, toIndex);
734 T[] aux = copyOfRange(a, fromIndex, toIndex);
736 mergeSort(aux, a, fromIndex, toIndex, -fromIndex);
738 mergeSort(aux, a, fromIndex, toIndex, -fromIndex, c);
789 * Checks that {@code fromIndex} and {@code toIndex} are in
792 private static void rangeCheck(int length, int fromIndex, int toIndex) {
793 if (fromIndex > toIndex) {
795 "fromIndex(" + fromIndex + ") > toIndex(" + toIndex + ")");
797 if (fromIndex < 0) {
798 throw new ArrayIndexOutOfBoundsException(fromIndex);
842 * @param fromIndex the index of the first element (inclusive) to be
857 * if {@code fromIndex > toIndex}
859 * if {@code fromIndex < 0 or toIndex > a.length}
862 public static int binarySearch(long[] a, int fromIndex, int toIndex,
864 rangeCheck(a.length, fromIndex, toIndex);
865 return binarySearch0(a, fromIndex, toIndex, key);
869 private static int binarySearch0(long[] a, int fromIndex, int toIndex,
871 int low = fromIndex;
923 * @param fromIndex the index of the first element (inclusive) to be
938 * if {@code fromIndex > toIndex}
940 * if {@code fromIndex < 0 or toIndex > a.length}
943 public static int binarySearch(int[] a, int fromIndex, int toIndex,
945 rangeCheck(a.length, fromIndex, toIndex);
946 return binarySearch0(a, fromIndex, toIndex, key);
950 private static int binarySearch0(int[] a, int fromIndex, int toIndex,
952 int low = fromIndex;
1004 * @param fromIndex the index of the first element (inclusive) to be
1019 * if {@code fromIndex > toIndex}
1021 * if {@code fromIndex < 0 or toIndex > a.length}
1024 public static int binarySearch(short[] a, int fromIndex, int toIndex,
1026 rangeCheck(a.length, fromIndex, toIndex);
1027 return binarySearch0(a, fromIndex, toIndex, key);
1031 private static int binarySearch0(short[] a, int fromIndex, int toIndex,
1033 int low = fromIndex;
1085 * @param fromIndex the index of the first element (inclusive) to be
1100 * if {@code fromIndex > toIndex}
1102 * if {@code fromIndex < 0 or toIndex > a.length}
1105 public static int binarySearch(char[] a, int fromIndex, int toIndex,
1107 rangeCheck(a.length, fromIndex, toIndex);
1108 return binarySearch0(a, fromIndex, toIndex, key);
1112 private static int binarySearch0(char[] a, int fromIndex, int toIndex,
1114 int low = fromIndex;
1166 * @param fromIndex the index of the first element (inclusive) to be
1181 * if {@code fromIndex > toIndex}
1183 * if {@code fromIndex < 0 or toIndex > a.length}
1186 public static int binarySearch(byte[] a, int fromIndex, int toIndex,
1188 rangeCheck(a.length, fromIndex, toIndex);
1189 return binarySearch0(a, fromIndex, toIndex, key);
1193 private static int binarySearch0(byte[] a, int fromIndex, int toIndex,
1195 int low = fromIndex;
1249 * @param fromIndex the index of the first element (inclusive) to be
1264 * if {@code fromIndex > toIndex}
1266 * if {@code fromIndex < 0 or toIndex > a.length}
1269 public static int binarySearch(double[] a, int fromIndex, int toIndex,
1271 rangeCheck(a.length, fromIndex, toIndex);
1272 return binarySearch0(a, fromIndex, toIndex, key);
1276 private static int binarySearch0(double[] a, int fromIndex, int toIndex,
1278 int low = fromIndex;
1340 * @param fromIndex the index of the first element (inclusive) to be
1355 * if {@code fromIndex > toIndex}
1357 * if {@code fromIndex < 0 or toIndex > a.length}
1360 public static int binarySearch(float[] a, int fromIndex, int toIndex,
1362 rangeCheck(a.length, fromIndex, toIndex);
1363 return binarySearch0(a, fromIndex, toIndex, key);
1367 private static int binarySearch0(float[] a, int fromIndex, int toIndex,
1369 int low = fromIndex;
1444 * @param fromIndex the index of the first element (inclusive) to be
1461 * if {@code fromIndex > toIndex}
1463 * if {@code fromIndex < 0 or toIndex > a.length}
1466 public static int binarySearch(Object[] a, int fromIndex, int toIndex,
1468 rangeCheck(a.length, fromIndex, toIndex);
1469 return binarySearch0(a, fromIndex, toIndex, key);
1473 private static int binarySearch0(Object[] a, int fromIndex, int toIndex,
1475 int low = fromIndex;
1540 * @param fromIndex the index of the first element (inclusive) to be
1562 * if {@code fromIndex > toIndex}
1564 * if {@code fromIndex < 0 or toIndex > a.length}
1567 public static <T> int binarySearch(T[] a, int fromIndex, int toIndex,
1569 rangeCheck(a.length, fromIndex, toIndex);
1570 return binarySearch0(a, fromIndex, toIndex, key, c);
1574 private static <T> int binarySearch0(T[] a, int fromIndex, int toIndex,
1577 return binarySearch0(a, fromIndex, toIndex, key);
1579 int low = fromIndex;
1893 * extends from index <tt>fromIndex</tt>, inclusive, to index
1894 * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the
1898 * @param fromIndex the index of the first element (inclusive) to be
1903 * @throws IllegalArgumentException if <tt>fromIndex > toIndex</tt>
1904 * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex < 0</tt> or
1907 public static void fill(long[] a, int fromIndex, int toIndex, long val) {
1908 rangeCheck(a.length, fromIndex, toIndex);
1909 for (int i = fromIndex; i < toIndex; i++)
1928 * extends from index <tt>fromIndex</tt>, inclusive, to index
1929 * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the
1933 * @param fromIndex the index of the first element (inclusive) to be
1938 * @throws IllegalArgumentException if <tt>fromIndex > toIndex</tt>
1939 * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex < 0</tt> or
1942 public static void fill(int[] a, int fromIndex, int toIndex, int val) {
1943 rangeCheck(a.length, fromIndex, toIndex);
1944 for (int i = fromIndex; i < toIndex; i++)
1963 * extends from index <tt>fromIndex</tt>, inclusive, to index
1964 * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the
1968 * @param fromIndex the index of the first element (inclusive) to be
1973 * @throws IllegalArgumentException if <tt>fromIndex > toIndex</tt>
1974 * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex < 0</tt> or
1977 public static void fill(short[] a, int fromIndex, int toIndex, short val) {
1978 rangeCheck(a.length, fromIndex, toIndex);
1979 for (int i = fromIndex; i < toIndex; i++)
1998 * extends from index <tt>fromIndex</tt>, inclusive, to index
1999 * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the
2003 * @param fromIndex the index of the first element (inclusive) to be
2008 * @throws IllegalArgumentException if <tt>fromIndex > toIndex</tt>
2009 * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex < 0</tt> or
2012 public static void fill(char[] a, int fromIndex, int toIndex, char val) {
2013 rangeCheck(a.length, fromIndex, toIndex);
2014 for (int i = fromIndex; i < toIndex; i++)
2033 * extends from index <tt>fromIndex</tt>, inclusive, to index
2034 * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the
2038 * @param fromIndex the index of the first element (inclusive) to be
2043 * @throws IllegalArgumentException if <tt>fromIndex > toIndex</tt>
2044 * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex < 0</tt> or
2047 public static void fill(byte[] a, int fromIndex, int toIndex, byte val) {
2048 rangeCheck(a.length, fromIndex, toIndex);
2049 for (int i = fromIndex; i < toIndex; i++)
2068 * extends from index <tt>fromIndex</tt>, inclusive, to index
2069 * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the
2073 * @param fromIndex the index of the first element (inclusive) to be
2078 * @throws IllegalArgumentException if <tt>fromIndex > toIndex</tt>
2079 * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex < 0</tt> or
2082 public static void fill(boolean[] a, int fromIndex, int toIndex,
2084 rangeCheck(a.length, fromIndex, toIndex);
2085 for (int i = fromIndex; i < toIndex; i++)
2104 * extends from index <tt>fromIndex</tt>, inclusive, to index
2105 * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the
2109 * @param fromIndex the index of the first element (inclusive) to be
2114 * @throws IllegalArgumentException if <tt>fromIndex > toIndex</tt>
2115 * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex < 0</tt> or
2118 public static void fill(double[] a, int fromIndex, int toIndex,double val){
2119 rangeCheck(a.length, fromIndex, toIndex);
2120 for (int i = fromIndex; i < toIndex; i++)
2139 * extends from index <tt>fromIndex</tt>, inclusive, to index
2140 * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the
2144 * @param fromIndex the index of the first element (inclusive) to be
2149 * @throws IllegalArgumentException if <tt>fromIndex > toIndex</tt>
2150 * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex < 0</tt> or
2153 public static void fill(float[] a, int fromIndex, int toIndex, float val) {
2154 rangeCheck(a.length, fromIndex, toIndex);
2155 for (int i = fromIndex; i < toIndex; i++)
2176 * extends from index <tt>fromIndex</tt>, inclusive, to index
2177 * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the
2181 * @param fromIndex the index of the first element (inclusive) to be
2186 * @throws IllegalArgumentException if <tt>fromIndex > toIndex</tt>
2187 * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex < 0</tt> or
2192 public static void fill(Object[] a, int fromIndex, int toIndex, Object val) {
2193 rangeCheck(a.length, fromIndex, toIndex);
2194 for (int i = fromIndex; i < toIndex; i++)