MutableDoubleList
-
Cmn
class MutableDoubleList : DoubleList
MutableDoubleList is a MutableList-like collection for Double values. It allows storing and retrieving the elements without boxing. Immutable access is available through its base class DoubleList, which has a List-like interface.
This implementation is not thread-safe: if multiple threads access this container concurrently, and one or more threads modify the structure of the list (insertion or removal for instance), the calling code must provide the appropriate synchronization. It is also not safe to mutate during reentrancy -- in the middle of a forEach, for example. However, concurrent reads are safe.
Summary
Public constructors |
|
|---|---|
MutableDoubleList(initialCapacity: Int)Creates a |
Cmn
|
Public functions |
||
|---|---|---|
Boolean |
Adds |
Cmn
|
Unit |
Adds |
Cmn
|
inline Boolean |
addAll(elements: DoubleArray)Adds all |
Cmn
|
inline Boolean |
addAll(elements: DoubleList)Adds all |
Cmn
|
Boolean |
addAll(index: @IntRange(from = 0) Int, elements: DoubleArray)Adds all |
Cmn
|
Boolean |
addAll(index: @IntRange(from = 0) Int, elements: DoubleList)Adds all |
Cmn
|
Unit |
clear()Removes all elements in the |
Cmn
|
Unit |
ensureCapacity(capacity: Int)Ensures that there is enough space to store |
Cmn
|
inline operator Unit |
minusAssign(element: Double)
|
Cmn
|
operator Unit |
minusAssign(elements: DoubleArray)Removes all |
Cmn
|
operator Unit |
minusAssign(elements: DoubleList)Removes all |
Cmn
|
inline operator Unit |
plusAssign(element: Double)
|
Cmn
|
inline operator Unit |
plusAssign(elements: DoubleArray)Adds all |
Cmn
|
inline operator Unit |
plusAssign(elements: DoubleList)Adds all |
Cmn
|
Boolean |
Removes |
Cmn
|
Boolean |
removeAll(elements: DoubleArray)Removes all |
Cmn
|
Boolean |
removeAll(elements: DoubleList)Removes all |
Cmn
|
Double |
Removes the element at the given |
Cmn
|
Unit |
removeRange(start: @IntRange(from = 0) Int, end: @IntRange(from = 0) Int)Removes items from index |
Cmn
|
Boolean |
retainAll(elements: DoubleArray)Keeps only |
Cmn
|
Boolean |
retainAll(elements: DoubleList)Keeps only |
Cmn
|
operator Double |
Cmn
|
|
Unit |
sort()Sorts the |
Cmn
|
Unit |
Sorts the |
Cmn
|
Unit |
Reduces the internal storage. |
Cmn
|
Public properties |
||
|---|---|---|
Int |
Returns the total number of elements that can be held before the |
Cmn
|
Inherited functions |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Inherited properties |
|||||||||
|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
MutableDoubleList
MutableDoubleList(initialCapacity: Int = 16)
Creates a MutableDoubleList with a capacity of initialCapacity.
Public functions
add
fun add(index: @IntRange(from = 0) Int, element: Double): Unit
Adds element to the MutableDoubleList at the given index, shifting over any elements at index and after, if any.
addAll
inline fun addAll(elements: DoubleArray): Boolean
Adds all elements to the end of the MutableDoubleList and returns true if the MutableDoubleList was changed or false if elements was empty.
addAll
inline fun addAll(elements: DoubleList): Boolean
Adds all elements to the end of the MutableDoubleList and returns true if the MutableDoubleList was changed or false if elements was empty.
addAll
fun addAll(index: @IntRange(from = 0) Int, elements: DoubleArray): Boolean
Adds all elements to the MutableDoubleList at the given index, shifting over any elements at index and after, if any.
| Returns | |
|---|---|
Boolean |
|
addAll
fun addAll(index: @IntRange(from = 0) Int, elements: DoubleList): Boolean
Adds all elements to the MutableDoubleList at the given index, shifting over any elements at index and after, if any.
| Returns | |
|---|---|
Boolean |
|
clear
fun clear(): Unit
Removes all elements in the MutableDoubleList. The storage isn't released.
| See also | |
|---|---|
trim |
ensureCapacity
fun ensureCapacity(capacity: Int): Unit
Ensures that there is enough space to store capacity elements in the MutableDoubleList.
| See also | |
|---|---|
trim |
minusAssign
inline operator fun minusAssign(element: Double): Unit
remove from the MutableDoubleList
minusAssign
operator fun minusAssign(elements: DoubleArray): Unit
Removes all elements from the MutableDoubleList.
minusAssign
operator fun minusAssign(elements: DoubleList): Unit
Removes all elements from the MutableDoubleList.
plusAssign
inline operator fun plusAssign(elements: DoubleArray): Unit
Adds all elements to the end of the MutableDoubleList.
plusAssign
inline operator fun plusAssign(elements: DoubleList): Unit
Adds all elements to the end of the MutableDoubleList.
remove
fun remove(element: Double): Boolean
Removes element from the MutableDoubleList. If element was in the MutableDoubleList and was removed, true will be returned, or false will be returned if the element was not found.
removeAll
fun removeAll(elements: DoubleArray): Boolean
Removes all elements from the MutableDoubleList and returns true if anything was removed.
removeAll
fun removeAll(elements: DoubleList): Boolean
Removes all elements from the MutableDoubleList and returns true if anything was removed.
removeAt
fun removeAt(index: @IntRange(from = 0) Int): Double
Removes the element at the given index and returns it.
removeRange
fun removeRange(start: @IntRange(from = 0) Int, end: @IntRange(from = 0) Int): Unit
Removes items from index start (inclusive) to end (exclusive).
retainAll
fun retainAll(elements: DoubleArray): Boolean
Keeps only elements in the MutableDoubleList and removes all other values.
| Returns | |
|---|---|
Boolean |
|
retainAll
fun retainAll(elements: DoubleList): Boolean
Keeps only elements in the MutableDoubleList and removes all other values.
| Returns | |
|---|---|
Boolean |
|
set
operator fun set(index: @IntRange(from = 0) Int, element: Double): Double
trim
fun trim(minCapacity: Int = _size): Unit
Reduces the internal storage. If capacity is greater than minCapacity and size, the internal storage is reduced to the maximum of size and minCapacity.
| See also | |
|---|---|
ensureCapacity |
Public properties
capacity
val capacity: Int
Returns the total number of elements that can be held before the MutableDoubleList must grow.
| See also | |
|---|---|
ensureCapacity |