DoubleArray

class DoubleArray(size: Int)(source)

An array of doubles. When targeting the JVM, instances of this class are represented as double[].

Since Kotlin

1.0

Constructors

Link copied to clipboard
fun DoubleArray(size: Int, init: (Int) -> Double)

Creates a new array of the specified size, where each element is calculated by calling the specified init function.

Link copied to clipboard
fun DoubleArray(size: Int)

Creates a new array of the specified size, with all elements initialized to zero.

Functions

Link copied to clipboard
operator fun get(index: Int): Double

Returns the array element at the given index. This method can be called using the index operator.

Since Kotlin 1.0
Link copied to clipboard
operator fun iterator(): DoubleIterator

Creates an iterator over the elements of the array.

Since Kotlin 1.0
Link copied to clipboard
operator fun set(index: Int, value: Double)

Sets the element at the given index to the given value. This method can be called using the index operator.

Since Kotlin 1.0

Properties

Link copied to clipboard
val size: Int

Returns the number of elements in the array.

Since Kotlin 1.0

Extensions

Link copied to clipboard
actual fun DoubleArray.asList(): List<Double>

Returns a List that wraps the original array.

Since Kotlin 1.0
Link copied to clipboard
fun DoubleArray.binarySearch(element: Double, fromIndex: Int = 0, toIndex: Int = size): Int

Searches the array or the range of the array for the provided element using the binary search algorithm. The array is expected to be sorted, otherwise the result is undefined.

Since Kotlin 1.0
Link copied to clipboard
actual inline fun DoubleArray.copyOf(): DoubleArray

Returns new array which is a copy of the original array.

Since Kotlin 1.0
actual inline fun DoubleArray.copyOf(newSize: Int): DoubleArray

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with zero values if necessary.

Since Kotlin 1.0
Link copied to clipboard
@JvmName(name = "copyOfRangeInline")
actual inline fun DoubleArray.copyOfRange(fromIndex: Int, toIndex: Int): DoubleArray

Returns a new array which is a copy of the specified range of the original array.

Since Kotlin 1.0
Link copied to clipboard
actual inline fun DoubleArray.elementAt(index: Int): Double

Returns an element at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this array.

Since Kotlin 1.0
Link copied to clipboard
actual fun DoubleArray.fill(element: Double, fromIndex: Int = 0, toIndex: Int = size)

Fills this array or its subrange with the specified element value.

Since Kotlin 1.0
Link copied to clipboard
Since Kotlin 1.0
Link copied to clipboard
inline fun <R : Comparable<R>> DoubleArray.maxBy(selector: (Double) -> R): Double?
Since Kotlin 1.0
Link copied to clipboard
fun DoubleArray.maxWith(comparator: Comparator<in Double>): Double?
Since Kotlin 1.0
Link copied to clipboard
Since Kotlin 1.0
Link copied to clipboard
inline fun <R : Comparable<R>> DoubleArray.minBy(selector: (Double) -> R): Double?
Since Kotlin 1.0
Link copied to clipboard
fun DoubleArray.minWith(comparator: Comparator<in Double>): Double?
Since Kotlin 1.0
Link copied to clipboard
actual operator fun DoubleArray.plus(element: Double): DoubleArray

Returns an array containing all elements of the original array and then the given element.

Since Kotlin 1.0
actual operator fun DoubleArray.plus(elements: Collection<Double>): DoubleArray

Returns an array containing all elements of the original array and then all elements of the given elements collection.

Since Kotlin 1.0
actual operator fun DoubleArray.plus(elements: DoubleArray): DoubleArray

Returns an array containing all elements of the original array and then all elements of the given elements array.

Since Kotlin 1.0
Link copied to clipboard
actual fun DoubleArray.sort()

Sorts the array in-place.

Since Kotlin 1.0
actual fun DoubleArray.sort(fromIndex: Int = 0, toIndex: Int = size)

Sorts a range in the array in-place.

Since Kotlin 1.0
Link copied to clipboard

Returns a new SortedSet of all elements.

Since Kotlin 1.0
Link copied to clipboard

Returns a typed object array containing all of the elements of this primitive array.

Since Kotlin 1.0