MutableLongList
-
Cmn
class MutableLongList : LongList
MutableLongList is a MutableList-like collection for Long values. It allows storing and retrieving the elements without boxing. Immutable access is available through its base class LongList, 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 |
|
|---|---|
MutableLongList(initialCapacity: Int)Creates a |
Cmn
|
Public functions |
||
|---|---|---|
Boolean |
Adds |
Cmn
|
Unit |
Adds |
Cmn
|
inline Boolean |
Adds all |
Cmn
|
inline Boolean |
Adds all |
Cmn
|
Boolean |
Adds all |
Cmn
|
Boolean |
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: Long)
|
Cmn
|
operator Unit |
minusAssign(elements: LongArray)Removes all |
Cmn
|
operator Unit |
minusAssign(elements: LongList)Removes all |
Cmn
|
inline operator Unit |
plusAssign(element: Long)
|
Cmn
|
inline operator Unit |
plusAssign(elements: LongArray)Adds all |
Cmn
|
inline operator Unit |
plusAssign(elements: LongList)Adds all |
Cmn
|
Boolean |
Removes |
Cmn
|
Boolean |
Removes all |
Cmn
|
Boolean |
Removes all |
Cmn
|
Long |
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 |
Keeps only |
Cmn
|
Boolean |
Keeps only |
Cmn
|
operator Long |
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
MutableLongList
MutableLongList(initialCapacity: Int = 16)
Creates a MutableLongList with a capacity of initialCapacity.
Public functions
add
fun add(index: @IntRange(from = 0) Int, element: Long): Unit
Adds element to the MutableLongList at the given index, shifting over any elements at index and after, if any.
addAll
inline fun addAll(elements: LongArray): Boolean
Adds all elements to the end of the MutableLongList and returns true if the MutableLongList was changed or false if elements was empty.
addAll
inline fun addAll(elements: LongList): Boolean
Adds all elements to the end of the MutableLongList and returns true if the MutableLongList was changed or false if elements was empty.
addAll
fun addAll(index: @IntRange(from = 0) Int, elements: LongArray): Boolean
Adds all elements to the MutableLongList 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: LongList): Boolean
Adds all elements to the MutableLongList 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 MutableLongList. 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 MutableLongList.
| See also | |
|---|---|
trim |
minusAssign
operator fun minusAssign(elements: LongArray): Unit
Removes all elements from the MutableLongList.
minusAssign
operator fun minusAssign(elements: LongList): Unit
Removes all elements from the MutableLongList.
plusAssign
inline operator fun plusAssign(elements: LongArray): Unit
Adds all elements to the end of the MutableLongList.
plusAssign
inline operator fun plusAssign(elements: LongList): Unit
Adds all elements to the end of the MutableLongList.
remove
fun remove(element: Long): Boolean
Removes element from the MutableLongList. If element was in the MutableLongList and was removed, true will be returned, or false will be returned if the element was not found.
removeAll
fun removeAll(elements: LongArray): Boolean
Removes all elements from the MutableLongList and returns true if anything was removed.
removeAll
fun removeAll(elements: LongList): Boolean
Removes all elements from the MutableLongList and returns true if anything was removed.
removeAt
fun removeAt(index: @IntRange(from = 0) Int): Long
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: LongArray): Boolean
Keeps only elements in the MutableLongList and removes all other values.
| Returns | |
|---|---|
Boolean |
|
retainAll
fun retainAll(elements: LongList): Boolean
Keeps only elements in the MutableLongList and removes all other values.
| Returns | |
|---|---|
Boolean |
|
set
operator fun set(index: @IntRange(from = 0) Int, element: Long): Long
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 MutableLongList must grow.
| See also | |
|---|---|
ensureCapacity |