| Modifier and Type | Method and Description |
|---|---|
static int |
binarySearch(byte[] a,
byte key,
ByteComparator c)
Searches the specified array for the specified
key using the binary
search algorithm. |
static int |
binarySearch(byte[] a,
int fromIndex,
int toIndex,
byte key,
ByteComparator c)
Searches a range of
the specified array for the specified
key using the binary
search algorithm. |
static int |
binarySearch(char[] a,
char key,
CharComparator c)
Searches the specified array for the specified
key using the binary
search algorithm. |
static int |
binarySearch(char[] a,
int fromIndex,
int toIndex,
char key,
CharComparator c)
Searches a range of
the specified array for the specified
key using the binary
search algorithm. |
static int |
binarySearch(double[] a,
double key,
DoubleComparator c)
Searches the specified array for the specified
key using the binary
search algorithm. |
static int |
binarySearch(double[] a,
int fromIndex,
int toIndex,
double key,
DoubleComparator c)
Searches a range of
the specified array for the specified
key using the binary
search algorithm. |
static int |
binarySearch(float[] a,
float key,
FloatComparator c)
Searches the specified array for the specified
key using the binary
search algorithm. |
static int |
binarySearch(float[] a,
int fromIndex,
int toIndex,
float key,
FloatComparator c)
Searches a range of
the specified array for the specified
key using the binary
search algorithm. |
static int |
binarySearch(int[] a,
int key,
IntComparator c)
Searches the specified array for the specified
key using the binary
search algorithm. |
static int |
binarySearch(int[] a,
int fromIndex,
int toIndex,
int key,
IntComparator c)
Searches a range of
the specified array for the specified
key using the binary
search algorithm. |
static int |
binarySearch(long[] a,
int fromIndex,
int toIndex,
long key,
LongComparator c)
Searches a range of
the specified array for the specified
key using the binary
search algorithm. |
static int |
binarySearch(long[] a,
long key,
LongComparator c)
Searches the specified array for the specified
key using the binary
search algorithm. |
static int |
binarySearch(short[] a,
int fromIndex,
int toIndex,
short key,
ShortComparator c)
Searches a range of
the specified array for the specified
key using the binary
search algorithm. |
static int |
binarySearch(short[] a,
short key,
ShortComparator c)
Searches the specified array for the specified
key using the binary
search algorithm. |
static void |
sort(boolean[] a)
Sorts the given array so that all the
false values are at the
beginning. |
static void |
sort(boolean[] a,
BooleanComparator c)
Sorts the given array by the given comparator.
|
static void |
sort(boolean[] a,
int fromIndex,
int toIndex)
Sorts the indicated portion of the given array so that all the
false values are at the beginning. |
static void |
sort(boolean[] a,
int fromIndex,
int toIndex,
BooleanComparator c)
Sorts the indicated portion of the given array by the given comparator.
|
static void |
sort(byte[] a,
ByteComparator c)
Sorts the given array by the given comparator.
|
static void |
sort(byte[] a,
ByteComparator c,
boolean stable)
Sorts the given array by the given comparator.
|
static void |
sort(byte[] a,
int fromIndex,
int toIndex,
ByteComparator c)
Sorts the indicated portion of the given array by the given comparator.
|
static void |
sort(byte[] a,
int fromIndex,
int toIndex,
ByteComparator c,
boolean stable)
Sorts the indicated portion of the given array by the given comparator.
|
static void |
sort(char[] a,
CharComparator c)
Sorts the given array by the given comparator.
|
static void |
sort(char[] a,
CharComparator c,
boolean stable)
Sorts the given array by the given comparator.
|
static void |
sort(char[] a,
int fromIndex,
int toIndex,
CharComparator c)
Sorts the indicated portion of the given array by the given comparator.
|
static void |
sort(char[] a,
int fromIndex,
int toIndex,
CharComparator c,
boolean stable)
Sorts the indicated portion of the given array by the given comparator.
|
static void |
sort(double[] a,
DoubleComparator c)
Sorts the given array by the given comparator.
|
static void |
sort(double[] a,
DoubleComparator c,
boolean stable)
Sorts the given array by the given comparator.
|
static void |
sort(double[] a,
int fromIndex,
int toIndex,
DoubleComparator c)
Sorts the indicated portion of the given array by the given comparator.
|
static void |
sort(double[] a,
int fromIndex,
int toIndex,
DoubleComparator c,
boolean stable)
Sorts the indicated portion of the given array by the given comparator.
|
static void |
sort(float[] a,
FloatComparator c)
Sorts the given array by the given comparator.
|
static void |
sort(float[] a,
FloatComparator c,
boolean stable)
Sorts the given array by the given comparator.
|
static void |
sort(float[] a,
int fromIndex,
int toIndex,
FloatComparator c)
Sorts the indicated portion of the given array by the given comparator.
|
static void |
sort(float[] a,
int fromIndex,
int toIndex,
FloatComparator c,
boolean stable)
Sorts the indicated portion of the given array by the given comparator.
|
static void |
sort(int[] a,
IntComparator c)
Sorts the given array by the given comparator.
|
static void |
sort(int[] a,
IntComparator c,
boolean stable)
Sorts the given array by the given comparator.
|
static void |
sort(int[] a,
int fromIndex,
int toIndex,
IntComparator c)
Sorts the indicated portion of the given array by the given comparator.
|
static void |
sort(int[] a,
int fromIndex,
int toIndex,
IntComparator c,
boolean stable)
Sorts the indicated portion of the given array by the given comparator.
|
static void |
sort(long[] a,
int fromIndex,
int toIndex,
LongComparator c)
Sorts the indicated portion of the given array by the given comparator.
|
static void |
sort(long[] a,
int fromIndex,
int toIndex,
LongComparator c,
boolean stable)
Sorts the indicated portion of the given array by the given comparator.
|
static void |
sort(long[] a,
LongComparator c)
Sorts the given array by the given comparator.
|
static void |
sort(long[] a,
LongComparator c,
boolean stable)
Sorts the given array by the given comparator.
|
static void |
sort(short[] a,
int fromIndex,
int toIndex,
ShortComparator c)
Sorts the indicated portion of the given array by the given comparator.
|
static void |
sort(short[] a,
int fromIndex,
int toIndex,
ShortComparator c,
boolean stable)
Sorts the indicated portion of the given array by the given comparator.
|
static void |
sort(short[] a,
ShortComparator c)
Sorts the given array by the given comparator.
|
static void |
sort(short[] a,
ShortComparator c,
boolean stable)
Sorts the given array by the given comparator.
|
public static void sort(boolean[] a)
false values are at the
beginning.a - the array to sortNullPointerException - if a == nullpublic static void sort(boolean[] a,
int fromIndex,
int toIndex)
false values are at the beginning.a - the array to sortfromIndex - the index (inclusive) marking the beginning of the array
portiontoIndex - the index (exclusive) marking the end of the array portionNullPointerException - if a == nullArrayIndexOutOfBoundsException - if fromIndex < 0 or
toIndex > a.lengthIllegalArgumentException - if fromIndex > toIndexpublic static void sort(boolean[] a,
BooleanComparator c)
a - the array to sortc - the comparator to use for sorting the array, or null for
natural orderingNullPointerException - if a == nullIllegalArgumentException - if sorting finds that c violates
the BooleanComparator contractpublic static void sort(boolean[] a,
int fromIndex,
int toIndex,
BooleanComparator c)
a - the array to sortfromIndex - the index (inclusive) marking the beginning of the array
portiontoIndex - the index (exclusive) marking the end of the array portionc - the comparator to use for sorting the array, or null for
natural orderingNullPointerException - if a == nullArrayIndexOutOfBoundsException - if fromIndex < 0 or
toIndex > a.lengthIllegalArgumentException - if fromIndex > toIndex or
sorting finds that c violates the BooleanComparator
contractpublic static void sort(byte[] a,
ByteComparator c)
For uses that don't care about a stable sort, especially when the data
has no underlying patterns (that is, completely unsorted, random data),
the non-stable version of this method may be up to twice as fast. Use
sort(byte[], ByteComparator, boolean), with stable set to
false.
a - the array to sortc - the comparator to use for sorting the array, or null for
natural orderingNullPointerException - if a == nullIllegalArgumentException - if sorting finds that c violates
the ByteComparator contractpublic static void sort(byte[] a,
int fromIndex,
int toIndex,
ByteComparator c)
For uses that don't care about a stable sort, especially when the data
has no underlying patterns (that is, completely unsorted, random data),
the non-stable version of this method may be up to twice as fast. Use
sort(byte[], int, int, ByteComparator, boolean), with stable
set to false.
a - the array to sortfromIndex - the index (inclusive) marking the beginning of the array
portiontoIndex - the index (exclusive) marking the end of the array portionc - the comparator to use for sorting the array, or null for
natural orderingNullPointerException - if a == nullArrayIndexOutOfBoundsException - if fromIndex < 0 or
toIndex > a.lengthIllegalArgumentException - if fromIndex > toIndex or
sorting finds that c violates the ByteComparator
contractpublic static void sort(byte[] a,
ByteComparator c,
boolean stable)
stable is
true, the sorting algorithm will result in a stable sort, so two
items that compare to 0 will be kept in the same order when the sort is
complete. When false, no such guarantees are made, but the sort
may be up to twice as fast, especially for unpatterned data.a - the array to sortc - the comparator to use for sorting the array, or null for
natural orderingstable - whether to use a slower, but stable, sorting algorithmNullPointerException - if a == nullIllegalArgumentException - if sorting finds that c violates
the ByteComparator contractpublic static void sort(byte[] a,
int fromIndex,
int toIndex,
ByteComparator c,
boolean stable)
stable is true, the sorting algorithm will result in
a stable sort, so two items that compare to 0 will be kept in the same
order when the sort is complete. When false, no such guarantees
are made, but the sort may be up to twice as fast, especially for
unpatterned data.a - the array to sortfromIndex - the index (inclusive) marking the beginning of the array
portiontoIndex - the index (exclusive) marking the end of the array portionc - the comparator to use for sorting the array, or null for
natural orderingstable - whether to use a slower, but stable, sorting algorithmNullPointerException - if a == nullArrayIndexOutOfBoundsException - if fromIndex < 0 or
toIndex > a.lengthIllegalArgumentException - if fromIndex > toIndex or
sorting finds that c violates the ByteComparator
contractpublic static int binarySearch(byte[] a,
byte key,
ByteComparator c)
key using the binary
search algorithm. The array must be sorted into ascending order
according to the specified comparator (as by the
sort(byte[], ByteComparator)
method) prior to making this call. If it is
not sorted, the results are undefined.
If the array contains multiple
elements equal to the specified object, there is no guarantee which one
will be found.a - the array to be searchedkey - the value to be searched forc - the comparator by which the array is ordered. A
null value indicates that the elements'
natural ordering should be used.public static int binarySearch(byte[] a,
int fromIndex,
int toIndex,
byte key,
ByteComparator c)
key using the binary
search algorithm.
The array must be sorted into ascending order
according to the specified comparator (as by the
sort(byte[], int, int, ByteComparator)
method) prior to making this call.
If it is not sorted, the results are undefined.
If the range contains multiple elements equal to the specified object,
there is no guarantee which one will be found.a - the array to be searchedfromIndex - the index of the first element (inclusive) to be
searchedtoIndex - the index of the last element (exclusive) to be searchedkey - the value to be searched forc - the comparator by which the array is ordered. A
null value indicates that the elements'
natural ordering should be used.public static void sort(char[] a,
CharComparator c)
For uses that don't care about a stable sort, especially when the data
has no underlying patterns (that is, completely unsorted, random data),
the non-stable version of this method may be up to twice as fast. Use
sort(char[], CharComparator, boolean), with stable set to
false.
a - the array to sortc - the comparator to use for sorting the array, or null for
natural orderingNullPointerException - if a == nullIllegalArgumentException - if sorting finds that c violates
the CharComparator contractpublic static void sort(char[] a,
int fromIndex,
int toIndex,
CharComparator c)
For uses that don't care about a stable sort, especially when the data
has no underlying patterns (that is, completely unsorted, random data),
the non-stable version of this method may be up to twice as fast. Use
sort(char[], int, int, CharComparator, boolean), with stable
set to false.
a - the array to sortfromIndex - the index (inclusive) marking the beginning of the array
portiontoIndex - the index (exclusive) marking the end of the array portionc - the comparator to use for sorting the array, or null for
natural orderingNullPointerException - if a == nullArrayIndexOutOfBoundsException - if fromIndex < 0 or
toIndex > a.lengthIllegalArgumentException - if fromIndex > toIndex or
sorting finds that c violates the CharComparator
contractpublic static void sort(char[] a,
CharComparator c,
boolean stable)
stable is
true, the sorting algorithm will result in a stable sort, so two
items that compare to 0 will be kept in the same order when the sort is
complete. When false, no such guarantees are made, but the sort
may be up to twice as fast, especially for unpatterned data.a - the array to sortc - the comparator to use for sorting the array, or null for
natural orderingstable - whether to use a slower, but stable, sorting algorithmNullPointerException - if a == nullIllegalArgumentException - if sorting finds that c violates
the CharComparator contractpublic static void sort(char[] a,
int fromIndex,
int toIndex,
CharComparator c,
boolean stable)
stable is true, the sorting algorithm will result in
a stable sort, so two items that compare to 0 will be kept in the same
order when the sort is complete. When false, no such guarantees
are made, but the sort may be up to twice as fast, especially for
unpatterned data.a - the array to sortfromIndex - the index (inclusive) marking the beginning of the array
portiontoIndex - the index (exclusive) marking the end of the array portionc - the comparator to use for sorting the array, or null for
natural orderingstable - whether to use a slower, but stable, sorting algorithmNullPointerException - if a == nullArrayIndexOutOfBoundsException - if fromIndex < 0 or
toIndex > a.lengthIllegalArgumentException - if fromIndex > toIndex or
sorting finds that c violates the CharComparator
contractpublic static int binarySearch(char[] a,
char key,
CharComparator c)
key using the binary
search algorithm. The array must be sorted into ascending order
according to the specified comparator (as by the
sort(char[], CharComparator)
method) prior to making this call. If it is
not sorted, the results are undefined.
If the array contains multiple
elements equal to the specified object, there is no guarantee which one
will be found.a - the array to be searchedkey - the value to be searched forc - the comparator by which the array is ordered. A
null value indicates that the elements'
natural ordering should be used.public static int binarySearch(char[] a,
int fromIndex,
int toIndex,
char key,
CharComparator c)
key using the binary
search algorithm.
The array must be sorted into ascending order
according to the specified comparator (as by the
sort(char[], int, int, CharComparator)
method) prior to making this call.
If it is not sorted, the results are undefined.
If the range contains multiple elements equal to the specified object,
there is no guarantee which one will be found.a - the array to be searchedfromIndex - the index of the first element (inclusive) to be
searchedtoIndex - the index of the last element (exclusive) to be searchedkey - the value to be searched forc - the comparator by which the array is ordered. A
null value indicates that the elements'
natural ordering should be used.public static void sort(double[] a,
DoubleComparator c)
For uses that don't care about a stable sort, especially when the data
has no underlying patterns (that is, completely unsorted, random data),
the non-stable version of this method may be up to twice as fast. Use
sort(double[], DoubleComparator, boolean), with stable set to
false.
a - the array to sortc - the comparator to use for sorting the array, or null for
natural orderingNullPointerException - if a == nullIllegalArgumentException - if sorting finds that c violates
the DoubleComparator contractpublic static void sort(double[] a,
int fromIndex,
int toIndex,
DoubleComparator c)
For uses that don't care about a stable sort, especially when the data
has no underlying patterns (that is, completely unsorted, random data),
the non-stable version of this method may be up to twice as fast. Use
sort(double[], int, int, DoubleComparator, boolean), with stable
set to false.
a - the array to sortfromIndex - the index (inclusive) marking the beginning of the array
portiontoIndex - the index (exclusive) marking the end of the array portionc - the comparator to use for sorting the array, or null for
natural orderingNullPointerException - if a == nullArrayIndexOutOfBoundsException - if fromIndex < 0 or
toIndex > a.lengthIllegalArgumentException - if fromIndex > toIndex or
sorting finds that c violates the DoubleComparator
contractpublic static void sort(double[] a,
DoubleComparator c,
boolean stable)
stable is
true, the sorting algorithm will result in a stable sort, so two
items that compare to 0 will be kept in the same order when the sort is
complete. When false, no such guarantees are made, but the sort
may be up to twice as fast, especially for unpatterned data.a - the array to sortc - the comparator to use for sorting the array, or null for
natural orderingstable - whether to use a slower, but stable, sorting algorithmNullPointerException - if a == nullIllegalArgumentException - if sorting finds that c violates
the DoubleComparator contractpublic static void sort(double[] a,
int fromIndex,
int toIndex,
DoubleComparator c,
boolean stable)
stable is true, the sorting algorithm will result in
a stable sort, so two items that compare to 0 will be kept in the same
order when the sort is complete. When false, no such guarantees
are made, but the sort may be up to twice as fast, especially for
unpatterned data.a - the array to sortfromIndex - the index (inclusive) marking the beginning of the array
portiontoIndex - the index (exclusive) marking the end of the array portionc - the comparator to use for sorting the array, or null for
natural orderingstable - whether to use a slower, but stable, sorting algorithmNullPointerException - if a == nullArrayIndexOutOfBoundsException - if fromIndex < 0 or
toIndex > a.lengthIllegalArgumentException - if fromIndex > toIndex or
sorting finds that c violates the DoubleComparator
contractpublic static int binarySearch(double[] a,
double key,
DoubleComparator c)
key using the binary
search algorithm. The array must be sorted into ascending order
according to the specified comparator (as by the
sort(double[], DoubleComparator)
method) prior to making this call. If it is
not sorted, the results are undefined.
If the array contains multiple
elements equal to the specified object, there is no guarantee which one
will be found.a - the array to be searchedkey - the value to be searched forc - the comparator by which the array is ordered. A
null value indicates that the elements'
natural ordering should be used.public static int binarySearch(double[] a,
int fromIndex,
int toIndex,
double key,
DoubleComparator c)
key using the binary
search algorithm.
The array must be sorted into ascending order
according to the specified comparator (as by the
sort(double[], int, int, DoubleComparator)
method) prior to making this call.
If it is not sorted, the results are undefined.
If the range contains multiple elements equal to the specified object,
there is no guarantee which one will be found.a - the array to be searchedfromIndex - the index of the first element (inclusive) to be
searchedtoIndex - the index of the last element (exclusive) to be searchedkey - the value to be searched forc - the comparator by which the array is ordered. A
null value indicates that the elements'
natural ordering should be used.public static void sort(float[] a,
FloatComparator c)
For uses that don't care about a stable sort, especially when the data
has no underlying patterns (that is, completely unsorted, random data),
the non-stable version of this method may be up to twice as fast. Use
sort(float[], FloatComparator, boolean), with stable set to
false.
a - the array to sortc - the comparator to use for sorting the array, or null for
natural orderingNullPointerException - if a == nullIllegalArgumentException - if sorting finds that c violates
the FloatComparator contractpublic static void sort(float[] a,
int fromIndex,
int toIndex,
FloatComparator c)
For uses that don't care about a stable sort, especially when the data
has no underlying patterns (that is, completely unsorted, random data),
the non-stable version of this method may be up to twice as fast. Use
sort(float[], int, int, FloatComparator, boolean), with stable
set to false.
a - the array to sortfromIndex - the index (inclusive) marking the beginning of the array
portiontoIndex - the index (exclusive) marking the end of the array portionc - the comparator to use for sorting the array, or null for
natural orderingNullPointerException - if a == nullArrayIndexOutOfBoundsException - if fromIndex < 0 or
toIndex > a.lengthIllegalArgumentException - if fromIndex > toIndex or
sorting finds that c violates the FloatComparator
contractpublic static void sort(float[] a,
FloatComparator c,
boolean stable)
stable is
true, the sorting algorithm will result in a stable sort, so two
items that compare to 0 will be kept in the same order when the sort is
complete. When false, no such guarantees are made, but the sort
may be up to twice as fast, especially for unpatterned data.a - the array to sortc - the comparator to use for sorting the array, or null for
natural orderingstable - whether to use a slower, but stable, sorting algorithmNullPointerException - if a == nullIllegalArgumentException - if sorting finds that c violates
the FloatComparator contractpublic static void sort(float[] a,
int fromIndex,
int toIndex,
FloatComparator c,
boolean stable)
stable is true, the sorting algorithm will result in
a stable sort, so two items that compare to 0 will be kept in the same
order when the sort is complete. When false, no such guarantees
are made, but the sort may be up to twice as fast, especially for
unpatterned data.a - the array to sortfromIndex - the index (inclusive) marking the beginning of the array
portiontoIndex - the index (exclusive) marking the end of the array portionc - the comparator to use for sorting the array, or null for
natural orderingstable - whether to use a slower, but stable, sorting algorithmNullPointerException - if a == nullArrayIndexOutOfBoundsException - if fromIndex < 0 or
toIndex > a.lengthIllegalArgumentException - if fromIndex > toIndex or
sorting finds that c violates the FloatComparator
contractpublic static int binarySearch(float[] a,
float key,
FloatComparator c)
key using the binary
search algorithm. The array must be sorted into ascending order
according to the specified comparator (as by the
sort(float[], FloatComparator)
method) prior to making this call. If it is
not sorted, the results are undefined.
If the array contains multiple
elements equal to the specified object, there is no guarantee which one
will be found.a - the array to be searchedkey - the value to be searched forc - the comparator by which the array is ordered. A
null value indicates that the elements'
natural ordering should be used.public static int binarySearch(float[] a,
int fromIndex,
int toIndex,
float key,
FloatComparator c)
key using the binary
search algorithm.
The array must be sorted into ascending order
according to the specified comparator (as by the
sort(float[], int, int, FloatComparator)
method) prior to making this call.
If it is not sorted, the results are undefined.
If the range contains multiple elements equal to the specified object,
there is no guarantee which one will be found.a - the array to be searchedfromIndex - the index of the first element (inclusive) to be
searchedtoIndex - the index of the last element (exclusive) to be searchedkey - the value to be searched forc - the comparator by which the array is ordered. A
null value indicates that the elements'
natural ordering should be used.public static void sort(int[] a,
IntComparator c)
For uses that don't care about a stable sort, especially when the data
has no underlying patterns (that is, completely unsorted, random data),
the non-stable version of this method may be up to twice as fast. Use
sort(int[], IntComparator, boolean), with stable set to
false.
a - the array to sortc - the comparator to use for sorting the array, or null for
natural orderingNullPointerException - if a == nullIllegalArgumentException - if sorting finds that c violates
the IntComparator contractpublic static void sort(int[] a,
int fromIndex,
int toIndex,
IntComparator c)
For uses that don't care about a stable sort, especially when the data
has no underlying patterns (that is, completely unsorted, random data),
the non-stable version of this method may be up to twice as fast. Use
sort(int[], int, int, IntComparator, boolean), with stable
set to false.
a - the array to sortfromIndex - the index (inclusive) marking the beginning of the array
portiontoIndex - the index (exclusive) marking the end of the array portionc - the comparator to use for sorting the array, or null for
natural orderingNullPointerException - if a == nullArrayIndexOutOfBoundsException - if fromIndex < 0 or
toIndex > a.lengthIllegalArgumentException - if fromIndex > toIndex or
sorting finds that c violates the IntComparator
contractpublic static void sort(int[] a,
IntComparator c,
boolean stable)
stable is
true, the sorting algorithm will result in a stable sort, so two
items that compare to 0 will be kept in the same order when the sort is
complete. When false, no such guarantees are made, but the sort
may be up to twice as fast, especially for unpatterned data.a - the array to sortc - the comparator to use for sorting the array, or null for
natural orderingstable - whether to use a slower, but stable, sorting algorithmNullPointerException - if a == nullIllegalArgumentException - if sorting finds that c violates
the IntComparator contractpublic static void sort(int[] a,
int fromIndex,
int toIndex,
IntComparator c,
boolean stable)
stable is true, the sorting algorithm will result in
a stable sort, so two items that compare to 0 will be kept in the same
order when the sort is complete. When false, no such guarantees
are made, but the sort may be up to twice as fast, especially for
unpatterned data.a - the array to sortfromIndex - the index (inclusive) marking the beginning of the array
portiontoIndex - the index (exclusive) marking the end of the array portionc - the comparator to use for sorting the array, or null for
natural orderingstable - whether to use a slower, but stable, sorting algorithmNullPointerException - if a == nullArrayIndexOutOfBoundsException - if fromIndex < 0 or
toIndex > a.lengthIllegalArgumentException - if fromIndex > toIndex or
sorting finds that c violates the IntComparator
contractpublic static int binarySearch(int[] a,
int key,
IntComparator c)
key using the binary
search algorithm. The array must be sorted into ascending order
according to the specified comparator (as by the
sort(int[], IntComparator)
method) prior to making this call. If it is
not sorted, the results are undefined.
If the array contains multiple
elements equal to the specified object, there is no guarantee which one
will be found.a - the array to be searchedkey - the value to be searched forc - the comparator by which the array is ordered. A
null value indicates that the elements'
natural ordering should be used.public static int binarySearch(int[] a,
int fromIndex,
int toIndex,
int key,
IntComparator c)
key using the binary
search algorithm.
The array must be sorted into ascending order
according to the specified comparator (as by the
sort(int[], int, int, IntComparator)
method) prior to making this call.
If it is not sorted, the results are undefined.
If the range contains multiple elements equal to the specified object,
there is no guarantee which one will be found.a - the array to be searchedfromIndex - the index of the first element (inclusive) to be
searchedtoIndex - the index of the last element (exclusive) to be searchedkey - the value to be searched forc - the comparator by which the array is ordered. A
null value indicates that the elements'
natural ordering should be used.public static void sort(long[] a,
LongComparator c)
For uses that don't care about a stable sort, especially when the data
has no underlying patterns (that is, completely unsorted, random data),
the non-stable version of this method may be up to twice as fast. Use
sort(long[], LongComparator, boolean), with stable set to
false.
a - the array to sortc - the comparator to use for sorting the array, or null for
natural orderingNullPointerException - if a == nullIllegalArgumentException - if sorting finds that c violates
the LongComparator contractpublic static void sort(long[] a,
int fromIndex,
int toIndex,
LongComparator c)
For uses that don't care about a stable sort, especially when the data
has no underlying patterns (that is, completely unsorted, random data),
the non-stable version of this method may be up to twice as fast. Use
sort(long[], int, int, LongComparator, boolean), with stable
set to false.
a - the array to sortfromIndex - the index (inclusive) marking the beginning of the array
portiontoIndex - the index (exclusive) marking the end of the array portionc - the comparator to use for sorting the array, or null for
natural orderingNullPointerException - if a == nullArrayIndexOutOfBoundsException - if fromIndex < 0 or
toIndex > a.lengthIllegalArgumentException - if fromIndex > toIndex or
sorting finds that c violates the LongComparator
contractpublic static void sort(long[] a,
LongComparator c,
boolean stable)
stable is
true, the sorting algorithm will result in a stable sort, so two
items that compare to 0 will be kept in the same order when the sort is
complete. When false, no such guarantees are made, but the sort
may be up to twice as fast, especially for unpatterned data.a - the array to sortc - the comparator to use for sorting the array, or null for
natural orderingstable - whether to use a slower, but stable, sorting algorithmNullPointerException - if a == nullIllegalArgumentException - if sorting finds that c violates
the LongComparator contractpublic static void sort(long[] a,
int fromIndex,
int toIndex,
LongComparator c,
boolean stable)
stable is true, the sorting algorithm will result in
a stable sort, so two items that compare to 0 will be kept in the same
order when the sort is complete. When false, no such guarantees
are made, but the sort may be up to twice as fast, especially for
unpatterned data.a - the array to sortfromIndex - the index (inclusive) marking the beginning of the array
portiontoIndex - the index (exclusive) marking the end of the array portionc - the comparator to use for sorting the array, or null for
natural orderingstable - whether to use a slower, but stable, sorting algorithmNullPointerException - if a == nullArrayIndexOutOfBoundsException - if fromIndex < 0 or
toIndex > a.lengthIllegalArgumentException - if fromIndex > toIndex or
sorting finds that c violates the LongComparator
contractpublic static int binarySearch(long[] a,
long key,
LongComparator c)
key using the binary
search algorithm. The array must be sorted into ascending order
according to the specified comparator (as by the
sort(long[], LongComparator)
method) prior to making this call. If it is
not sorted, the results are undefined.
If the array contains multiple
elements equal to the specified object, there is no guarantee which one
will be found.a - the array to be searchedkey - the value to be searched forc - the comparator by which the array is ordered. A
null value indicates that the elements'
natural ordering should be used.public static int binarySearch(long[] a,
int fromIndex,
int toIndex,
long key,
LongComparator c)
key using the binary
search algorithm.
The array must be sorted into ascending order
according to the specified comparator (as by the
sort(long[], int, int, LongComparator)
method) prior to making this call.
If it is not sorted, the results are undefined.
If the range contains multiple elements equal to the specified object,
there is no guarantee which one will be found.a - the array to be searchedfromIndex - the index of the first element (inclusive) to be
searchedtoIndex - the index of the last element (exclusive) to be searchedkey - the value to be searched forc - the comparator by which the array is ordered. A
null value indicates that the elements'
natural ordering should be used.public static void sort(short[] a,
ShortComparator c)
For uses that don't care about a stable sort, especially when the data
has no underlying patterns (that is, completely unsorted, random data),
the non-stable version of this method may be up to twice as fast. Use
sort(short[], ShortComparator, boolean), with stable set to
false.
a - the array to sortc - the comparator to use for sorting the array, or null for
natural orderingNullPointerException - if a == nullIllegalArgumentException - if sorting finds that c violates
the ShortComparator contractpublic static void sort(short[] a,
int fromIndex,
int toIndex,
ShortComparator c)
For uses that don't care about a stable sort, especially when the data
has no underlying patterns (that is, completely unsorted, random data),
the non-stable version of this method may be up to twice as fast. Use
sort(short[], int, int, ShortComparator, boolean), with stable
set to false.
a - the array to sortfromIndex - the index (inclusive) marking the beginning of the array
portiontoIndex - the index (exclusive) marking the end of the array portionc - the comparator to use for sorting the array, or null for
natural orderingNullPointerException - if a == nullArrayIndexOutOfBoundsException - if fromIndex < 0 or
toIndex > a.lengthIllegalArgumentException - if fromIndex > toIndex or
sorting finds that c violates the ShortComparator
contractpublic static void sort(short[] a,
ShortComparator c,
boolean stable)
stable is
true, the sorting algorithm will result in a stable sort, so two
items that compare to 0 will be kept in the same order when the sort is
complete. When false, no such guarantees are made, but the sort
may be up to twice as fast, especially for unpatterned data.a - the array to sortc - the comparator to use for sorting the array, or null for
natural orderingstable - whether to use a slower, but stable, sorting algorithmNullPointerException - if a == nullIllegalArgumentException - if sorting finds that c violates
the ShortComparator contractpublic static void sort(short[] a,
int fromIndex,
int toIndex,
ShortComparator c,
boolean stable)
stable is true, the sorting algorithm will result in
a stable sort, so two items that compare to 0 will be kept in the same
order when the sort is complete. When false, no such guarantees
are made, but the sort may be up to twice as fast, especially for
unpatterned data.a - the array to sortfromIndex - the index (inclusive) marking the beginning of the array
portiontoIndex - the index (exclusive) marking the end of the array portionc - the comparator to use for sorting the array, or null for
natural orderingstable - whether to use a slower, but stable, sorting algorithmNullPointerException - if a == nullArrayIndexOutOfBoundsException - if fromIndex < 0 or
toIndex > a.lengthIllegalArgumentException - if fromIndex > toIndex or
sorting finds that c violates the ShortComparator
contractpublic static int binarySearch(short[] a,
short key,
ShortComparator c)
key using the binary
search algorithm. The array must be sorted into ascending order
according to the specified comparator (as by the
sort(short[], ShortComparator)
method) prior to making this call. If it is
not sorted, the results are undefined.
If the array contains multiple
elements equal to the specified object, there is no guarantee which one
will be found.a - the array to be searchedkey - the value to be searched forc - the comparator by which the array is ordered. A
null value indicates that the elements'
natural ordering should be used.public static int binarySearch(short[] a,
int fromIndex,
int toIndex,
short key,
ShortComparator c)
key using the binary
search algorithm.
The array must be sorted into ascending order
according to the specified comparator (as by the
sort(short[], int, int, ShortComparator)
method) prior to making this call.
If it is not sorted, the results are undefined.
If the range contains multiple elements equal to the specified object,
there is no guarantee which one will be found.a - the array to be searchedfromIndex - the index of the first element (inclusive) to be
searchedtoIndex - the index of the last element (exclusive) to be searchedkey - the value to be searched forc - the comparator by which the array is ordered. A
null value indicates that the elements'
natural ordering should be used.Copyright © 2021. All rights reserved.