Arrays
open class Arrays
| kotlin.Any | |
| ↳ | java.util.Arrays |
This class contains various methods for manipulating arrays (such as sorting and searching). This class also contains a static factory that allows arrays to be viewed as lists.
The methods in this class all throw a NullPointerException, if the specified array reference is null, except where noted.
The documentation for the methods contained in this class includes briefs description of the implementations. Such descriptions should be regarded as implementation notes, rather than parts of the specification. Implementors should feel free to substitute other algorithms, so long as the specification itself is adhered to. (For example, the algorithm used by sort(Object[]) does not have to be a MergeSort, but it does have to be stable.)
This class is a member of the Java Collections Framework.
Summary
| Public methods | |
|---|---|
| open static MutableList<T> |
asList(vararg a: T)Returns a fixed-size list backed by the specified array. |
| open static Int |
binarySearch(a: LongArray, key: Long)Searches the specified array of longs for the specified value using the binary search algorithm. |
| open static Int |
binarySearch(a: LongArray, fromIndex: Int, toIndex: Int, key: Long)Searches a range of the specified array of longs for the specified value using the binary search algorithm. |
| open static Int |
binarySearch(a: IntArray, key: Int)Searches the specified array of ints for the specified value using the binary search algorithm. |
| open static Int |
binarySearch(a: IntArray, fromIndex: Int, toIndex: Int, key: Int)Searches a range of the specified array of ints for the specified value using the binary search algorithm. |
| open static Int |
binarySearch(a: ShortArray, key: Short)Searches the specified array of shorts for the specified value using the binary search algorithm. |
| open static Int |
binarySearch(a: ShortArray, fromIndex: Int, toIndex: Int, key: Short)Searches a range of the specified array of shorts for the specified value using the binary search algorithm. |
| open static Int |
binarySearch(a: CharArray, key: Char)Searches the specified array of chars for the specified value using the binary search algorithm. |
| open static Int |
binarySearch(a: CharArray, fromIndex: Int, toIndex: Int, key: Char)Searches a range of the specified array of chars for the specified value using the binary search algorithm. |
| open static Int |
binarySearch(a: ByteArray, key: Byte)Searches the specified array of bytes for the specified value using the binary search algorithm. |
| open static Int |
binarySearch(a: ByteArray, fromIndex: Int, toIndex: Int, key: Byte)Searches a range of the specified array of bytes for the specified value using the binary search algorithm. |
| open static Int |
binarySearch(a: DoubleArray, key: Double)Searches the specified array of doubles for the specified value using the binary search algorithm. |
| open static Int |
binarySearch(a: DoubleArray, fromIndex: Int, toIndex: Int, key: Double)Searches a range of the specified array of doubles for the specified value using the binary search algorithm. |
| open static Int |
binarySearch(a: FloatArray, key: Float)Searches the specified array of floats for the specified value using the binary search algorithm. |
| open static Int |
binarySearch(a: FloatArray, fromIndex: Int, toIndex: Int, key: Float)Searches a range of the specified array of floats for the specified value using the binary search algorithm. |
| open static Int |
binarySearch(a: Array<Any!>, key: Any)Searches the specified array for the specified object using the binary search algorithm. |
| open static Int |
Searches a range of the specified array for the specified object using the binary search algorithm. |
| open static Int |
binarySearch(a: Array<T>, key: T, c: Comparator<in T>?)Searches the specified array for the specified object using the binary search algorithm. |
| open static Int |
binarySearch(a: Array<T>, fromIndex: Int, toIndex: Int, key: T, c: Comparator<in T>?)Searches a range of the specified array for the specified object using the binary search algorithm. |
| open static Array<T> |
Copies the specified array, truncating or padding with nulls (if necessary) so the copy has the specified length. |
| open static Array<T> |
Copies the specified array, truncating or padding with nulls (if necessary) so the copy has the specified length. |
| open static ByteArray |
Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length. |
| open static ShortArray |
copyOf(original: ShortArray, newLength: Int)Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length. |
| open static IntArray |
Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length. |
| open static LongArray |
Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length. |
| open static CharArray |
Copies the specified array, truncating or padding with null characters (if necessary) so the copy has the specified length. |
| open static FloatArray |
copyOf(original: FloatArray, newLength: Int)Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length. |
| open static DoubleArray |
copyOf(original: DoubleArray, newLength: Int)Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length. |
| open static BooleanArray |
copyOf(original: BooleanArray, newLength: Int)Copies the specified array, truncating or padding with false (if necessary) so the copy has the specified length. |
| open static Array<T> |
copyOfRange(original: Array<T>, from: Int, to: Int)Copies the specified range of the specified array into a new array. |
| open static Array<T> |
Copies the specified range of the specified array into a new array. |
| open static ByteArray |
copyOfRange(original: ByteArray, from: Int, to: Int)Copies the specified range of the specified array into a new array. |
| open static ShortArray |
copyOfRange(original: ShortArray, from: Int, to: Int)Copies the specified range of the specified array into a new array. |
| open static IntArray |
copyOfRange(original: IntArray, from: Int, to: Int)Copies the specified range of the specified array into a new array. |
| open static LongArray |
copyOfRange(original: LongArray, from: Int, to: Int)Copies the specified range of the specified array into a new array. |
| open static CharArray |
copyOfRange(original: CharArray, from: Int, to: Int)Copies the specified range of the specified array into a new array. |
| open static FloatArray |
copyOfRange(original: FloatArray, from: Int, to: Int)Copies the specified range of the specified array into a new array. |
| open static DoubleArray |
copyOfRange(original: DoubleArray, from: Int, to: Int)Copies the specified range of the specified array into a new array. |
| open static BooleanArray |
copyOfRange(original: BooleanArray, from: Int, to: Int)Copies the specified range of the specified array into a new array. |
| open static Boolean |
deepEquals(a1: Array<Any!>?, a2: Array<Any!>?)Returns true if the two specified arrays are deeply equal to one another. |
| open static Int |
deepHashCode(a: Array<Any!>?)Returns a hash code based on the "deep contents" of the specified array. |
| open static String |
deepToString(a: Array<Any!>?)Returns a string representation of the "deep contents" of the specified array. |
| open static Boolean |
Returns true if the two specified arrays of longs are equal to one another. |
| open static Boolean |
Returns true if the two specified arrays of ints are equal to one another. |
| open static Boolean |
equals(a: ShortArray?, a2: ShortArray?)Returns true if the two specified arrays of shorts are equal to one another. |
| open static Boolean |
Returns true if the two specified arrays of chars are equal to one another. |
| open static Boolean |
Returns true if the two specified arrays of bytes are equal to one another. |
| open static Boolean |
equals(a: BooleanArray?, a2: BooleanArray?)Returns true if the two specified arrays of booleans are equal to one another. |
| open static Boolean |
equals(a: DoubleArray?, a2: DoubleArray?)Returns true if the two specified arrays of doubles are equal to one another. |
| open static Boolean |
equals(a: FloatArray?, a2: FloatArray?)Returns true if the two specified arrays of floats are equal to one another. |
| open static Boolean |
Returns true if the two specified arrays of Objects are equal to one another. |
| open static Unit |
Assigns the specified long value to each element of the specified array of longs. |
| open static Unit |
Assigns the specified long value to each element of the specified range of the specified array of longs. |
| open static Unit |
Assigns the specified int value to each element of the specified array of ints. |
| open static Unit |
Assigns the specified int value to each element of the specified range of the specified array of ints. |
| open static Unit |
fill(a: ShortArray, val: Short)Assigns the specified short value to each element of the specified array of shorts. |
| open static Unit |
fill(a: ShortArray, fromIndex: Int, toIndex: Int, val: Short)Assigns the specified short value to each element of the specified range of the specified array of shorts. |
| open static Unit |
Assigns the specified char value to each element of the specified array of chars. |
| open static Unit |
Assigns the specified char value to each element of the specified range of the specified array of chars. |
| open static Unit |
Assigns the specified byte value to each element of the specified array of bytes. |
| open static Unit |
Assigns the specified byte value to each element of the specified range of the specified array of bytes. |
| open static Unit |
fill(a: BooleanArray, val: Boolean)Assigns the specified boolean value to each element of the specified array of booleans. |
| open static Unit |
fill(a: BooleanArray, fromIndex: Int, toIndex: Int, val: Boolean)Assigns the specified boolean value to each element of the specified range of the specified array of booleans. |
| open static Unit |
fill(a: DoubleArray, val: Double)Assigns the specified double value to each element of the specified array of doubles. |
| open static Unit |
fill(a: DoubleArray, fromIndex: Int, toIndex: Int, val: Double)Assigns the specified double value to each element of the specified range of the specified array of doubles. |
| open static Unit |
fill(a: FloatArray, val: Float)Assigns the specified float value to each element of the specified array of floats. |
| open static Unit |
fill(a: FloatArray, fromIndex: Int, toIndex: Int, val: Float)Assigns the specified float value to each element of the specified range of the specified array of floats. |
| open static Unit |
Assigns the specified Object reference to each element of the specified array of Objects. |
| open static Unit |
Assigns the specified Object reference to each element of the specified range of the specified array of Objects. |
| open static Int |
Returns a hash code based on the contents of the specified array. |
| open static Int |
Returns a hash code based on the contents of the specified array. |
| open static Int |
hashCode(a: ShortArray?)Returns a hash code based on the contents of the specified array. |
| open static Int |
Returns a hash code based on the contents of the specified array. |
| open static Int |
Returns a hash code based on the contents of the specified array. |
| open static Int |
hashCode(a: BooleanArray?)Returns a hash code based on the contents of the specified array. |
| open static Int |
hashCode(a: FloatArray?)Returns a hash code based on the contents of the specified array. |
| open static Int |
hashCode(a: DoubleArray?)Returns a hash code based on the contents of the specified array. |
| open static Int |
Returns a hash code based on the contents of the specified array. |
| open static Unit |
parallelPrefix(array: Array<T>, op: BinaryOperator<T>)Cumulates, in parallel, each element of the given array in place, using the supplied function. |
| open static Unit |
parallelPrefix(array: Array<T>, fromIndex: Int, toIndex: Int, op: BinaryOperator<T>)Performs |
| open static Unit |
parallelPrefix(array: LongArray, op: LongBinaryOperator)Cumulates, in parallel, each element of the given array in place, using the supplied function. |
| open static Unit |
parallelPrefix(array: LongArray, fromIndex: Int, toIndex: Int, op: LongBinaryOperator)Performs |
| open static Unit |
parallelPrefix(array: DoubleArray, op: DoubleBinaryOperator)Cumulates, in parallel, each element of the given array in place, using the supplied function. |
| open static Unit |
parallelPrefix(array: DoubleArray, fromIndex: Int, toIndex: Int, op: DoubleBinaryOperator)Performs |
| open static Unit |
parallelPrefix(array: IntArray, op: IntBinaryOperator)Cumulates, in parallel, each element of the given array in place, using the supplied function. |
| open static Unit |
parallelPrefix(array: IntArray, fromIndex: Int, toIndex: Int, op: IntBinaryOperator)Performs |
| open static Unit |
parallelSetAll(array: Array<T>, generator: IntFunction<out T>)Set all elements of the specified array, in parallel, using the provided generator function to compute each element. |
| open static Unit |
parallelSetAll(array: IntArray, generator: IntUnaryOperator)Set all elements of the specified array, in parallel, using the provided generator function to compute each element. |
| open static Unit |
parallelSetAll(array: LongArray, generator: IntToLongFunction)Set all elements of the specified array, in parallel, using the provided generator function to compute each element. |
| open static Unit |
parallelSetAll(array: DoubleArray, generator: IntToDoubleFunction)Set all elements of the specified array, in parallel, using the provided generator function to compute each element. |
| open static Unit |
Sorts the specified array into ascending numerical order. |
| open static Unit |
parallelSort(a: ByteArray, fromIndex: Int, toIndex: Int)Sorts the specified range of the array into ascending numerical order. |
| open static Unit |
Sorts the specified array into ascending numerical order. |
| open static Unit |
parallelSort(a: CharArray, fromIndex: Int, toIndex: Int)Sorts the specified range of the array into ascending numerical order. |
| open static Unit |
Sorts the specified array into ascending numerical order. |
| open static Unit |
parallelSort(a: ShortArray, fromIndex: Int, toIndex: Int)Sorts the specified range of the array into ascending numerical order. |
| open static Unit |
parallelSort(a: IntArray)Sorts the specified array into ascending numerical order. |
| open static Unit |
parallelSort(a: IntArray, fromIndex: Int, toIndex: Int)Sorts the specified range of the array into ascending numerical order. |
| open static Unit |
Sorts the specified array into ascending numerical order. |
| open static Unit |
parallelSort(a: LongArray, fromIndex: Int, toIndex: Int)Sorts the specified range of the array into ascending numerical order. |
| open static Unit |
Sorts the specified array into ascending numerical order. |
| open static Unit |
parallelSort(a: FloatArray, fromIndex: Int, toIndex: Int)Sorts the specified range of the array into ascending numerical order. |
| open static Unit |
Sorts the specified array into ascending numerical order. |
| open static Unit |
parallelSort(a: DoubleArray, fromIndex: Int, toIndex: Int)Sorts the specified range of the array into ascending numerical order. |
| open static Unit |
parallelSort(a: Array<T>)Sorts the specified array of objects into ascending order, according to the Comparable of its elements. |
| open static Unit |
parallelSort(a: Array<T>, fromIndex: Int, toIndex: Int)Sorts the specified range of the specified array of objects into ascending order, according to the Comparable of its elements. |
| open static Unit |
parallelSort(a: Array<T>, cmp: Comparator<in T>?)Sorts the specified array of objects according to the order induced by the specified comparator. |
| open static Unit |
parallelSort(a: Array<T>, fromIndex: Int, toIndex: Int, cmp: Comparator<in T>?)Sorts the specified range of the specified array of objects according to the order induced by the specified comparator. |
| open static Unit |
setAll(array: Array<T>, generator: IntFunction<out T>)Set all elements of the specified array, using the provided generator function to compute each element. |
| open static Unit |
setAll(array: IntArray, generator: IntUnaryOperator)Set all elements of the specified array, using the provided generator function to compute each element. |
| open static Unit |
setAll(array: LongArray, generator: IntToLongFunction)Set all elements of the specified array, using the provided generator function to compute each element. |
| open static Unit |
setAll(array: DoubleArray, generator: IntToDoubleFunction)Set all elements of the specified array, using the provided generator function to compute each element. |
| open static Unit |
Sorts the specified array into ascending numerical order. |
| open static Unit |
Sorts the specified range of the array into ascending order. |
| open static Unit |
Sorts the specified array into ascending numerical order. |
| open static Unit |
Sorts the specified range of the array into ascending order. |
| open static Unit |
sort(a: ShortArray)Sorts the specified array into ascending numerical order. |
| open static Unit |
sort(a: ShortArray, fromIndex: Int, toIndex: Int)Sorts the specified range of the array into ascending order. |
| open static Unit |
Sorts the specified array into ascending numerical order. |
| open static Unit |
Sorts the specified range of the array into ascending order. |
| open static Unit |
Sorts the specified array into ascending numerical order. |
| open static Unit |
Sorts the specified range of the array into ascending order. |
| open static Unit |
sort(a: FloatArray)Sorts the specified array into ascending numerical order. |
| open static Unit |
sort(a: FloatArray, fromIndex: Int, toIndex: Int)Sorts the specified range of the array into ascending order. |
| open static Unit |
sort(a: DoubleArray)Sorts the specified array into ascending numerical order. |
| open static Unit |
sort(a: DoubleArray, fromIndex: Int, toIndex: Int)Sorts the specified range of the array into ascending order. |
| open static Unit |
Sorts the specified array of objects into ascending order, according to the Comparable of its elements. |
| open static Unit |
Sorts the specified range of the specified array of objects into ascending order, according to the Comparable of its elements. |
| open static Unit |
sort(a: Array<T>, c: Comparator<in T>?)Sorts the specified array of objects according to the order induced by the specified comparator. |
| open static Unit |
sort(a: Array<T>, fromIndex: Int, toIndex: Int, c: Comparator<in T>?)Sorts the specified range of the specified array of objects according to the order induced by the specified comparator. |
| open static Spliterator<T> |
spliterator(array: Array<T>)Returns a |
| open static Spliterator<T> |
spliterator(array: Array<T>, startInclusive: Int, endExclusive: Int)Returns a |
| open static Spliterator.OfInt |
spliterator(array: IntArray)Returns a |
| open static Spliterator.OfInt |
spliterator(array: IntArray, startInclusive: Int, endExclusive: Int)Returns a |
| open static Spliterator.OfLong |
spliterator(array: LongArray)Returns a |
| open static Spliterator.OfLong |
spliterator(array: LongArray, startInclusive: Int, endExclusive: Int)Returns a |
| open static Spliterator.OfDouble |
spliterator(array: DoubleArray)Returns a |
| open static Spliterator.OfDouble |
spliterator(array: DoubleArray, startInclusive: Int, endExclusive: Int)Returns a |
| open static Stream<T> |
Returns a sequential |
| open static Stream<T> |
Returns a sequential |
| open static IntStream |
Returns a sequential |
| open static IntStream |
Returns a sequential |
| open static LongStream |
Returns a sequential |
| open static LongStream |
Returns a sequential |
| open static DoubleStream |
stream(array: DoubleArray)Returns a sequential |
| open static DoubleStream |
stream(array: DoubleArray, startInclusive: Int, endExclusive: Int)Returns a sequential |
| open static String |
Returns a string representation of the contents of the specified array. |
| open static String |
Returns a string representation of the contents of the specified array. |
| open static String |
toString(a: ShortArray?)Returns a string representation of the contents of the specified array. |
| open static String |
Returns a string representation of the contents of the specified array. |
| open static String |
Returns a string representation of the contents of the specified array. |
| open static String |
toString(a: BooleanArray?)Returns a string representation of the contents of the specified array. |
| open static String |
toString(a: FloatArray?)Returns a string representation of the contents of the specified array. |
| open static String |
toString(a: DoubleArray?)Returns a string representation of the contents of the specified array. |
| open static String |
Returns a string representation of the contents of the specified array. |
Public methods
asList
@SafeVarargs open static fun <T : Any!> asList(vararg a: T): MutableList<T>
Returns a fixed-size list backed by the specified array. (Changes to the returned list "write through" to the array.) This method acts as bridge between array-based and collection-based APIs, in combination with Collection#toArray. The returned list is serializable and implements RandomAccess.
This method also provides a convenient way to create a fixed-size list initialized to contain several elements:
List<String> stooges = Arrays.asList("Larry", "Moe", "Curly");
| Parameters | |
|---|---|
<T> |
the class of the objects in the array |
a |
T: the array by which the list will be backed |
| Return | |
|---|---|
MutableList<T> |
a list view of the specified array |
binarySearch
open static fun binarySearch(
a: LongArray,
key: Long
): Int
Searches the specified array of longs for the specified value using the binary search algorithm. The array must be sorted (as by the sort(long[]) method) prior to making this call. If it is not sorted, the results are undefined. If the array contains multiple elements with the specified value, there is no guarantee which one will be found.
| Parameters | |
|---|---|
a |
LongArray: the array to be searched |
key |
Long: the value to be searched for |
| Return | |
|---|---|
Int |
index of the search key, if it is contained in the array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element greater than the key, or a.length if all elements in the array are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found. |
binarySearch
open static fun binarySearch(
a: LongArray,
fromIndex: Int,
toIndex: Int,
key: Long
): Int
Searches a range of the specified array of longs for the specified value using the binary search algorithm. The range must be sorted (as by the sort(long[],int,int) method) prior to making this call. If it is not sorted, the results are undefined. If the range contains multiple elements with the specified value, there is no guarantee which one will be found.
| Parameters | |
|---|---|
a |
LongArray: the array to be searched |
fromIndex |
Int: the index of the first element (inclusive) to be searched |
toIndex |
Int: the index of the last element (exclusive) to be searched |
key |
Long: the value to be searched for |
| Return | |
|---|---|
Int |
index of the search key, if it is contained in the array within the specified range; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element in the range greater than the key, or toIndex if all elements in the range are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found. |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
binarySearch
open static fun binarySearch(
a: IntArray,
key: Int
): Int
Searches the specified array of ints for the specified value using the binary search algorithm. The array must be sorted (as by the sort(int[]) method) prior to making this call. If it is not sorted, the results are undefined. If the array contains multiple elements with the specified value, there is no guarantee which one will be found.
| Parameters | |
|---|---|
a |
IntArray: the array to be searched |
key |
Int: the value to be searched for |
| Return | |
|---|---|
Int |
index of the search key, if it is contained in the array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element greater than the key, or a.length if all elements in the array are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found. |
binarySearch
open static fun binarySearch(
a: IntArray,
fromIndex: Int,
toIndex: Int,
key: Int
): Int
Searches a range of the specified array of ints for the specified value using the binary search algorithm. The range must be sorted (as by the sort(int[],int,int) method) prior to making this call. If it is not sorted, the results are undefined. If the range contains multiple elements with the specified value, there is no guarantee which one will be found.
| Parameters | |
|---|---|
a |
IntArray: the array to be searched |
fromIndex |
Int: the index of the first element (inclusive) to be searched |
toIndex |
Int: the index of the last element (exclusive) to be searched |
key |
Int: the value to be searched for |
| Return | |
|---|---|
Int |
index of the search key, if it is contained in the array within the specified range; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element in the range greater than the key, or toIndex if all elements in the range are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found. |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
binarySearch
open static fun binarySearch(
a: ShortArray,
key: Short
): Int
Searches the specified array of shorts for the specified value using the binary search algorithm. The array must be sorted (as by the sort(short[]) method) prior to making this call. If it is not sorted, the results are undefined. If the array contains multiple elements with the specified value, there is no guarantee which one will be found.
| Parameters | |
|---|---|
a |
ShortArray: the array to be searched |
key |
Short: the value to be searched for |
| Return | |
|---|---|
Int |
index of the search key, if it is contained in the array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element greater than the key, or a.length if all elements in the array are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found. |
binarySearch
open static fun binarySearch(
a: ShortArray,
fromIndex: Int,
toIndex: Int,
key: Short
): Int
Searches a range of the specified array of shorts for the specified value using the binary search algorithm. The range must be sorted (as by the sort(short[],int,int) method) prior to making this call. If it is not sorted, the results are undefined. If the range contains multiple elements with the specified value, there is no guarantee which one will be found.
| Parameters | |
|---|---|
a |
ShortArray: the array to be searched |
fromIndex |
Int: the index of the first element (inclusive) to be searched |
toIndex |
Int: the index of the last element (exclusive) to be searched |
key |
Short: the value to be searched for |
| Return | |
|---|---|
Int |
index of the search key, if it is contained in the array within the specified range; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element in the range greater than the key, or toIndex if all elements in the range are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found. |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
binarySearch
open static fun binarySearch(
a: CharArray,
key: Char
): Int
Searches the specified array of chars for the specified value using the binary search algorithm. The array must be sorted (as by the sort(char[]) method) prior to making this call. If it is not sorted, the results are undefined. If the array contains multiple elements with the specified value, there is no guarantee which one will be found.
| Parameters | |
|---|---|
a |
CharArray: the array to be searched |
key |
Char: the value to be searched for |
| Return | |
|---|---|
Int |
index of the search key, if it is contained in the array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element greater than the key, or a.length if all elements in the array are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found. |
binarySearch
open static fun binarySearch(
a: CharArray,
fromIndex: Int,
toIndex: Int,
key: Char
): Int
Searches a range of the specified array of chars for the specified value using the binary search algorithm. The range must be sorted (as by the sort(char[],int,int) method) prior to making this call. If it is not sorted, the results are undefined. If the range contains multiple elements with the specified value, there is no guarantee which one will be found.
| Parameters | |
|---|---|
a |
CharArray: the array to be searched |
fromIndex |
Int: the index of the first element (inclusive) to be searched |
toIndex |
Int: the index of the last element (exclusive) to be searched |
key |
Char: the value to be searched for |
| Return | |
|---|---|
Int |
index of the search key, if it is contained in the array within the specified range; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element in the range greater than the key, or toIndex if all elements in the range are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found. |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
binarySearch
open static fun binarySearch(
a: ByteArray,
key: Byte
): Int
Searches the specified array of bytes for the specified value using the binary search algorithm. The array must be sorted (as by the sort(byte[]) method) prior to making this call. If it is not sorted, the results are undefined. If the array contains multiple elements with the specified value, there is no guarantee which one will be found.
| Parameters | |
|---|---|
a |
ByteArray: the array to be searched |
key |
Byte: the value to be searched for |
| Return | |
|---|---|
Int |
index of the search key, if it is contained in the array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element greater than the key, or a.length if all elements in the array are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found. |
binarySearch
open static fun binarySearch(
a: ByteArray,
fromIndex: Int,
toIndex: Int,
key: Byte
): Int
Searches a range of the specified array of bytes for the specified value using the binary search algorithm. The range must be sorted (as by the sort(byte[],int,int) method) prior to making this call. If it is not sorted, the results are undefined. If the range contains multiple elements with the specified value, there is no guarantee which one will be found.
| Parameters | |
|---|---|
a |
ByteArray: the array to be searched |
fromIndex |
Int: the index of the first element (inclusive) to be searched |
toIndex |
Int: the index of the last element (exclusive) to be searched |
key |
Byte: the value to be searched for |
| Return | |
|---|---|
Int |
index of the search key, if it is contained in the array within the specified range; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element in the range greater than the key, or toIndex if all elements in the range are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found. |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
binarySearch
open static fun binarySearch(
a: DoubleArray,
key: Double
): Int
Searches the specified array of doubles for the specified value using the binary search algorithm. The array must be sorted (as by the sort(double[]) method) prior to making this call. If it is not sorted, the results are undefined. If the array contains multiple elements with the specified value, there is no guarantee which one will be found. This method considers all NaN values to be equivalent and equal.
| Parameters | |
|---|---|
a |
DoubleArray: the array to be searched |
key |
Double: the value to be searched for |
| Return | |
|---|---|
Int |
index of the search key, if it is contained in the array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element greater than the key, or a.length if all elements in the array are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found. |
binarySearch
open static fun binarySearch(
a: DoubleArray,
fromIndex: Int,
toIndex: Int,
key: Double
): Int
Searches a range of the specified array of doubles for the specified value using the binary search algorithm. The range must be sorted (as by the sort(double[],int,int) method) prior to making this call. If it is not sorted, the results are undefined. If the range contains multiple elements with the specified value, there is no guarantee which one will be found. This method considers all NaN values to be equivalent and equal.
| Parameters | |
|---|---|
a |
DoubleArray: the array to be searched |
fromIndex |
Int: the index of the first element (inclusive) to be searched |
toIndex |
Int: the index of the last element (exclusive) to be searched |
key |
Double: the value to be searched for |
| Return | |
|---|---|
Int |
index of the search key, if it is contained in the array within the specified range; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element in the range greater than the key, or toIndex if all elements in the range are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found. |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
binarySearch
open static fun binarySearch(
a: FloatArray,
key: Float
): Int
Searches the specified array of floats for the specified value using the binary search algorithm. The array must be sorted (as by the sort(float[]) method) prior to making this call. If it is not sorted, the results are undefined. If the array contains multiple elements with the specified value, there is no guarantee which one will be found. This method considers all NaN values to be equivalent and equal.
| Parameters | |
|---|---|
a |
FloatArray: the array to be searched |
key |
Float: the value to be searched for |
| Return | |
|---|---|
Int |
index of the search key, if it is contained in the array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element greater than the key, or a.length if all elements in the array are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found. |
binarySearch
open static fun binarySearch(
a: FloatArray,
fromIndex: Int,
toIndex: Int,
key: Float
): Int
Searches a range of the specified array of floats for the specified value using the binary search algorithm. The range must be sorted (as by the sort(float[],int,int) method) prior to making this call. If it is not sorted, the results are undefined. If the range contains multiple elements with the specified value, there is no guarantee which one will be found. This method considers all NaN values to be equivalent and equal.
| Parameters | |
|---|---|
a |
FloatArray: the array to be searched |
fromIndex |
Int: the index of the first element (inclusive) to be searched |
toIndex |
Int: the index of the last element (exclusive) to be searched |
key |
Float: the value to be searched for |
| Return | |
|---|---|
Int |
index of the search key, if it is contained in the array within the specified range; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element in the range greater than the key, or toIndex if all elements in the range are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found. |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
binarySearch
open static fun binarySearch(
a: Array<Any!>,
key: Any
): Int
Searches the specified array for the specified object using the binary search algorithm. The array must be sorted into ascending order according to the Comparable of its elements (as by the sort(java.lang.Object[]) method) prior to making this call. If it is not sorted, the results are undefined. (If the array contains elements that are not mutually comparable (for example, strings and integers), it cannot be sorted according to the natural ordering of its elements, hence results are undefined.) If the array contains multiple elements equal to the specified object, there is no guarantee which one will be found.
| Parameters | |
|---|---|
a |
Array<Any!>: the array to be searched |
key |
Any: the value to be searched for |
| Return | |
|---|---|
Int |
index of the search key, if it is contained in the array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element greater than the key, or a.length if all elements in the array are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found. |
| Exceptions | |
|---|---|
java.lang.ClassCastException |
if the search key is not comparable to the elements of the array. |
binarySearch
open static fun binarySearch(
a: Array<Any!>,
fromIndex: Int,
toIndex: Int,
key: Any
): Int
Searches a range of the specified array for the specified object using the binary search algorithm. The range must be sorted into ascending order according to the Comparable of its elements (as by the sort(java.lang.Object[],int,int) method) prior to making this call. If it is not sorted, the results are undefined. (If the range contains elements that are not mutually comparable (for example, strings and integers), it cannot be sorted according to the natural ordering of its elements, hence results are undefined.) If the range contains multiple elements equal to the specified object, there is no guarantee which one will be found.
| Parameters | |
|---|---|
a |
Array<Any!>: the array to be searched |
fromIndex |
Int: the index of the first element (inclusive) to be searched |
toIndex |
Int: the index of the last element (exclusive) to be searched |
key |
Any: the value to be searched for |
| Return | |
|---|---|
Int |
index of the search key, if it is contained in the array within the specified range; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element in the range greater than the key, or toIndex if all elements in the range are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found. |
| Exceptions | |
|---|---|
java.lang.ClassCastException |
if the search key is not comparable to the elements of the array within the specified range. |
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
binarySearch
open static fun <T : Any!> binarySearch(
a: Array<T>,
key: T,
c: Comparator<in T>?
): Int
Searches the specified array for the specified object using the binary search algorithm. The array must be sorted into ascending order according to the specified comparator (as by the sort(T[], Comparator) 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.
| Parameters | |
|---|---|
<T> |
the class of the objects in the array |
a |
Array<T>: the array to be searched |
key |
T: the value to be searched for |
c |
Comparator<in T>?: the comparator by which the array is ordered. A null value indicates that the elements' Comparable should be used. |
| Return | |
|---|---|
Int |
index of the search key, if it is contained in the array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element greater than the key, or a.length if all elements in the array are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found. |
| Exceptions | |
|---|---|
java.lang.ClassCastException |
if the array contains elements that are not mutually comparable using the specified comparator, or the search key is not comparable to the elements of the array using this comparator. |
binarySearch
open static fun <T : Any!> binarySearch(
a: Array<T>,
fromIndex: Int,
toIndex: Int,
key: T,
c: Comparator<in T>?
): Int
Searches a range of the specified array for the specified object using the binary search algorithm. The range must be sorted into ascending order according to the specified comparator (as by the sort(T[], int, int, Comparator) 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.
| Parameters | |
|---|---|
<T> |
the class of the objects in the array |
a |
Array<T>: the array to be searched |
fromIndex |
Int: the index of the first element (inclusive) to be searched |
toIndex |
Int: the index of the last element (exclusive) to be searched |
key |
T: the value to be searched for |
c |
Comparator<in T>?: the comparator by which the array is ordered. A null value indicates that the elements' Comparable should be used. |
| Return | |
|---|---|
Int |
index of the search key, if it is contained in the array within the specified range; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element in the range greater than the key, or toIndex if all elements in the range are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found. |
| Exceptions | |
|---|---|
java.lang.ClassCastException |
if the range contains elements that are not mutually comparable using the specified comparator, or the search key is not comparable to the elements in the range using this comparator. |
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
copyOf
open static fun <T : Any!> copyOf(
original: Array<T>,
newLength: Int
): Array<T>
Copies the specified array, truncating or padding with nulls (if necessary) so the copy has the specified length. For all indices that are valid in both the original array and the copy, the two arrays will contain identical values. For any indices that are valid in the copy but not the original, the copy will contain null. Such indices will exist if and only if the specified length is greater than that of the original array. The resulting array is of exactly the same class as the original array.
| Parameters | |
|---|---|
<T> |
the class of the objects in the array |
original |
Array<T>: the array to be copied |
newLength |
Int: the length of the copy to be returned |
| Return | |
|---|---|
Array<T> |
a copy of the original array, truncated or padded with nulls to obtain the specified length |
| Exceptions | |
|---|---|
java.lang.NegativeArraySizeException |
if newLength is negative |
java.lang.NullPointerException |
if original is null |
copyOf
open static fun <T : Any!, U : Any!> copyOf(
original: Array<U>,
newLength: Int,
newType: Class<out Array<T>!>
): Array<T>
Copies the specified array, truncating or padding with nulls (if necessary) so the copy has the specified length. For all indices that are valid in both the original array and the copy, the two arrays will contain identical values. For any indices that are valid in the copy but not the original, the copy will contain null. Such indices will exist if and only if the specified length is greater than that of the original array. The resulting array is of the class newType.
| Parameters | |
|---|---|
<U> |
the class of the objects in the original array |
<T> |
the class of the objects in the returned array |
original |
Array<U>: the array to be copied |
newLength |
Int: the length of the copy to be returned |
newType |
Class<out Array<T>!>: the class of the copy to be returned |
| Return | |
|---|---|
Array<T> |
a copy of the original array, truncated or padded with nulls to obtain the specified length |
| Exceptions | |
|---|---|
java.lang.NegativeArraySizeException |
if newLength is negative |
java.lang.NullPointerException |
if original is null |
java.lang.ArrayStoreException |
if an element copied from original is not of a runtime type that can be stored in an array of class newType |
copyOf
open static fun copyOf(
original: ByteArray,
newLength: Int
): ByteArray
Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length. For all indices that are valid in both the original array and the copy, the two arrays will contain identical values. For any indices that are valid in the copy but not the original, the copy will contain (byte)0. Such indices will exist if and only if the specified length is greater than that of the original array.
| Parameters | |
|---|---|
original |
ByteArray: the array to be copied |
newLength |
Int: the length of the copy to be returned |
| Return | |
|---|---|
ByteArray |
a copy of the original array, truncated or padded with zeros to obtain the specified length |
| Exceptions | |
|---|---|
java.lang.NegativeArraySizeException |
if newLength is negative |
java.lang.NullPointerException |
if original is null |
copyOf
open static fun copyOf(
original: ShortArray,
newLength: Int
): ShortArray
Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length. For all indices that are valid in both the original array and the copy, the two arrays will contain identical values. For any indices that are valid in the copy but not the original, the copy will contain (short)0. Such indices will exist if and only if the specified length is greater than that of the original array.
| Parameters | |
|---|---|
original |
ShortArray: the array to be copied |
newLength |
Int: the length of the copy to be returned |
| Return | |
|---|---|
ShortArray |
a copy of the original array, truncated or padded with zeros to obtain the specified length |
| Exceptions | |
|---|---|
java.lang.NegativeArraySizeException |
if newLength is negative |
java.lang.NullPointerException |
if original is null |
copyOf
open static fun copyOf(
original: IntArray,
newLength: Int
): IntArray
Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length. For all indices that are valid in both the original array and the copy, the two arrays will contain identical values. For any indices that are valid in the copy but not the original, the copy will contain 0. Such indices will exist if and only if the specified length is greater than that of the original array.
| Parameters | |
|---|---|
original |
IntArray: the array to be copied |
newLength |
Int: the length of the copy to be returned |
| Return | |
|---|---|
IntArray |
a copy of the original array, truncated or padded with zeros to obtain the specified length |
| Exceptions | |
|---|---|
java.lang.NegativeArraySizeException |
if newLength is negative |
java.lang.NullPointerException |
if original is null |
copyOf
open static fun copyOf(
original: LongArray,
newLength: Int
): LongArray
Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length. For all indices that are valid in both the original array and the copy, the two arrays will contain identical values. For any indices that are valid in the copy but not the original, the copy will contain 0L. Such indices will exist if and only if the specified length is greater than that of the original array.
| Parameters | |
|---|---|
original |
LongArray: the array to be copied |
newLength |
Int: the length of the copy to be returned |
| Return | |
|---|---|
LongArray |
a copy of the original array, truncated or padded with zeros to obtain the specified length |
| Exceptions | |
|---|---|
java.lang.NegativeArraySizeException |
if newLength is negative |
java.lang.NullPointerException |
if original is null |
copyOf
open static fun copyOf(
original: CharArray,
newLength: Int
): CharArray
Copies the specified array, truncating or padding with null characters (if necessary) so the copy has the specified length. For all indices that are valid in both the original array and the copy, the two arrays will contain identical values. For any indices that are valid in the copy but not the original, the copy will contain '\\u000'. Such indices will exist if and only if the specified length is greater than that of the original array.
| Parameters | |
|---|---|
original |
CharArray: the array to be copied |
newLength |
Int: the length of the copy to be returned |
| Return | |
|---|---|
CharArray |
a copy of the original array, truncated or padded with null characters to obtain the specified length |
| Exceptions | |
|---|---|
java.lang.NegativeArraySizeException |
if newLength is negative |
java.lang.NullPointerException |
if original is null |
copyOf
open static fun copyOf(
original: FloatArray,
newLength: Int
): FloatArray
Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length. For all indices that are valid in both the original array and the copy, the two arrays will contain identical values. For any indices that are valid in the copy but not the original, the copy will contain 0f. Such indices will exist if and only if the specified length is greater than that of the original array.
| Parameters | |
|---|---|
original |
FloatArray: the array to be copied |
newLength |
Int: the length of the copy to be returned |
| Return | |
|---|---|
FloatArray |
a copy of the original array, truncated or padded with zeros to obtain the specified length |
| Exceptions | |
|---|---|
java.lang.NegativeArraySizeException |
if newLength is negative |
java.lang.NullPointerException |
if original is null |
copyOf
open static fun copyOf(
original: DoubleArray,
newLength: Int
): DoubleArray
Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length. For all indices that are valid in both the original array and the copy, the two arrays will contain identical values. For any indices that are valid in the copy but not the original, the copy will contain 0d. Such indices will exist if and only if the specified length is greater than that of the original array.
| Parameters | |
|---|---|
original |
DoubleArray: the array to be copied |
newLength |
Int: the length of the copy to be returned |
| Return | |
|---|---|
DoubleArray |
a copy of the original array, truncated or padded with zeros to obtain the specified length |
| Exceptions | |
|---|---|
java.lang.NegativeArraySizeException |
if newLength is negative |
java.lang.NullPointerException |
if original is null |
copyOf
open static fun copyOf(
original: BooleanArray,
newLength: Int
): BooleanArray
Copies the specified array, truncating or padding with false (if necessary) so the copy has the specified length. For all indices that are valid in both the original array and the copy, the two arrays will contain identical values. For any indices that are valid in the copy but not the original, the copy will contain false. Such indices will exist if and only if the specified length is greater than that of the original array.
| Parameters | |
|---|---|
original |
BooleanArray: the array to be copied |
newLength |
Int: the length of the copy to be returned |
| Return | |
|---|---|
BooleanArray |
a copy of the original array, truncated or padded with false elements to obtain the specified length |
| Exceptions | |
|---|---|
java.lang.NegativeArraySizeException |
if newLength is negative |
java.lang.NullPointerException |
if original is null |
copyOfRange
open static fun <T : Any!> copyOfRange(
original: Array<T>,
from: Int,
to: Int
): Array<T>
Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case null is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.
The resulting array is of exactly the same class as the original array.
| Parameters | |
|---|---|
<T> |
the class of the objects in the array |
original |
Array<T>: the array from which a range is to be copied |
from |
Int: the initial index of the range to be copied, inclusive |
to |
Int: the final index of the range to be copied, exclusive. (This index may lie outside the array.) |
| Return | |
|---|---|
Array<T> |
a new array containing the specified range from the original array, truncated or padded with nulls to obtain the required length |
| Exceptions | |
|---|---|
java.lang.ArrayIndexOutOfBoundsException |
if from < 0 or from > original.length |
java.lang.IllegalArgumentException |
if from > to |
java.lang.NullPointerException |
if original is null |
copyOfRange
open static fun <T : Any!, U : Any!> copyOfRange(
original: Array<U>,
from: Int,
to: Int,
newType: Class<out Array<T>!>
): Array<T>
Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case null is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from. The resulting array is of the class newType.
| Parameters | |
|---|---|
<U> |
the class of the objects in the original array |
<T> |
the class of the objects in the returned array |
original |
Array<U>: the array from which a range is to be copied |
from |
Int: the initial index of the range to be copied, inclusive |
to |
Int: the final index of the range to be copied, exclusive. (This index may lie outside the array.) |
newType |
Class<out Array<T>!>: the class of the copy to be returned |
| Return | |
|---|---|
Array<T> |
a new array containing the specified range from the original array, truncated or padded with nulls to obtain the required length |
| Exceptions | |
|---|---|
java.lang.ArrayIndexOutOfBoundsException |
if from < 0 or from > original.length |
java.lang.IllegalArgumentException |
if from > to |
java.lang.NullPointerException |
if original is null |
java.lang.ArrayStoreException |
if an element copied from original is not of a runtime type that can be stored in an array of class newType. |
copyOfRange
open static fun copyOfRange(
original: ByteArray,
from: Int,
to: Int
): ByteArray
Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case (byte)0 is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.
| Parameters | |
|---|---|
original |
ByteArray: the array from which a range is to be copied |
from |
Int: the initial index of the range to be copied, inclusive |
to |
Int: the final index of the range to be copied, exclusive. (This index may lie outside the array.) |
| Return | |
|---|---|
ByteArray |
a new array containing the specified range from the original array, truncated or padded with zeros to obtain the required length |
| Exceptions | |
|---|---|
java.lang.ArrayIndexOutOfBoundsException |
if from < 0 or from > original.length |
java.lang.IllegalArgumentException |
if from > to |
java.lang.NullPointerException |
if original is null |
copyOfRange
open static fun copyOfRange(
original: ShortArray,
from: Int,
to: Int
): ShortArray
Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case (short)0 is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.
| Parameters | |
|---|---|
original |
ShortArray: the array from which a range is to be copied |
from |
Int: the initial index of the range to be copied, inclusive |
to |
Int: the final index of the range to be copied, exclusive. (This index may lie outside the array.) |
| Return | |
|---|---|
ShortArray |
a new array containing the specified range from the original array, truncated or padded with zeros to obtain the required length |
| Exceptions | |
|---|---|
java.lang.ArrayIndexOutOfBoundsException |
if from < 0 or from > original.length |
java.lang.IllegalArgumentException |
if from > to |
java.lang.NullPointerException |
if original is null |
copyOfRange
open static fun copyOfRange(
original: IntArray,
from: Int,
to: Int
): IntArray
Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case 0 is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.
| Parameters | |
|---|---|
original |
IntArray: the array from which a range is to be copied |
from |
Int: the initial index of the range to be copied, inclusive |
to |
Int: the final index of the range to be copied, exclusive. (This index may lie outside the array.) |
| Return | |
|---|---|
IntArray |
a new array containing the specified range from the original array, truncated or padded with zeros to obtain the required length |
| Exceptions | |
|---|---|
java.lang.ArrayIndexOutOfBoundsException |
if from < 0 or from > original.length |
java.lang.IllegalArgumentException |
if from > to |
java.lang.NullPointerException |
if original is null |
copyOfRange
open static fun copyOfRange(
original: LongArray,
from: Int,
to: Int
): LongArray
Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case 0L is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.
| Parameters | |
|---|---|
original |
LongArray: the array from which a range is to be copied |
from |
Int: the initial index of the range to be copied, inclusive |
to |
Int: the final index of the range to be copied, exclusive. (This index may lie outside the array.) |
| Return | |
|---|---|
LongArray |
a new array containing the specified range from the original array, truncated or padded with zeros to obtain the required length |
| Exceptions | |
|---|---|
java.lang.ArrayIndexOutOfBoundsException |
if from < 0 or from > original.length |
java.lang.IllegalArgumentException |
if from > to |
java.lang.NullPointerException |
if original is null |
copyOfRange
open static fun copyOfRange(
original: CharArray,
from: Int,
to: Int
): CharArray
Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case '\\u000' is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.
| Parameters | |
|---|---|
original |
CharArray: the array from which a range is to be copied |
from |
Int: the initial index of the range to be copied, inclusive |
to |
Int: the final index of the range to be copied, exclusive. (This index may lie outside the array.) |
| Return | |
|---|---|
CharArray |
a new array containing the specified range from the original array, truncated or padded with null characters to obtain the required length |
| Exceptions | |
|---|---|
java.lang.ArrayIndexOutOfBoundsException |
if from < 0 or from > original.length |
java.lang.IllegalArgumentException |
if from > to |
java.lang.NullPointerException |
if original is null |
copyOfRange
open static fun copyOfRange(
original: FloatArray,
from: Int,
to: Int
): FloatArray
Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case 0f is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.
| Parameters | |
|---|---|
original |
FloatArray: the array from which a range is to be copied |
from |
Int: the initial index of the range to be copied, inclusive |
to |
Int: the final index of the range to be copied, exclusive. (This index may lie outside the array.) |
| Return | |
|---|---|
FloatArray |
a new array containing the specified range from the original array, truncated or padded with zeros to obtain the required length |
| Exceptions | |
|---|---|
java.lang.ArrayIndexOutOfBoundsException |
if from < 0 or from > original.length |
java.lang.IllegalArgumentException |
if from > to |
java.lang.NullPointerException |
if original is null |
copyOfRange
open static fun copyOfRange(
original: DoubleArray,
from: Int,
to: Int
): DoubleArray
Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case 0d is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.
| Parameters | |
|---|---|
original |
DoubleArray: the array from which a range is to be copied |
from |
Int: the initial index of the range to be copied, inclusive |
to |
Int: the final index of the range to be copied, exclusive. (This index may lie outside the array.) |
| Return | |
|---|---|
DoubleArray |
a new array containing the specified range from the original array, truncated or padded with zeros to obtain the required length |
| Exceptions | |
|---|---|
java.lang.ArrayIndexOutOfBoundsException |
if from < 0 or from > original.length |
java.lang.IllegalArgumentException |
if from > to |
java.lang.NullPointerException |
if original is null |
copyOfRange
open static fun copyOfRange(
original: BooleanArray,
from: Int,
to: Int
): BooleanArray
Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case false is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.
| Parameters | |
|---|---|
original |
BooleanArray: the array from which a range is to be copied |
from |
Int: the initial index of the range to be copied, inclusive |
to |
Int: the final index of the range to be copied, exclusive. (This index may lie outside the array.) |
| Return | |
|---|---|
BooleanArray |
a new array containing the specified range from the original array, truncated or padded with false elements to obtain the required length |
| Exceptions | |
|---|---|
java.lang.ArrayIndexOutOfBoundsException |
if from < 0 or from > original.length |
java.lang.IllegalArgumentException |
if from > to |
java.lang.NullPointerException |
if original is null |
deepEquals
open static fun deepEquals(
a1: Array<Any!>?,
a2: Array<Any!>?
): Boolean
Returns true if the two specified arrays are deeply equal to one another. Unlike the equals(java.lang.Object[],java.lang.Object[]) method, this method is appropriate for use with nested arrays of arbitrary depth.
Two array references are considered deeply equal if both are null, or if they refer to arrays that contain the same number of elements and all corresponding pairs of elements in the two arrays are deeply equal.
Two possibly null elements e1 and e2 are deeply equal if any of the following conditions hold:
- e1 and e2 are both arrays of object reference types, and Arrays.deepEquals(e1, e2) would return true
- e1 and e2 are arrays of the same primitive type, and the appropriate overloading of Arrays.equals(e1, e2) would return true.
- e1 == e2
- e1.equals(e2) would return true.
If either of the specified arrays contain themselves as elements either directly or indirectly through one or more levels of arrays, the behavior of this method is undefined.
| Parameters | |
|---|---|
a1 |
Array<Any!>?: one array to be tested for equality |
a2 |
Array<Any!>?: the other array to be tested for equality |
| Return | |
|---|---|
Boolean |
true if the two arrays are equal |
deepHashCode
open static fun deepHashCode(a: Array<Any!>?): Int
Returns a hash code based on the "deep contents" of the specified array. If the array contains other arrays as elements, the hash code is based on their contents and so on, ad infinitum. It is therefore unacceptable to invoke this method on an array that contains itself as an element, either directly or indirectly through one or more levels of arrays. The behavior of such an invocation is undefined.
For any two arrays a and b such that Arrays.deepEquals(a, b), it is also the case that Arrays.deepHashCode(a) == Arrays.deepHashCode(b).
The computation of the value returned by this method is similar to that of the value returned by List#hashCode() on a list containing the same elements as a in the same order, with one difference: If an element e of a is itself an array, its hash code is computed not by calling e.hashCode(), but as by calling the appropriate overloading of Arrays.hashCode(e) if e is an array of a primitive type, or as by calling Arrays.deepHashCode(e) recursively if e is an array of a reference type. If a is null, this method returns 0.
| Parameters | |
|---|---|
a |
Array<Any!>?: the array whose deep-content-based hash code to compute |
| Return | |
|---|---|
Int |
a deep-content-based hash code for a |
See Also
deepToString
open static fun deepToString(a: Array<Any!>?): String
Returns a string representation of the "deep contents" of the specified array. If the array contains other arrays as elements, the string representation contains their contents and so on. This method is designed for converting multidimensional arrays to strings.
The string representation consists of a list of the array's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Elements are converted to strings as by String.valueOf(Object), unless they are themselves arrays.
If an element e is an array of a primitive type, it is converted to a string as by invoking the appropriate overloading of Arrays.toString(e). If an element e is an array of a reference type, it is converted to a string as by invoking this method recursively.
To avoid infinite recursion, if the specified array contains itself as an element, or contains an indirect reference to itself through one or more levels of arrays, the self-reference is converted to the string "[...]". For example, an array containing only a reference to itself would be rendered as "[[...]]".
This method returns "null" if the specified array is null.
| Parameters | |
|---|---|
a |
Array<Any!>?: the array whose string representation to return |
| Return | |
|---|---|
String |
a string representation of a |
See Also
equals
open static fun equals(
a: LongArray?,
a2: LongArray?
): Boolean
Returns true if the two specified arrays of longs are equal to one another. Two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. In other words, two arrays are equal if they contain the same elements in the same order. Also, two array references are considered equal if both are null.
| Parameters | |
|---|---|
a |
LongArray?: one array to be tested for equality |
a2 |
LongArray?: the other array to be tested for equality |
| Return | |
|---|---|
Boolean |
true if the two arrays are equal |
equals
open static fun equals(
a: IntArray?,
a2: IntArray?
): Boolean
Returns true if the two specified arrays of ints are equal to one another. Two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. In other words, two arrays are equal if they contain the same elements in the same order. Also, two array references are considered equal if both are null.
| Parameters | |
|---|---|
a |
IntArray?: one array to be tested for equality |
a2 |
IntArray?: the other array to be tested for equality |
| Return | |
|---|---|
Boolean |
true if the two arrays are equal |
equals
open static fun equals(
a: ShortArray?,
a2: ShortArray?
): Boolean
Returns true if the two specified arrays of shorts are equal to one another. Two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. In other words, two arrays are equal if they contain the same elements in the same order. Also, two array references are considered equal if both are null.
| Parameters | |
|---|---|
a |
ShortArray?: one array to be tested for equality |
a2 |
ShortArray?: the other array to be tested for equality |
| Return | |
|---|---|
Boolean |
true if the two arrays are equal |
equals
open static fun equals(
a: CharArray?,
a2: CharArray?
): Boolean
Returns true if the two specified arrays of chars are equal to one another. Two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. In other words, two arrays are equal if they contain the same elements in the same order. Also, two array references are considered equal if both are null.
| Parameters | |
|---|---|
a |
CharArray?: one array to be tested for equality |
a2 |
CharArray?: the other array to be tested for equality |
| Return | |
|---|---|
Boolean |
true if the two arrays are equal |
equals
open static fun equals(
a: ByteArray?,
a2: ByteArray?
): Boolean
Returns true if the two specified arrays of bytes are equal to one another. Two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. In other words, two arrays are equal if they contain the same elements in the same order. Also, two array references are considered equal if both are null.
| Parameters | |
|---|---|
a |
ByteArray?: one array to be tested for equality |
a2 |
ByteArray?: the other array to be tested for equality |
| Return | |
|---|---|
Boolean |
true if the two arrays are equal |
equals
open static fun equals(
a: BooleanArray?,
a2: BooleanArray?
): Boolean
Returns true if the two specified arrays of booleans are equal to one another. Two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. In other words, two arrays are equal if they contain the same elements in the same order. Also, two array references are considered equal if both are null.
| Parameters | |
|---|---|
a |
BooleanArray?: one array to be tested for equality |
a2 |
BooleanArray?: the other array to be tested for equality |
| Return | |
|---|---|
Boolean |
true if the two arrays are equal |
equals
open static fun equals(
a: DoubleArray?,
a2: DoubleArray?
): Boolean
Returns true if the two specified arrays of doubles are equal to one another. Two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. In other words, two arrays are equal if they contain the same elements in the same order. Also, two array references are considered equal if both are null.
Two doubles d1 and d2 are considered equal if:
<tt>new Double(d1).equals(new Double(d2))</tt>(Unlike the == operator, this method considers NaN equals to itself, and 0.0d unequal to -0.0d.)
| Parameters | |
|---|---|
a |
DoubleArray?: one array to be tested for equality |
a2 |
DoubleArray?: the other array to be tested for equality |
| Return | |
|---|---|
Boolean |
true if the two arrays are equal |
See Also
equals
open static fun equals(
a: FloatArray?,
a2: FloatArray?
): Boolean
Returns true if the two specified arrays of floats are equal to one another. Two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. In other words, two arrays are equal if they contain the same elements in the same order. Also, two array references are considered equal if both are null.
Two floats f1 and f2 are considered equal if:
<tt>new Float(f1).equals(new Float(f2))</tt>(Unlike the == operator, this method considers NaN equals to itself, and 0.0f unequal to -0.0f.)
| Parameters | |
|---|---|
a |
FloatArray?: one array to be tested for equality |
a2 |
FloatArray?: the other array to be tested for equality |
| Return | |
|---|---|
Boolean |
true if the two arrays are equal |
See Also
equals
open static fun equals(
a: Array<Any!>?,
a2: Array<Any!>?
): Boolean
Returns true if the two specified arrays of Objects are equal to one another. The two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. Two objects e1 and e2 are considered equal if (e1==null ? e2==null : e1.equals(e2)). In other words, the two arrays are equal if they contain the same elements in the same order. Also, two array references are considered equal if both are null.
| Parameters | |
|---|---|
a |
Array<Any!>?: one array to be tested for equality |
a2 |
Array<Any!>?: the other array to be tested for equality |
| Return | |
|---|---|
Boolean |
true if the two arrays are equal |
fill
open static fun fill(
a: LongArray,
val: Long
): Unit
Assigns the specified long value to each element of the specified array of longs.
| Parameters | |
|---|---|
a |
LongArray: the array to be filled |
val |
Long: the value to be stored in all elements of the array |
fill
open static fun fill(
a: LongArray,
fromIndex: Int,
toIndex: Int,
val: Long
): Unit
Assigns the specified long value to each element of the specified range of the specified array of longs. The range to be filled extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be filled is empty.)
| Parameters | |
|---|---|
a |
LongArray: the array to be filled |
fromIndex |
Int: the index of the first element (inclusive) to be filled with the specified value |
toIndex |
Int: the index of the last element (exclusive) to be filled with the specified value |
val |
Long: the value to be stored in all elements of the array |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
fill
open static fun fill(
a: IntArray,
val: Int
): Unit
Assigns the specified int value to each element of the specified array of ints.
| Parameters | |
|---|---|
a |
IntArray: the array to be filled |
val |
Int: the value to be stored in all elements of the array |
fill
open static fun fill(
a: IntArray,
fromIndex: Int,
toIndex: Int,
val: Int
): Unit
Assigns the specified int value to each element of the specified range of the specified array of ints. The range to be filled extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be filled is empty.)
| Parameters | |
|---|---|
a |
IntArray: the array to be filled |
fromIndex |
Int: the index of the first element (inclusive) to be filled with the specified value |
toIndex |
Int: the index of the last element (exclusive) to be filled with the specified value |
val |
Int: the value to be stored in all elements of the array |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
fill
open static fun fill(
a: ShortArray,
val: Short
): Unit
Assigns the specified short value to each element of the specified array of shorts.
| Parameters | |
|---|---|
a |
ShortArray: the array to be filled |
val |
Short: the value to be stored in all elements of the array |
fill
open static fun fill(
a: ShortArray,
fromIndex: Int,
toIndex: Int,
val: Short
): Unit
Assigns the specified short value to each element of the specified range of the specified array of shorts. The range to be filled extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be filled is empty.)
| Parameters | |
|---|---|
a |
ShortArray: the array to be filled |
fromIndex |
Int: the index of the first element (inclusive) to be filled with the specified value |
toIndex |
Int: the index of the last element (exclusive) to be filled with the specified value |
val |
Short: the value to be stored in all elements of the array |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
fill
open static fun fill(
a: CharArray,
val: Char
): Unit
Assigns the specified char value to each element of the specified array of chars.
| Parameters | |
|---|---|
a |
CharArray: the array to be filled |
val |
Char: the value to be stored in all elements of the array |
fill
open static fun fill(
a: CharArray,
fromIndex: Int,
toIndex: Int,
val: Char
): Unit
Assigns the specified char value to each element of the specified range of the specified array of chars. The range to be filled extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be filled is empty.)
| Parameters | |
|---|---|
a |
CharArray: the array to be filled |
fromIndex |
Int: the index of the first element (inclusive) to be filled with the specified value |
toIndex |
Int: the index of the last element (exclusive) to be filled with the specified value |
val |
Char: the value to be stored in all elements of the array |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
fill
open static fun fill(
a: ByteArray,
val: Byte
): Unit
Assigns the specified byte value to each element of the specified array of bytes.
| Parameters | |
|---|---|
a |
ByteArray: the array to be filled |
val |
Byte: the value to be stored in all elements of the array |
fill
open static fun fill(
a: ByteArray,
fromIndex: Int,
toIndex: Int,
val: Byte
): Unit
Assigns the specified byte value to each element of the specified range of the specified array of bytes. The range to be filled extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be filled is empty.)
| Parameters | |
|---|---|
a |
ByteArray: the array to be filled |
fromIndex |
Int: the index of the first element (inclusive) to be filled with the specified value |
toIndex |
Int: the index of the last element (exclusive) to be filled with the specified value |
val |
Byte: the value to be stored in all elements of the array |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
fill
open static fun fill(
a: BooleanArray,
val: Boolean
): Unit
Assigns the specified boolean value to each element of the specified array of booleans.
| Parameters | |
|---|---|
a |
BooleanArray: the array to be filled |
val |
Boolean: the value to be stored in all elements of the array |
fill
open static fun fill(
a: BooleanArray,
fromIndex: Int,
toIndex: Int,
val: Boolean
): Unit
Assigns the specified boolean value to each element of the specified range of the specified array of booleans. The range to be filled extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be filled is empty.)
| Parameters | |
|---|---|
a |
BooleanArray: the array to be filled |
fromIndex |
Int: the index of the first element (inclusive) to be filled with the specified value |
toIndex |
Int: the index of the last element (exclusive) to be filled with the specified value |
val |
Boolean: the value to be stored in all elements of the array |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
fill
open static fun fill(
a: DoubleArray,
val: Double
): Unit
Assigns the specified double value to each element of the specified array of doubles.
| Parameters | |
|---|---|
a |
DoubleArray: the array to be filled |
val |
Double: the value to be stored in all elements of the array |
fill
open static fun fill(
a: DoubleArray,
fromIndex: Int,
toIndex: Int,
val: Double
): Unit
Assigns the specified double value to each element of the specified range of the specified array of doubles. The range to be filled extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be filled is empty.)
| Parameters | |
|---|---|
a |
DoubleArray: the array to be filled |
fromIndex |
Int: the index of the first element (inclusive) to be filled with the specified value |
toIndex |
Int: the index of the last element (exclusive) to be filled with the specified value |
val |
Double: the value to be stored in all elements of the array |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
fill
open static fun fill(
a: FloatArray,
val: Float
): Unit
Assigns the specified float value to each element of the specified array of floats.
| Parameters | |
|---|---|
a |
FloatArray: the array to be filled |
val |
Float: the value to be stored in all elements of the array |
fill
open static fun fill(
a: FloatArray,
fromIndex: Int,
toIndex: Int,
val: Float
): Unit
Assigns the specified float value to each element of the specified range of the specified array of floats. The range to be filled extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be filled is empty.)
| Parameters | |
|---|---|
a |
FloatArray: the array to be filled |
fromIndex |
Int: the index of the first element (inclusive) to be filled with the specified value |
toIndex |
Int: the index of the last element (exclusive) to be filled with the specified value |
val |
Float: the value to be stored in all elements of the array |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
fill
open static fun fill(
a: Array<Any!>,
val: Any?
): Unit
Assigns the specified Object reference to each element of the specified array of Objects.
| Parameters | |
|---|---|
a |
Array<Any!>: the array to be filled |
val |
Any?: the value to be stored in all elements of the array |
| Exceptions | |
|---|---|
java.lang.ArrayStoreException |
if the specified value is not of a runtime type that can be stored in the specified array |
fill
open static fun fill(
a: Array<Any!>,
fromIndex: Int,
toIndex: Int,
val: Any?
): Unit
Assigns the specified Object reference to each element of the specified range of the specified array of Objects. The range to be filled extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be filled is empty.)
| Parameters | |
|---|---|
a |
Array<Any!>: the array to be filled |
fromIndex |
Int: the index of the first element (inclusive) to be filled with the specified value |
toIndex |
Int: the index of the last element (exclusive) to be filled with the specified value |
val |
Any?: the value to be stored in all elements of the array |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
java.lang.ArrayStoreException |
if the specified value is not of a runtime type that can be stored in the specified array |
hashCode
open static fun hashCode(a: LongArray?): Int
Returns a hash code based on the contents of the specified array. For any two long arrays a and b such that Arrays.equals(a, b), it is also the case that Arrays.hashCode(a) == Arrays.hashCode(b).
The value returned by this method is the same value that would be obtained by invoking the List#hashCode() method on a List containing a sequence of Long instances representing the elements of a in the same order. If a is null, this method returns 0.
| Parameters | |
|---|---|
a |
LongArray?: the array whose hash value to compute |
| Return | |
|---|---|
Int |
a content-based hash code for a |
hashCode
open static fun hashCode(a: IntArray?): Int
Returns a hash code based on the contents of the specified array. For any two non-null int arrays a and b such that Arrays.equals(a, b), it is also the case that Arrays.hashCode(a) == Arrays.hashCode(b).
The value returned by this method is the same value that would be obtained by invoking the List#hashCode() method on a List containing a sequence of Integer instances representing the elements of a in the same order. If a is null, this method returns 0.
| Parameters | |
|---|---|
a |
IntArray?: the array whose hash value to compute |
| Return | |
|---|---|
Int |
a content-based hash code for a |
hashCode
open static fun hashCode(a: ShortArray?): Int
Returns a hash code based on the contents of the specified array. For any two short arrays a and b such that Arrays.equals(a, b), it is also the case that Arrays.hashCode(a) == Arrays.hashCode(b).
The value returned by this method is the same value that would be obtained by invoking the List#hashCode() method on a List containing a sequence of Short instances representing the elements of a in the same order. If a is null, this method returns 0.
| Parameters | |
|---|---|
a |
ShortArray?: the array whose hash value to compute |
| Return | |
|---|---|
Int |
a content-based hash code for a |
hashCode
open static fun hashCode(a: CharArray?): Int
Returns a hash code based on the contents of the specified array. For any two char arrays a and b such that Arrays.equals(a, b), it is also the case that Arrays.hashCode(a) == Arrays.hashCode(b).
The value returned by this method is the same value that would be obtained by invoking the List#hashCode() method on a List containing a sequence of Character instances representing the elements of a in the same order. If a is null, this method returns 0.
| Parameters | |
|---|---|
a |
CharArray?: the array whose hash value to compute |
| Return | |
|---|---|
Int |
a content-based hash code for a |
hashCode
open static fun hashCode(a: ByteArray?): Int
Returns a hash code based on the contents of the specified array. For any two byte arrays a and b such that Arrays.equals(a, b), it is also the case that Arrays.hashCode(a) == Arrays.hashCode(b).
The value returned by this method is the same value that would be obtained by invoking the List#hashCode() method on a List containing a sequence of Byte instances representing the elements of a in the same order. If a is null, this method returns 0.
| Parameters | |
|---|---|
a |
ByteArray?: the array whose hash value to compute |
| Return | |
|---|---|
Int |
a content-based hash code for a |
hashCode
open static fun hashCode(a: BooleanArray?): Int
Returns a hash code based on the contents of the specified array. For any two boolean arrays a and b such that Arrays.equals(a, b), it is also the case that Arrays.hashCode(a) == Arrays.hashCode(b).
The value returned by this method is the same value that would be obtained by invoking the List#hashCode() method on a List containing a sequence of Boolean instances representing the elements of a in the same order. If a is null, this method returns 0.
| Parameters | |
|---|---|
a |
BooleanArray?: the array whose hash value to compute |
| Return | |
|---|---|
Int |
a content-based hash code for a |
hashCode
open static fun hashCode(a: FloatArray?): Int
Returns a hash code based on the contents of the specified array. For any two float arrays a and b such that Arrays.equals(a, b), it is also the case that Arrays.hashCode(a) == Arrays.hashCode(b).
The value returned by this method is the same value that would be obtained by invoking the List#hashCode() method on a List containing a sequence of Float instances representing the elements of a in the same order. If a is null, this method returns 0.
| Parameters | |
|---|---|
a |
FloatArray?: the array whose hash value to compute |
| Return | |
|---|---|
Int |
a content-based hash code for a |
hashCode
open static fun hashCode(a: DoubleArray?): Int
Returns a hash code based on the contents of the specified array. For any two double arrays a and b such that Arrays.equals(a, b), it is also the case that Arrays.hashCode(a) == Arrays.hashCode(b).
The value returned by this method is the same value that would be obtained by invoking the List#hashCode() method on a List containing a sequence of Double instances representing the elements of a in the same order. If a is null, this method returns 0.
| Parameters | |
|---|---|
a |
DoubleArray?: the array whose hash value to compute |
| Return | |
|---|---|
Int |
a content-based hash code for a |
hashCode
open static fun hashCode(a: Array<Any!>?): Int
Returns a hash code based on the contents of the specified array. If the array contains other arrays as elements, the hash code is based on their identities rather than their contents. It is therefore acceptable to invoke this method on an array that contains itself as an element, either directly or indirectly through one or more levels of arrays.
For any two arrays a and b such that Arrays.equals(a, b), it is also the case that Arrays.hashCode(a) == Arrays.hashCode(b).
The value returned by this method is equal to the value that would be returned by Arrays.asList(a).hashCode(), unless a is null, in which case 0 is returned.
| Parameters | |
|---|---|
a |
Array<Any!>?: the array whose content-based hash code to compute |
| Return | |
|---|---|
Int |
a content-based hash code for a |
See Also
parallelPrefix
open static fun <T : Any!> parallelPrefix(
array: Array<T>,
op: BinaryOperator<T>
): Unit
Cumulates, in parallel, each element of the given array in place, using the supplied function. For example if the array initially holds [2, 1, 0, 3] and the operation performs addition, then upon return the array holds [2, 3, 3, 6]. Parallel prefix computation is usually more efficient than sequential loops for large arrays.
| Parameters | |
|---|---|
<T> |
the class of the objects in the array |
array |
Array<T>: the array, which is modified in-place by this method |
op |
BinaryOperator<T>: a side-effect-free, associative function to perform the cumulation |
| Exceptions | |
|---|---|
java.lang.NullPointerException |
if the specified array or function is null |
parallelPrefix
open static fun <T : Any!> parallelPrefix(
array: Array<T>,
fromIndex: Int,
toIndex: Int,
op: BinaryOperator<T>
): Unit
Performs parallelPrefix(java.lang.Object[],java.util.function.BinaryOperator) for the given subrange of the array.
| Parameters | |
|---|---|
<T> |
the class of the objects in the array |
array |
Array<T>: the array |
fromIndex |
Int: the index of the first element, inclusive |
toIndex |
Int: the index of the last element, exclusive |
op |
BinaryOperator<T>: a side-effect-free, associative function to perform the cumulation |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > array.length |
java.lang.NullPointerException |
if the specified array or function is null |
parallelPrefix
open static fun parallelPrefix(
array: LongArray,
op: LongBinaryOperator
): Unit
Cumulates, in parallel, each element of the given array in place, using the supplied function. For example if the array initially holds [2, 1, 0, 3] and the operation performs addition, then upon return the array holds [2, 3, 3, 6]. Parallel prefix computation is usually more efficient than sequential loops for large arrays.
| Parameters | |
|---|---|
array |
LongArray: the array, which is modified in-place by this method |
op |
LongBinaryOperator: a side-effect-free, associative function to perform the cumulation |
| Exceptions | |
|---|---|
java.lang.NullPointerException |
if the specified array or function is null |
parallelPrefix
open static fun parallelPrefix(
array: LongArray,
fromIndex: Int,
toIndex: Int,
op: LongBinaryOperator
): Unit
Performs parallelPrefix(long[],java.util.function.LongBinaryOperator) for the given subrange of the array.
| Parameters | |
|---|---|
array |
LongArray: the array |
fromIndex |
Int: the index of the first element, inclusive |
toIndex |
Int: the index of the last element, exclusive |
op |
LongBinaryOperator: a side-effect-free, associative function to perform the cumulation |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > array.length |
java.lang.NullPointerException |
if the specified array or function is null |
parallelPrefix
open static fun parallelPrefix(
array: DoubleArray,
op: DoubleBinaryOperator
): Unit
Cumulates, in parallel, each element of the given array in place, using the supplied function. For example if the array initially holds [2.0, 1.0, 0.0, 3.0] and the operation performs addition, then upon return the array holds [2.0, 3.0, 3.0, 6.0]. Parallel prefix computation is usually more efficient than sequential loops for large arrays.
Because floating-point operations may not be strictly associative, the returned result may not be identical to the value that would be obtained if the operation was performed sequentially.
| Parameters | |
|---|---|
array |
DoubleArray: the array, which is modified in-place by this method |
op |
DoubleBinaryOperator: a side-effect-free function to perform the cumulation |
| Exceptions | |
|---|---|
java.lang.NullPointerException |
if the specified array or function is null |
parallelPrefix
open static fun parallelPrefix(
array: DoubleArray,
fromIndex: Int,
toIndex: Int,
op: DoubleBinaryOperator
): Unit
Performs parallelPrefix(double[],java.util.function.DoubleBinaryOperator) for the given subrange of the array.
| Parameters | |
|---|---|
array |
DoubleArray: the array |
fromIndex |
Int: the index of the first element, inclusive |
toIndex |
Int: the index of the last element, exclusive |
op |
DoubleBinaryOperator: a side-effect-free, associative function to perform the cumulation |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > array.length |
java.lang.NullPointerException |
if the specified array or function is null |
parallelPrefix
open static fun parallelPrefix(
array: IntArray,
op: IntBinaryOperator
): Unit
Cumulates, in parallel, each element of the given array in place, using the supplied function. For example if the array initially holds [2, 1, 0, 3] and the operation performs addition, then upon return the array holds [2, 3, 3, 6]. Parallel prefix computation is usually more efficient than sequential loops for large arrays.
| Parameters | |
|---|---|
array |
IntArray: the array, which is modified in-place by this method |
op |
IntBinaryOperator: a side-effect-free, associative function to perform the cumulation |
| Exceptions | |
|---|---|
java.lang.NullPointerException |
if the specified array or function is null |
parallelPrefix
open static fun parallelPrefix(
array: IntArray,
fromIndex: Int,
toIndex: Int,
op: IntBinaryOperator
): Unit
Performs parallelPrefix(int[],java.util.function.IntBinaryOperator) for the given subrange of the array.
| Parameters | |
|---|---|
array |
IntArray: the array |
fromIndex |
Int: the index of the first element, inclusive |
toIndex |
Int: the index of the last element, exclusive |
op |
IntBinaryOperator: a side-effect-free, associative function to perform the cumulation |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > array.length |
java.lang.NullPointerException |
if the specified array or function is null |
parallelSetAll
open static fun <T : Any!> parallelSetAll(
array: Array<T>,
generator: IntFunction<out T>
): Unit
Set all elements of the specified array, in parallel, using the provided generator function to compute each element.
If the generator function throws an exception, an unchecked exception is thrown from parallelSetAll and the array is left in an indeterminate state.
| Parameters | |
|---|---|
<T> |
type of elements of the array |
array |
Array<T>: array to be initialized |
generator |
IntFunction<out T>: a function accepting an index and producing the desired value for that position |
| Exceptions | |
|---|---|
java.lang.NullPointerException |
if the generator is null |
parallelSetAll
open static fun parallelSetAll(
array: IntArray,
generator: IntUnaryOperator
): Unit
Set all elements of the specified array, in parallel, using the provided generator function to compute each element.
If the generator function throws an exception, an unchecked exception is thrown from parallelSetAll and the array is left in an indeterminate state.
| Parameters | |
|---|---|
array |
IntArray: array to be initialized |
generator |
IntUnaryOperator: a function accepting an index and producing the desired value for that position |
| Exceptions | |
|---|---|
java.lang.NullPointerException |
if the generator is null |
parallelSetAll
open static fun parallelSetAll(
array: LongArray,
generator: IntToLongFunction
): Unit
Set all elements of the specified array, in parallel, using the provided generator function to compute each element.
If the generator function throws an exception, an unchecked exception is thrown from parallelSetAll and the array is left in an indeterminate state.
| Parameters | |
|---|---|
array |
LongArray: array to be initialized |
generator |
IntToLongFunction: a function accepting an index and producing the desired value for that position |
| Exceptions | |
|---|---|
java.lang.NullPointerException |
if the generator is null |
parallelSetAll
open static fun parallelSetAll(
array: DoubleArray,
generator: IntToDoubleFunction
): Unit
Set all elements of the specified array, in parallel, using the provided generator function to compute each element.
If the generator function throws an exception, an unchecked exception is thrown from parallelSetAll and the array is left in an indeterminate state.
| Parameters | |
|---|---|
array |
DoubleArray: array to be initialized |
generator |
IntToDoubleFunction: a function accepting an index and producing the desired value for that position |
| Exceptions | |
|---|---|
java.lang.NullPointerException |
if the generator is null |
parallelSort
open static fun parallelSort(a: ByteArray): Unit
Sorts the specified array into ascending numerical order.
| Parameters | |
|---|---|
a |
ByteArray: the array to be sorted |
parallelSort
open static fun parallelSort(
a: ByteArray,
fromIndex: Int,
toIndex: Int
): Unit
Sorts the specified range of the array into ascending numerical order. The range to be sorted extends from the index fromIndex, inclusive, to the index toIndex, exclusive. If fromIndex == toIndex, the range to be sorted is empty.
| Parameters | |
|---|---|
a |
ByteArray: the array to be sorted |
fromIndex |
Int: the index of the first element, inclusive, to be sorted |
toIndex |
Int: the index of the last element, exclusive, to be sorted |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
parallelSort
open static fun parallelSort(a: CharArray): Unit
Sorts the specified array into ascending numerical order.
| Parameters | |
|---|---|
a |
CharArray: the array to be sorted |
parallelSort
open static fun parallelSort(
a: CharArray,
fromIndex: Int,
toIndex: Int
): Unit
Sorts the specified range of the array into ascending numerical order. The range to be sorted extends from the index fromIndex, inclusive, to the index toIndex, exclusive. If fromIndex == toIndex, the range to be sorted is empty.
| Parameters | |
|---|---|
a |
CharArray: the array to be sorted |
fromIndex |
Int: the index of the first element, inclusive, to be sorted |
toIndex |
Int: the index of the last element, exclusive, to be sorted |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
parallelSort
open static fun parallelSort(a: ShortArray): Unit
Sorts the specified array into ascending numerical order.
| Parameters | |
|---|---|
a |
ShortArray: the array to be sorted |
parallelSort
open static fun parallelSort(
a: ShortArray,
fromIndex: Int,
toIndex: Int
): Unit
Sorts the specified range of the array into ascending numerical order. The range to be sorted extends from the index fromIndex, inclusive, to the index toIndex, exclusive. If fromIndex == toIndex, the range to be sorted is empty.
| Parameters | |
|---|---|
a |
ShortArray: the array to be sorted |
fromIndex |
Int: the index of the first element, inclusive, to be sorted |
toIndex |
Int: the index of the last element, exclusive, to be sorted |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
parallelSort
open static fun parallelSort(a: IntArray): Unit
Sorts the specified array into ascending numerical order.
| Parameters | |
|---|---|
a |
IntArray: the array to be sorted |
parallelSort
open static fun parallelSort(
a: IntArray,
fromIndex: Int,
toIndex: Int
): Unit
Sorts the specified range of the array into ascending numerical order. The range to be sorted extends from the index fromIndex, inclusive, to the index toIndex, exclusive. If fromIndex == toIndex, the range to be sorted is empty.
| Parameters | |
|---|---|
a |
IntArray: the array to be sorted |
fromIndex |
Int: the index of the first element, inclusive, to be sorted |
toIndex |
Int: the index of the last element, exclusive, to be sorted |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
parallelSort
open static fun parallelSort(a: LongArray): Unit
Sorts the specified array into ascending numerical order.
| Parameters | |
|---|---|
a |
LongArray: the array to be sorted |
parallelSort
open static fun parallelSort(
a: LongArray,
fromIndex: Int,
toIndex: Int
): Unit
Sorts the specified range of the array into ascending numerical order. The range to be sorted extends from the index fromIndex, inclusive, to the index toIndex, exclusive. If fromIndex == toIndex, the range to be sorted is empty.
| Parameters | |
|---|---|
a |
LongArray: the array to be sorted |
fromIndex |
Int: the index of the first element, inclusive, to be sorted |
toIndex |
Int: the index of the last element, exclusive, to be sorted |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
parallelSort
open static fun parallelSort(a: FloatArray): Unit
Sorts the specified array into ascending numerical order.
The < relation does not provide a total order on all float values: -0.0f == 0.0f is true and a Float.NaN value compares neither less than, greater than, nor equal to any value, even itself. This method uses the total order imposed by the method Float#compareTo: -0.0f is treated as less than value 0.0f and Float.NaN is considered greater than any other value and all Float.NaN values are considered equal.
| Parameters | |
|---|---|
a |
FloatArray: the array to be sorted |
parallelSort
open static fun parallelSort(
a: FloatArray,
fromIndex: Int,
toIndex: Int
): Unit
Sorts the specified range of the array into ascending numerical order. The range to be sorted extends from the index fromIndex, inclusive, to the index toIndex, exclusive. If fromIndex == toIndex, the range to be sorted is empty.
The < relation does not provide a total order on all float values: -0.0f == 0.0f is true and a Float.NaN value compares neither less than, greater than, nor equal to any value, even itself. This method uses the total order imposed by the method Float#compareTo: -0.0f is treated as less than value 0.0f and Float.NaN is considered greater than any other value and all Float.NaN values are considered equal.
| Parameters | |
|---|---|
a |
FloatArray: the array to be sorted |
fromIndex |
Int: the index of the first element, inclusive, to be sorted |
toIndex |
Int: the index of the last element, exclusive, to be sorted |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
parallelSort
open static fun parallelSort(a: DoubleArray): Unit
Sorts the specified array into ascending numerical order.
The < relation does not provide a total order on all double values: -0.0d == 0.0d is true and a Double.NaN value compares neither less than, greater than, nor equal to any value, even itself. This method uses the total order imposed by the method Double#compareTo: -0.0d is treated as less than value 0.0d and Double.NaN is considered greater than any other value and all Double.NaN values are considered equal.
| Parameters | |
|---|---|
a |
DoubleArray: the array to be sorted |
parallelSort
open static fun parallelSort(
a: DoubleArray,
fromIndex: Int,
toIndex: Int
): Unit
Sorts the specified range of the array into ascending numerical order. The range to be sorted extends from the index fromIndex, inclusive, to the index toIndex, exclusive. If fromIndex == toIndex, the range to be sorted is empty.
The < relation does not provide a total order on all double values: -0.0d == 0.0d is true and a Double.NaN value compares neither less than, greater than, nor equal to any value, even itself. This method uses the total order imposed by the method Double#compareTo: -0.0d is treated as less than value 0.0d and Double.NaN is considered greater than any other value and all Double.NaN values are considered equal.
| Parameters | |
|---|---|
a |
DoubleArray: the array to be sorted |
fromIndex |
Int: the index of the first element, inclusive, to be sorted |
toIndex |
Int: the index of the last element, exclusive, to be sorted |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
parallelSort
open static fun <T : Comparable<T>!> parallelSort(a: Array<T>): Unit
Sorts the specified array of objects into ascending order, according to the Comparable of its elements. All elements in the array must implement the Comparable interface. Furthermore, all elements in the array must be mutually comparable (that is, e1.compareTo(e2) must not throw a ClassCastException for any elements e1 and e2 in the array).
This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.
| Parameters | |
|---|---|
<T> |
the class of the objects to be sorted |
a |
Array<T>: the array to be sorted |
| Exceptions | |
|---|---|
java.lang.ClassCastException |
if the array contains elements that are not mutually comparable (for example, strings and integers) |
java.lang.IllegalArgumentException |
(optional) if the natural ordering of the array elements is found to violate the Comparable contract |
parallelSort
open static fun <T : Comparable<T>!> parallelSort(
a: Array<T>,
fromIndex: Int,
toIndex: Int
): Unit
Sorts the specified range of the specified array of objects into ascending order, according to the Comparable of its elements. The range to be sorted extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be sorted is empty.) All elements in this range must implement the Comparable interface. Furthermore, all elements in this range must be mutually comparable (that is, e1.compareTo(e2) must not throw a ClassCastException for any elements e1 and e2 in the array).
This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.
| Parameters | |
|---|---|
<T> |
the class of the objects to be sorted |
a |
Array<T>: the array to be sorted |
fromIndex |
Int: the index of the first element (inclusive) to be sorted |
toIndex |
Int: the index of the last element (exclusive) to be sorted |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex or (optional) if the natural ordering of the array elements is found to violate the Comparable contract |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
java.lang.ClassCastException |
if the array contains elements that are not mutually comparable (for example, strings and integers). |
parallelSort
open static fun <T : Any!> parallelSort(
a: Array<T>,
cmp: Comparator<in T>?
): Unit
Sorts the specified array of objects according to the order induced by the specified comparator. All elements in the array must be mutually comparable by the specified comparator (that is, c.compare(e1, e2) must not throw a ClassCastException for any elements e1 and e2 in the array).
This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.
| Parameters | |
|---|---|
<T> |
the class of the objects to be sorted |
a |
Array<T>: the array to be sorted |
cmp |
Comparator<in T>?: the comparator to determine the order of the array. A null value indicates that the elements' Comparable should be used. |
| Exceptions | |
|---|---|
java.lang.ClassCastException |
if the array contains elements that are not mutually comparable using the specified comparator |
java.lang.IllegalArgumentException |
(optional) if the comparator is found to violate the java.util.Comparator contract |
parallelSort
open static fun <T : Any!> parallelSort(
a: Array<T>,
fromIndex: Int,
toIndex: Int,
cmp: Comparator<in T>?
): Unit
Sorts the specified range of the specified array of objects according to the order induced by the specified comparator. The range to be sorted extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be sorted is empty.) All elements in the range must be mutually comparable by the specified comparator (that is, c.compare(e1, e2) must not throw a ClassCastException for any elements e1 and e2 in the range).
This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.
| Parameters | |
|---|---|
<T> |
the class of the objects to be sorted |
a |
Array<T>: the array to be sorted |
fromIndex |
Int: the index of the first element (inclusive) to be sorted |
toIndex |
Int: the index of the last element (exclusive) to be sorted |
cmp |
Comparator<in T>?: the comparator to determine the order of the array. A null value indicates that the elements' Comparable should be used. |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex or (optional) if the natural ordering of the array elements is found to violate the Comparable contract |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
java.lang.ClassCastException |
if the array contains elements that are not mutually comparable (for example, strings and integers). |
setAll
open static fun <T : Any!> setAll(
array: Array<T>,
generator: IntFunction<out T>
): Unit
Set all elements of the specified array, using the provided generator function to compute each element.
If the generator function throws an exception, it is relayed to the caller and the array is left in an indeterminate state.
| Parameters | |
|---|---|
<T> |
type of elements of the array |
array |
Array<T>: array to be initialized |
generator |
IntFunction<out T>: a function accepting an index and producing the desired value for that position |
| Exceptions | |
|---|---|
java.lang.NullPointerException |
if the generator is null |
setAll
open static fun setAll(
array: IntArray,
generator: IntUnaryOperator
): Unit
Set all elements of the specified array, using the provided generator function to compute each element.
If the generator function throws an exception, it is relayed to the caller and the array is left in an indeterminate state.
| Parameters | |
|---|---|
array |
IntArray: array to be initialized |
generator |
IntUnaryOperator: a function accepting an index and producing the desired value for that position |
| Exceptions | |
|---|---|
java.lang.NullPointerException |
if the generator is null |
setAll
open static fun setAll(
array: LongArray,
generator: IntToLongFunction
): Unit
Set all elements of the specified array, using the provided generator function to compute each element.
If the generator function throws an exception, it is relayed to the caller and the array is left in an indeterminate state.
| Parameters | |
|---|---|
array |
LongArray: array to be initialized |
generator |
IntToLongFunction: a function accepting an index and producing the desired value for that position |
| Exceptions | |
|---|---|
java.lang.NullPointerException |
if the generator is null |
setAll
open static fun setAll(
array: DoubleArray,
generator: IntToDoubleFunction
): Unit
Set all elements of the specified array, using the provided generator function to compute each element.
If the generator function throws an exception, it is relayed to the caller and the array is left in an indeterminate state.
| Parameters | |
|---|---|
array |
DoubleArray: array to be initialized |
generator |
IntToDoubleFunction: a function accepting an index and producing the desired value for that position |
| Exceptions | |
|---|---|
java.lang.NullPointerException |
if the generator is null |
sort
open static fun sort(a: IntArray): Unit
Sorts the specified array into ascending numerical order.
Implementation note: The sorting algorithm is a Dual-Pivot Quicksort by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm offers O(n log(n)) performance on many data sets that cause other quicksorts to degrade to quadratic performance, and is typically faster than traditional (one-pivot) Quicksort implementations.
| Parameters | |
|---|---|
a |
IntArray: the array to be sorted |
sort
open static fun sort(
a: IntArray,
fromIndex: Int,
toIndex: Int
): Unit
Sorts the specified range of the array into ascending order. The range to be sorted extends from the index fromIndex, inclusive, to the index toIndex, exclusive. If fromIndex == toIndex, the range to be sorted is empty.
Implementation note: The sorting algorithm is a Dual-Pivot Quicksort by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm offers O(n log(n)) performance on many data sets that cause other quicksorts to degrade to quadratic performance, and is typically faster than traditional (one-pivot) Quicksort implementations.
| Parameters | |
|---|---|
a |
IntArray: the array to be sorted |
fromIndex |
Int: the index of the first element, inclusive, to be sorted |
toIndex |
Int: the index of the last element, exclusive, to be sorted |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
sort
open static fun sort(a: LongArray): Unit
Sorts the specified array into ascending numerical order.
Implementation note: The sorting algorithm is a Dual-Pivot Quicksort by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm offers O(n log(n)) performance on many data sets that cause other quicksorts to degrade to quadratic performance, and is typically faster than traditional (one-pivot) Quicksort implementations.
| Parameters | |
|---|---|
a |
LongArray: the array to be sorted |
sort
open static fun sort(
a: LongArray,
fromIndex: Int,
toIndex: Int
): Unit
Sorts the specified range of the array into ascending order. The range to be sorted extends from the index fromIndex, inclusive, to the index toIndex, exclusive. If fromIndex == toIndex, the range to be sorted is empty.
Implementation note: The sorting algorithm is a Dual-Pivot Quicksort by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm offers O(n log(n)) performance on many data sets that cause other quicksorts to degrade to quadratic performance, and is typically faster than traditional (one-pivot) Quicksort implementations.
| Parameters | |
|---|---|
a |
LongArray: the array to be sorted |
fromIndex |
Int: the index of the first element, inclusive, to be sorted |
toIndex |
Int: the index of the last element, exclusive, to be sorted |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
sort
open static fun sort(a: ShortArray): Unit
Sorts the specified array into ascending numerical order.
Implementation note: The sorting algorithm is a Dual-Pivot Quicksort by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm offers O(n log(n)) performance on many data sets that cause other quicksorts to degrade to quadratic performance, and is typically faster than traditional (one-pivot) Quicksort implementations.
| Parameters | |
|---|---|
a |
ShortArray: the array to be sorted |
sort
open static fun sort(
a: ShortArray,
fromIndex: Int,
toIndex: Int
): Unit
Sorts the specified range of the array into ascending order. The range to be sorted extends from the index fromIndex, inclusive, to the index toIndex, exclusive. If fromIndex == toIndex, the range to be sorted is empty.
Implementation note: The sorting algorithm is a Dual-Pivot Quicksort by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm offers O(n log(n)) performance on many data sets that cause other quicksorts to degrade to quadratic performance, and is typically faster than traditional (one-pivot) Quicksort implementations.
| Parameters | |
|---|---|
a |
ShortArray: the array to be sorted |
fromIndex |
Int: the index of the first element, inclusive, to be sorted |
toIndex |
Int: the index of the last element, exclusive, to be sorted |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
sort
open static fun sort(a: CharArray): Unit
Sorts the specified array into ascending numerical order.
Implementation note: The sorting algorithm is a Dual-Pivot Quicksort by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm offers O(n log(n)) performance on many data sets that cause other quicksorts to degrade to quadratic performance, and is typically faster than traditional (one-pivot) Quicksort implementations.
| Parameters | |
|---|---|
a |
CharArray: the array to be sorted |
sort
open static fun sort(
a: CharArray,
fromIndex: Int,
toIndex: Int
): Unit
Sorts the specified range of the array into ascending order. The range to be sorted extends from the index fromIndex, inclusive, to the index toIndex, exclusive. If fromIndex == toIndex, the range to be sorted is empty.
Implementation note: The sorting algorithm is a Dual-Pivot Quicksort by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm offers O(n log(n)) performance on many data sets that cause other quicksorts to degrade to quadratic performance, and is typically faster than traditional (one-pivot) Quicksort implementations.
| Parameters | |
|---|---|
a |
CharArray: the array to be sorted |
fromIndex |
Int: the index of the first element, inclusive, to be sorted |
toIndex |
Int: the index of the last element, exclusive, to be sorted |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
sort
open static fun sort(a: ByteArray): Unit
Sorts the specified array into ascending numerical order.
Implementation note: The sorting algorithm is a Dual-Pivot Quicksort by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm offers O(n log(n)) performance on many data sets that cause other quicksorts to degrade to quadratic performance, and is typically faster than traditional (one-pivot) Quicksort implementations.
| Parameters | |
|---|---|
a |
ByteArray: the array to be sorted |
sort
open static fun sort(
a: ByteArray,
fromIndex: Int,
toIndex: Int
): Unit
Sorts the specified range of the array into ascending order. The range to be sorted extends from the index fromIndex, inclusive, to the index toIndex, exclusive. If fromIndex == toIndex, the range to be sorted is empty.
Implementation note: The sorting algorithm is a Dual-Pivot Quicksort by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm offers O(n log(n)) performance on many data sets that cause other quicksorts to degrade to quadratic performance, and is typically faster than traditional (one-pivot) Quicksort implementations.
| Parameters | |
|---|---|
a |
ByteArray: the array to be sorted |
fromIndex |
Int: the index of the first element, inclusive, to be sorted |
toIndex |
Int: the index of the last element, exclusive, to be sorted |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
sort
open static fun sort(a: FloatArray): Unit
Sorts the specified array into ascending numerical order.
The < relation does not provide a total order on all float values: -0.0f == 0.0f is true and a Float.NaN value compares neither less than, greater than, nor equal to any value, even itself. This method uses the total order imposed by the method Float#compareTo: -0.0f is treated as less than value 0.0f and Float.NaN is considered greater than any other value and all Float.NaN values are considered equal.
Implementation note: The sorting algorithm is a Dual-Pivot Quicksort by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm offers O(n log(n)) performance on many data sets that cause other quicksorts to degrade to quadratic performance, and is typically faster than traditional (one-pivot) Quicksort implementations.
| Parameters | |
|---|---|
a |
FloatArray: the array to be sorted |
sort
open static fun sort(
a: FloatArray,
fromIndex: Int,
toIndex: Int
): Unit
Sorts the specified range of the array into ascending order. The range to be sorted extends from the index fromIndex, inclusive, to the index toIndex, exclusive. If fromIndex == toIndex, the range to be sorted is empty.
The < relation does not provide a total order on all float values: -0.0f == 0.0f is true and a Float.NaN value compares neither less than, greater than, nor equal to any value, even itself. This method uses the total order imposed by the method Float#compareTo: -0.0f is treated as less than value 0.0f and Float.NaN is considered greater than any other value and all Float.NaN values are considered equal.
Implementation note: The sorting algorithm is a Dual-Pivot Quicksort by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm offers O(n log(n)) performance on many data sets that cause other quicksorts to degrade to quadratic performance, and is typically faster than traditional (one-pivot) Quicksort implementations.
| Parameters | |
|---|---|
a |
FloatArray: the array to be sorted |
fromIndex |
Int: the index of the first element, inclusive, to be sorted |
toIndex |
Int: the index of the last element, exclusive, to be sorted |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
sort
open static fun sort(a: DoubleArray): Unit
Sorts the specified array into ascending numerical order.
The < relation does not provide a total order on all double values: -0.0d == 0.0d is true and a Double.NaN value compares neither less than, greater than, nor equal to any value, even itself. This method uses the total order imposed by the method Double#compareTo: -0.0d is treated as less than value 0.0d and Double.NaN is considered greater than any other value and all Double.NaN values are considered equal.
Implementation note: The sorting algorithm is a Dual-Pivot Quicksort by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm offers O(n log(n)) performance on many data sets that cause other quicksorts to degrade to quadratic performance, and is typically faster than traditional (one-pivot) Quicksort implementations.
| Parameters | |
|---|---|
a |
DoubleArray: the array to be sorted |
sort
open static fun sort(
a: DoubleArray,
fromIndex: Int,
toIndex: Int
): Unit
Sorts the specified range of the array into ascending order. The range to be sorted extends from the index fromIndex, inclusive, to the index toIndex, exclusive. If fromIndex == toIndex, the range to be sorted is empty.
The < relation does not provide a total order on all double values: -0.0d == 0.0d is true and a Double.NaN value compares neither less than, greater than, nor equal to any value, even itself. This method uses the total order imposed by the method Double#compareTo: -0.0d is treated as less than value 0.0d and Double.NaN is considered greater than any other value and all Double.NaN values are considered equal.
Implementation note: The sorting algorithm is a Dual-Pivot Quicksort by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm offers O(n log(n)) performance on many data sets that cause other quicksorts to degrade to quadratic performance, and is typically faster than traditional (one-pivot) Quicksort implementations.
| Parameters | |
|---|---|
a |
DoubleArray: the array to be sorted |
fromIndex |
Int: the index of the first element, inclusive, to be sorted |
toIndex |
Int: the index of the last element, exclusive, to be sorted |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
sort
open static fun sort(a: Array<Any!>): Unit
Sorts the specified array of objects into ascending order, according to the Comparable of its elements. All elements in the array must implement the Comparable interface. Furthermore, all elements in the array must be mutually comparable (that is, e1.compareTo(e2) must not throw a ClassCastException for any elements e1 and e2 in the array).
This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.
Implementation note: This implementation is a stable, adaptive, iterative mergesort that requires far fewer than n lg(n) comparisons when the input array is partially sorted, while offering the performance of a traditional mergesort when the input array is randomly ordered. If the input array is nearly sorted, the implementation requires approximately n comparisons. Temporary storage requirements vary from a small constant for nearly sorted input arrays to n/2 object references for randomly ordered input arrays.
The implementation takes equal advantage of ascending and descending order in its input array, and can take advantage of ascending and descending order in different parts of the the same input array. It is well-suited to merging two or more sorted arrays: simply concatenate the arrays and sort the resulting array.
The implementation was adapted from Tim Peters's list sort for Python ( TimSort). It uses techniques from Peter McIlroy's "Optimistic Sorting and Information Theoretic Complexity", in Proceedings of the Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, pp 467-474, January 1993.
| Parameters | |
|---|---|
a |
Array<Any!>: the array to be sorted |
| Exceptions | |
|---|---|
java.lang.ClassCastException |
if the array contains elements that are not mutually comparable (for example, strings and integers) |
java.lang.IllegalArgumentException |
(optional) if the natural ordering of the array elements is found to violate the Comparable contract |
sort
open static fun sort(
a: Array<Any!>,
fromIndex: Int,
toIndex: Int
): Unit
Sorts the specified range of the specified array of objects into ascending order, according to the Comparable of its elements. The range to be sorted extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be sorted is empty.) All elements in this range must implement the Comparable interface. Furthermore, all elements in this range must be mutually comparable (that is, e1.compareTo(e2) must not throw a ClassCastException for any elements e1 and e2 in the array).
This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.
Implementation note: This implementation is a stable, adaptive, iterative mergesort that requires far fewer than n lg(n) comparisons when the input array is partially sorted, while offering the performance of a traditional mergesort when the input array is randomly ordered. If the input array is nearly sorted, the implementation requires approximately n comparisons. Temporary storage requirements vary from a small constant for nearly sorted input arrays to n/2 object references for randomly ordered input arrays.
The implementation takes equal advantage of ascending and descending order in its input array, and can take advantage of ascending and descending order in different parts of the the same input array. It is well-suited to merging two or more sorted arrays: simply concatenate the arrays and sort the resulting array.
The implementation was adapted from Tim Peters's list sort for Python ( TimSort). It uses techniques from Peter McIlroy's "Optimistic Sorting and Information Theoretic Complexity", in Proceedings of the Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, pp 467-474, January 1993.
| Parameters | |
|---|---|
a |
Array<Any!>: the array to be sorted |
fromIndex |
Int: the index of the first element (inclusive) to be sorted |
toIndex |
Int: the index of the last element (exclusive) to be sorted |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if fromIndex > toIndex or (optional) if the natural ordering of the array elements is found to violate the Comparable contract |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
java.lang.ClassCastException |
if the array contains elements that are not mutually comparable (for example, strings and integers). |
sort
open static fun <T : Any!> sort(
a: Array<T>,
c: Comparator<in T>?
): Unit
Sorts the specified array of objects according to the order induced by the specified comparator. All elements in the array must be mutually comparable by the specified comparator (that is, c.compare(e1, e2) must not throw a ClassCastException for any elements e1 and e2 in the array).
This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.
Implementation note: This implementation is a stable, adaptive, iterative mergesort that requires far fewer than n lg(n) comparisons when the input array is partially sorted, while offering the performance of a traditional mergesort when the input array is randomly ordered. If the input array is nearly sorted, the implementation requires approximately n comparisons. Temporary storage requirements vary from a small constant for nearly sorted input arrays to n/2 object references for randomly ordered input arrays.
The implementation takes equal advantage of ascending and descending order in its input array, and can take advantage of ascending and descending order in different parts of the the same input array. It is well-suited to merging two or more sorted arrays: simply concatenate the arrays and sort the resulting array.
The implementation was adapted from Tim Peters's list sort for Python ( TimSort). It uses techniques from Peter McIlroy's "Optimistic Sorting and Information Theoretic Complexity", in Proceedings of the Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, pp 467-474, January 1993.
| Parameters | |
|---|---|
<T> |
the class of the objects to be sorted |
a |
Array<T>: the array to be sorted |
c |
Comparator<in T>?: the comparator to determine the order of the array. A null value indicates that the elements' Comparable should be used. |
| Exceptions | |
|---|---|
java.lang.ClassCastException |
if the array contains elements that are not mutually comparable using the specified comparator |
java.lang.IllegalArgumentException |
(optional) if the comparator is found to violate the Comparator contract |
sort
open static fun <T : Any!> sort(
a: Array<T>,
fromIndex: Int,
toIndex: Int,
c: Comparator<in T>?
): Unit
Sorts the specified range of the specified array of objects according to the order induced by the specified comparator. The range to be sorted extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be sorted is empty.) All elements in the range must be mutually comparable by the specified comparator (that is, c.compare(e1, e2) must not throw a ClassCastException for any elements e1 and e2 in the range).
This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.
Implementation note: This implementation is a stable, adaptive, iterative mergesort that requires far fewer than n lg(n) comparisons when the input array is partially sorted, while offering the performance of a traditional mergesort when the input array is randomly ordered. If the input array is nearly sorted, the implementation requires approximately n comparisons. Temporary storage requirements vary from a small constant for nearly sorted input arrays to n/2 object references for randomly ordered input arrays.
The implementation takes equal advantage of ascending and descending order in its input array, and can take advantage of ascending and descending order in different parts of the the same input array. It is well-suited to merging two or more sorted arrays: simply concatenate the arrays and sort the resulting array.
The implementation was adapted from Tim Peters's list sort for Python ( TimSort). It uses techniques from Peter McIlroy's "Optimistic Sorting and Information Theoretic Complexity", in Proceedings of the Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, pp 467-474, January 1993.
| Parameters | |
|---|---|
<T> |
the class of the objects to be sorted |
a |
Array<T>: the array to be sorted |
fromIndex |
Int: the index of the first element (inclusive) to be sorted |
toIndex |
Int: the index of the last element (exclusive) to be sorted |
c |
Comparator<in T>?: the comparator to determine the order of the array. A null value indicates that the elements' Comparable should be used. |
| Exceptions | |
|---|---|
java.lang.ClassCastException |
if the array contains elements that are not mutually comparable using the specified comparator. |
java.lang.IllegalArgumentException |
if fromIndex > toIndex or (optional) if the comparator is found to violate the Comparator contract |
java.lang.ArrayIndexOutOfBoundsException |
if fromIndex < 0 or toIndex > a.length |
spliterator
open static fun <T : Any!> spliterator(array: Array<T>): Spliterator<T>
Returns a Spliterator covering all of the specified array.
The spliterator reports Spliterator#SIZED, Spliterator#SUBSIZED, Spliterator#ORDERED, and Spliterator#IMMUTABLE.
| Parameters | |
|---|---|
<T> |
type of elements |
array |
Array<T>: the array, assumed to be unmodified during use |
| Return | |
|---|---|
Spliterator<T> |
a spliterator for the array elements |
spliterator
open static fun <T : Any!> spliterator(
array: Array<T>,
startInclusive: Int,
endExclusive: Int
): Spliterator<T>
Returns a Spliterator covering the specified range of the specified array.
The spliterator reports Spliterator#SIZED, Spliterator#SUBSIZED, Spliterator#ORDERED, and Spliterator#IMMUTABLE.
| Parameters | |
|---|---|
<T> |
type of elements |
array |
Array<T>: the array, assumed to be unmodified during use |
startInclusive |
Int: the first index to cover, inclusive |
endExclusive |
Int: index immediately past the last index to cover |
| Return | |
|---|---|
Spliterator<T> |
a spliterator for the array elements |
| Exceptions | |
|---|---|
java.lang.ArrayIndexOutOfBoundsException |
if startInclusive is negative, endExclusive is less than startInclusive, or endExclusive is greater than the array size |
spliterator
open static fun spliterator(array: IntArray): Spliterator.OfInt
Returns a Spliterator.OfInt covering all of the specified array.
The spliterator reports Spliterator#SIZED, Spliterator#SUBSIZED, Spliterator#ORDERED, and Spliterator#IMMUTABLE.
| Parameters | |
|---|---|
array |
IntArray: the array, assumed to be unmodified during use |
| Return | |
|---|---|
Spliterator.OfInt |
a spliterator for the array elements |
spliterator
open static fun spliterator(
array: IntArray,
startInclusive: Int,
endExclusive: Int
): Spliterator.OfInt
Returns a Spliterator.OfInt covering the specified range of the specified array.
The spliterator reports Spliterator#SIZED, Spliterator#SUBSIZED, Spliterator#ORDERED, and Spliterator#IMMUTABLE.
| Parameters | |
|---|---|
array |
IntArray: the array, assumed to be unmodified during use |
startInclusive |
Int: the first index to cover, inclusive |
endExclusive |
Int: index immediately past the last index to cover |
| Return | |
|---|---|
Spliterator.OfInt |
a spliterator for the array elements |
| Exceptions | |
|---|---|
java.lang.ArrayIndexOutOfBoundsException |
if startInclusive is negative, endExclusive is less than startInclusive, or endExclusive is greater than the array size |
spliterator
open static fun spliterator(array: LongArray): Spliterator.OfLong
Returns a Spliterator.OfLong covering all of the specified array.
The spliterator reports Spliterator#SIZED, Spliterator#SUBSIZED, Spliterator#ORDERED, and Spliterator#IMMUTABLE.
| Parameters | |
|---|---|
array |
LongArray: the array, assumed to be unmodified during use |
| Return | |
|---|---|
Spliterator.OfLong |
the spliterator for the array elements |
spliterator
open static fun spliterator(
array: LongArray,
startInclusive: Int,
endExclusive: Int
): Spliterator.OfLong
Returns a Spliterator.OfLong covering the specified range of the specified array.
The spliterator reports Spliterator#SIZED, Spliterator#SUBSIZED, Spliterator#ORDERED, and Spliterator#IMMUTABLE.
| Parameters | |
|---|---|
array |
LongArray: the array, assumed to be unmodified during use |
startInclusive |
Int: the first index to cover, inclusive |
endExclusive |
Int: index immediately past the last index to cover |
| Return | |
|---|---|
Spliterator.OfLong |
a spliterator for the array elements |
| Exceptions | |
|---|---|
java.lang.ArrayIndexOutOfBoundsException |
if startInclusive is negative, endExclusive is less than startInclusive, or endExclusive is greater than the array size |
spliterator
open static fun spliterator(array: DoubleArray): Spliterator.OfDouble
Returns a Spliterator.OfDouble covering all of the specified array.
The spliterator reports Spliterator#SIZED, Spliterator#SUBSIZED, Spliterator#ORDERED, and Spliterator#IMMUTABLE.
| Parameters | |
|---|---|
array |
DoubleArray: the array, assumed to be unmodified during use |
| Return | |
|---|---|
Spliterator.OfDouble |
a spliterator for the array elements |
spliterator
open static fun spliterator(
array: DoubleArray,
startInclusive: Int,
endExclusive: Int
): Spliterator.OfDouble
Returns a Spliterator.OfDouble covering the specified range of the specified array.
The spliterator reports Spliterator#SIZED, Spliterator#SUBSIZED, Spliterator#ORDERED, and Spliterator#IMMUTABLE.
| Parameters | |
|---|---|
array |
DoubleArray: the array, assumed to be unmodified during use |
startInclusive |
Int: the first index to cover, inclusive |
endExclusive |
Int: index immediately past the last index to cover |
| Return | |
|---|---|
Spliterator.OfDouble |
a spliterator for the array elements |
| Exceptions | |
|---|---|
java.lang.ArrayIndexOutOfBoundsException |
if startInclusive is negative, endExclusive is less than startInclusive, or endExclusive is greater than the array size |
stream
open static fun <T : Any!> stream(array: Array<T>): Stream<T>
Returns a sequential Stream with the specified array as its source.
| Parameters | |
|---|---|
<T> |
The type of the array elements |
array |
Array<T>: The array, assumed to be unmodified during use |
| Return | |
|---|---|
Stream<T> |
a Stream for the array |
stream
open static fun <T : Any!> stream(
array: Array<T>,
startInclusive: Int,
endExclusive: Int
): Stream<T>
Returns a sequential Stream with the specified range of the specified array as its source.
| Parameters | |
|---|---|
<T> |
the type of the array elements |
array |
Array<T>: the array, assumed to be unmodified during use |
startInclusive |
Int: the first index to cover, inclusive |
endExclusive |
Int: index immediately past the last index to cover |
| Return | |
|---|---|
Stream<T> |
a Stream for the array range |
| Exceptions | |
|---|---|
java.lang.ArrayIndexOutOfBoundsException |
if startInclusive is negative, endExclusive is less than startInclusive, or endExclusive is greater than the array size |
stream
open static fun stream(array: IntArray): IntStream
Returns a sequential IntStream with the specified array as its source.
| Parameters | |
|---|---|
array |
IntArray: the array, assumed to be unmodified during use |
| Return | |
|---|---|
IntStream |
an IntStream for the array |
stream
open static fun stream(
array: IntArray,
startInclusive: Int,
endExclusive: Int
): IntStream
Returns a sequential IntStream with the specified range of the specified array as its source.
| Parameters | |
|---|---|
array |
IntArray: the array, assumed to be unmodified during use |
startInclusive |
Int: the first index to cover, inclusive |
endExclusive |
Int: index immediately past the last index to cover |
| Return | |
|---|---|
IntStream |
an IntStream for the array range |
| Exceptions | |
|---|---|
java.lang.ArrayIndexOutOfBoundsException |
if startInclusive is negative, endExclusive is less than startInclusive, or endExclusive is greater than the array size |
stream
open static fun stream(array: LongArray): LongStream
Returns a sequential LongStream with the specified array as its source.
| Parameters | |
|---|---|
array |
LongArray: the array, assumed to be unmodified during use |
| Return | |
|---|---|
LongStream |
a LongStream for the array |
stream
open static fun stream(
array: LongArray,
startInclusive: Int,
endExclusive: Int
): LongStream
Returns a sequential LongStream with the specified range of the specified array as its source.
| Parameters | |
|---|---|
array |
LongArray: the array, assumed to be unmodified during use |
startInclusive |
Int: the first index to cover, inclusive |
endExclusive |
Int: index immediately past the last index to cover |
| Return | |
|---|---|
LongStream |
a LongStream for the array range |
| Exceptions | |
|---|---|
java.lang.ArrayIndexOutOfBoundsException |
if startInclusive is negative, endExclusive is less than startInclusive, or endExclusive is greater than the array size |
stream
open static fun stream(array: DoubleArray): DoubleStream
Returns a sequential DoubleStream with the specified array as its source.
| Parameters | |
|---|---|
array |
DoubleArray: the array, assumed to be unmodified during use |
| Return | |
|---|---|
DoubleStream |
a DoubleStream for the array |
stream
open static fun stream(
array: DoubleArray,
startInclusive: Int,
endExclusive: Int
): DoubleStream
Returns a sequential DoubleStream with the specified range of the specified array as its source.
| Parameters | |
|---|---|
array |
DoubleArray: the array, assumed to be unmodified during use |
startInclusive |
Int: the first index to cover, inclusive |
endExclusive |
Int: index immediately past the last index to cover |
| Return | |
|---|---|
DoubleStream |
a DoubleStream for the array range |
| Exceptions | |
|---|---|
java.lang.ArrayIndexOutOfBoundsException |
if startInclusive is negative, endExclusive is less than startInclusive, or endExclusive is greater than the array size |
toString
open static fun toString(a: LongArray?): String
Returns a string representation of the contents of the specified array. The string representation consists of a list of the array's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Elements are converted to strings as by String.valueOf(long). Returns "null" if a is null.
| Parameters | |
|---|---|
a |
LongArray?: the array whose string representation to return |
| Return | |
|---|---|
String |
a string representation of a |
toString
open static fun toString(a: IntArray?): String
Returns a string representation of the contents of the specified array. The string representation consists of a list of the array's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Elements are converted to strings as by String.valueOf(int). Returns "null" if a is null.
| Parameters | |
|---|---|
a |
IntArray?: the array whose string representation to return |
| Return | |
|---|---|
String |
a string representation of a |
toString
open static fun toString(a: ShortArray?): String
Returns a string representation of the contents of the specified array. The string representation consists of a list of the array's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Elements are converted to strings as by String.valueOf(short). Returns "null" if a is null.
| Parameters | |
|---|---|
a |
ShortArray?: the array whose string representation to return |
| Return | |
|---|---|
String |
a string representation of a |
toString
open static fun toString(a: CharArray?): String
Returns a string representation of the contents of the specified array. The string representation consists of a list of the array's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Elements are converted to strings as by String.valueOf(char). Returns "null" if a is null.
| Parameters | |
|---|---|
a |
CharArray?: the array whose string representation to return |
| Return | |
|---|---|
String |
a string representation of a |
toString
open static fun toString(a: ByteArray?): String
Returns a string representation of the contents of the specified array. The string representation consists of a list of the array's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Elements are converted to strings as by String.valueOf(byte). Returns "null" if a is null.
| Parameters | |
|---|---|
a |
ByteArray?: the array whose string representation to return |
| Return | |
|---|---|
String |
a string representation of a |
toString
open static fun toString(a: BooleanArray?): String
Returns a string representation of the contents of the specified array. The string representation consists of a list of the array's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Elements are converted to strings as by String.valueOf(boolean). Returns "null" if a is null.
| Parameters | |
|---|---|
a |
BooleanArray?: the array whose string representation to return |
| Return | |
|---|---|
String |
a string representation of a |
toString
open static fun toString(a: FloatArray?): String
Returns a string representation of the contents of the specified array. The string representation consists of a list of the array's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Elements are converted to strings as by String.valueOf(float). Returns "null" if a is null.
| Parameters | |
|---|---|
a |
FloatArray?: the array whose string representation to return |
| Return | |
|---|---|
String |
a string representation of a |
toString
open static fun toString(a: DoubleArray?): String
Returns a string representation of the contents of the specified array. The string representation consists of a list of the array's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Elements are converted to strings as by String.valueOf(double). Returns "null" if a is null.
| Parameters | |
|---|---|
a |
DoubleArray?: the array whose string representation to return |
| Return | |
|---|---|
String |
a string representation of a |
toString
open static fun toString(a: Array<Any!>?): String
Returns a string representation of the contents of the specified array. If the array contains other arrays as elements, they are converted to strings by the Object#toString method inherited from Object, which describes their identities rather than their contents.
The value returned by this method is equal to the value that would be returned by Arrays.asList(a).toString(), unless a is null, in which case "null" is returned.
| Parameters | |
|---|---|
a |
Array<Any!>?: the array whose string representation to return |
| Return | |
|---|---|
String |
a string representation of a |
See Also