Package kotlin.collections
Collection types, such as Iterable, Collection, List, Set, Map and related top-level and extension functions.
Types
AbstractCollection
Provides a skeletal implementation of the read-only Collection interface.
abstract class AbstractCollection<out E> : Collection<E>
AbstractIterator
A base class to simplify implementing iterators so that implementations only have to implement computeNext to implement the iterator, calling done when the iteration is complete.
abstract class AbstractIterator<T> : Iterator<T>
AbstractList
Provides a skeletal implementation of the read-only List interface.
abstract class AbstractList<out E> :
AbstractCollection<E>,
List<E>
AbstractMutableCollection
Provides a skeletal implementation of the MutableCollection interface.
abstract class AbstractMutableCollection<E> :
MutableCollection<E>
abstract class AbstractMutableCollection<E> :
MutableCollection<E>,
AbstractCollection<E>
abstract class AbstractMutableCollection<E> :
AbstractCollection<E>,
MutableCollection<E>
abstract class AbstractMutableCollection<E> :
MutableCollection<E>,
AbstractCollection<E>
AbstractMutableList
Provides a skeletal implementation of the MutableList interface.
abstract class AbstractMutableList<E> : MutableList<E>
abstract class AbstractMutableList<E> :
MutableList<E>,
AbstractList<E>
abstract class AbstractMutableList<E> :
AbstractMutableCollection<E>,
MutableList<E>
AbstractMutableMap
Provides a skeletal implementation of the MutableMap interface.
abstract class AbstractMutableMap<K, V> : MutableMap<K, V>
abstract class AbstractMutableMap<K, V> :
MutableMap<K, V>,
AbstractMap<K, V>
abstract class AbstractMutableMap<K, V> :
AbstractMap<K, V>,
MutableMap<K, V>
AbstractMutableSet
Provides a skeletal implementation of the MutableSet interface.
abstract class AbstractMutableSet<E> : MutableSet<E>
abstract class AbstractMutableSet<E> :
MutableSet<E>,
AbstractSet<E>
abstract class AbstractMutableSet<E> :
AbstractMutableCollection<E>,
MutableSet<E>
AbstractSet
Provides a skeletal implementation of the read-only Set interface.
abstract class AbstractSet<out E> :
AbstractCollection<E>,
Set<E>
ArrayDeque
Resizable-array implementation of the deque data structure.
class ArrayDeque<E> : AbstractMutableList<E>
ArrayList
Provides a MutableList implementation, which uses a resizable array as its backing storage.
class ArrayList<E> : MutableList<E>, RandomAccess
typealias ArrayList<E> = ArrayList<E>
open class ArrayList<E> :
AbstractMutableList<E>,
MutableList<E>,
RandomAccess
class ArrayList<E> :
MutableList<E>,
RandomAccess,
AbstractMutableCollection<E>
BooleanIterator
An iterator over a sequence of values of type Boolean
.
abstract class BooleanIterator : Iterator<Boolean>
ByteIterator
An iterator over a sequence of values of type Byte
.
abstract class ByteIterator : Iterator<Byte>
CharIterator
An iterator over a sequence of values of type Char
.
abstract class CharIterator : Iterator<Char>
Collection
A generic collection of elements. Methods in this interface support only read-only access to the collection; read/write access is supported through the MutableCollection interface.
interface Collection<out E> : Iterable<E>
DoubleIterator
An iterator over a sequence of values of type Double
.
abstract class DoubleIterator : Iterator<Double>
FloatIterator
An iterator over a sequence of values of type Float
.
abstract class FloatIterator : Iterator<Float>
Grouping
Represents a source of elements with a keyOf function, which can be applied to each element to get its key.
interface Grouping<T, out K>
HashMap
Hash table based implementation of the MutableMap interface.
class HashMap<K, V> : MutableMap<K, V>
typealias HashMap<K, V> = HashMap<K, V>
open class HashMap<K, V> :
AbstractMutableMap<K, V>,
MutableMap<K, V>
HashSet
The implementation of the MutableSet interface, backed by a HashMap instance.
class HashSet<E> : MutableSet<E>
typealias HashSet<E> = HashSet<E>
open class HashSet<E> : AbstractMutableSet<E>, MutableSet<E>
class HashSet<E> :
MutableSet<E>,
AbstractMutableCollection<E>,
KonanSet<E>
IndexedValue
Data class representing a value from a collection or sequence, along with its index in that collection or sequence.
data class IndexedValue<out T>
IntIterator
An iterator over a sequence of values of type Int
.
abstract class IntIterator : Iterator<Int>
Iterable
Classes that inherit from this interface can be represented as a sequence of elements that can be iterated over.
interface Iterable<out T>
Iterator
An iterator over a collection or another entity that can be represented as a sequence of elements. Allows to sequentially access the elements.
interface Iterator<out T>
LinkedHashMap
Hash table based implementation of the MutableMap interface, which additionally preserves the insertion order of entries during the iteration.
class LinkedHashMap<K, V> : MutableMap<K, V>
typealias LinkedHashMap<K, V> = LinkedHashMap<K, V>
open class LinkedHashMap<K, V> :
HashMap<K, V>,
MutableMap<K, V>
typealias LinkedHashMap<K, V> = HashMap<K, V>
LinkedHashSet
The implementation of the MutableSet interface, backed by a LinkedHashMap instance.
class LinkedHashSet<E> : MutableSet<E>
typealias LinkedHashSet<E> = LinkedHashSet<E>
open class LinkedHashSet<E> : HashSet<E>, MutableSet<E>
typealias LinkedHashSet<V> = HashSet<V>
List
A generic ordered collection of elements. Methods in this interface support only read-only access to the list; read/write access is supported through the MutableList interface.
interface List<out E> : Collection<E>
ListIterator
An iterator over a collection that supports indexed access.
interface ListIterator<out T> : Iterator<T>
LongIterator
An iterator over a sequence of values of type Long
.
abstract class LongIterator : Iterator<Long>
Map
A collection that holds pairs of objects (keys and values) and supports efficiently retrieving the value corresponding to each key. Map keys are unique; the map holds only one value for each key. Methods in this interface support only read-only access to the map; read-write access is supported through the MutableMap interface.
interface Map<K, out V>
MutableCollection
A generic collection of elements that supports adding and removing elements.
interface MutableCollection<E> :
Collection<E>,
MutableIterable<E>
MutableIterable
Classes that inherit from this interface can be represented as a sequence of elements that can be iterated over and that supports removing elements during iteration.
interface MutableIterable<out T> : Iterable<T>
MutableIterator
An iterator over a mutable collection. Provides the ability to remove elements while iterating.
interface MutableIterator<out T> : Iterator<T>
MutableList
A generic ordered collection of elements that supports adding and removing elements.
interface MutableList<E> : List<E>, MutableCollection<E>
MutableListIterator
An iterator over a mutable collection that supports indexed access. Provides the ability to add, modify and remove elements while iterating.
interface MutableListIterator<T> :
ListIterator<T>,
MutableIterator<T>
MutableMap
A modifiable collection that holds pairs of objects (keys and values) and supports efficiently retrieving the value corresponding to each key. Map keys are unique; the map holds only one value for each key.
interface MutableMap<K, V> : Map<K, V>
MutableSet
A generic unordered collection of elements that does not support duplicate elements, and supports adding and removing elements.
interface MutableSet<E> : Set<E>, MutableCollection<E>
RandomAccess
Marker interface indicating that the List implementation supports fast indexed access.
interface RandomAccess
typealias RandomAccess = RandomAccess
Set
A generic unordered collection of elements that does not support duplicate elements. Methods in this interface support only read-only access to the set; read/write access is supported through the MutableSet interface.
interface Set<out E> : Collection<E>
ShortIterator
An iterator over a sequence of values of type Short
.
abstract class ShortIterator : Iterator<Short>
UArraysKt
object UArraysKt
Extensions for External Classes
Properties
indices
Returns the range of valid indices for the array.
val <T> Array<out T>.indices: IntRange
val ShortArray.indices: IntRange
val FloatArray.indices: IntRange
val DoubleArray.indices: IntRange
val BooleanArray.indices: IntRange
val ULongArray.indices: IntRange
val UByteArray.indices: IntRange
val UShortArray.indices: IntRange
Returns an IntRange of the valid indices for this collection.
val Collection<*>.indices: IntRange
lastIndex
Returns the last valid index for the array.
val <T> Array<out T>.lastIndex: Int
val ByteArray.lastIndex: Int
val ShortArray.lastIndex: Int
val IntArray.lastIndex: Int
val LongArray.lastIndex: Int
val FloatArray.lastIndex: Int
val DoubleArray.lastIndex: Int
val BooleanArray.lastIndex: Int
val CharArray.lastIndex: Int
val UIntArray.lastIndex: Int
val ULongArray.lastIndex: Int
val UByteArray.lastIndex: Int
val UShortArray.lastIndex: Int
Returns the index of the last item in the list or -1 if the list is empty.
val <T> List<T>.lastIndex: Int
Functions
addAll
Adds all elements of the given elements collection to this MutableCollection.
fun <T> MutableCollection<in T>.addAll(
elements: Iterable<T>
): Boolean
Adds all elements of the given elements sequence to this MutableCollection.
fun <T> MutableCollection<in T>.addAll(
elements: Sequence<T>
): Boolean
Adds all elements of the given elements array to this MutableCollection.
fun <T> MutableCollection<in T>.addAll(
elements: Array<out T>
): Boolean
aggregate
aggregateTo
Groups elements from the Grouping source by key and applies operation to the elements of each group sequentially, passing the previously accumulated value and the current element as arguments, and stores the results in the given destination map.
fun <T, K, R, M : MutableMap<in K, R>> Grouping<T, K>.aggregateTo(
destination: M,
operation: (key: K, accumulator: R?, element: T, first: Boolean) -> R
): M
all
Returns true
if all elements match the given predicate.
fun <T> Array<out T>.all(predicate: (T) -> Boolean): Boolean
fun ByteArray.all(predicate: (Byte) -> Boolean): Boolean
fun ShortArray.all(predicate: (Short) -> Boolean): Boolean
fun IntArray.all(predicate: (Int) -> Boolean): Boolean
fun LongArray.all(predicate: (Long) -> Boolean): Boolean
fun FloatArray.all(predicate: (Float) -> Boolean): Boolean
fun DoubleArray.all(predicate: (Double) -> Boolean): Boolean
fun BooleanArray.all(
predicate: (Boolean) -> Boolean
): Boolean
fun CharArray.all(predicate: (Char) -> Boolean): Boolean
fun <T> Iterable<T>.all(predicate: (T) -> Boolean): Boolean
fun ULongArray.all(predicate: (ULong) -> Boolean): Boolean
fun UByteArray.all(predicate: (UByte) -> Boolean): Boolean
fun UShortArray.all(predicate: (UShort) -> Boolean): Boolean
any
Returns true
if array has at least one element.
fun <T> Array<out T>.any(): Boolean
fun ByteArray.any(): Boolean
fun ShortArray.any(): Boolean
fun IntArray.any(): Boolean
fun LongArray.any(): Boolean
fun FloatArray.any(): Boolean
fun DoubleArray.any(): Boolean
fun BooleanArray.any(): Boolean
fun CharArray.any(): Boolean
fun UIntArray.any(): Boolean
fun ULongArray.any(): Boolean
fun UByteArray.any(): Boolean
fun UShortArray.any(): Boolean
Returns true
if at least one element matches the given predicate.
fun <T> Array<out T>.any(predicate: (T) -> Boolean): Boolean
fun ByteArray.any(predicate: (Byte) -> Boolean): Boolean
fun ShortArray.any(predicate: (Short) -> Boolean): Boolean
fun IntArray.any(predicate: (Int) -> Boolean): Boolean
fun LongArray.any(predicate: (Long) -> Boolean): Boolean
fun FloatArray.any(predicate: (Float) -> Boolean): Boolean
fun DoubleArray.any(predicate: (Double) -> Boolean): Boolean
fun BooleanArray.any(
predicate: (Boolean) -> Boolean
): Boolean
fun CharArray.any(predicate: (Char) -> Boolean): Boolean
fun <T> Iterable<T>.any(predicate: (T) -> Boolean): Boolean
fun ULongArray.any(predicate: (ULong) -> Boolean): Boolean
fun UByteArray.any(predicate: (UByte) -> Boolean): Boolean
fun UShortArray.any(predicate: (UShort) -> Boolean): Boolean
Returns true
if collection has at least one element.
fun <T> Iterable<T>.any(): Boolean
Returns true
if map has at least one entry.
fun <K, V> Map<out K, V>.any(): Boolean
asByteArray
Returns an array of type ByteArray, which is a view of this array where each element is a signed reinterpretation of the corresponding element of this array.
fun UByteArray.asByteArray(): ByteArray
asIterable
asList
Returns a List that wraps the original array.
fun <T> Array<out T>.asList(): List<T>
fun ShortArray.asList(): List<Short>
fun FloatArray.asList(): List<Float>
fun DoubleArray.asList(): List<Double>
fun BooleanArray.asList(): List<Boolean>
fun ULongArray.asList(): List<ULong>
fun UByteArray.asList(): List<UByte>
fun UShortArray.asList(): List<UShort>
asLongArray
Returns an array of type LongArray, which is a view of this array where each element is a signed reinterpretation of the corresponding element of this array.
fun ULongArray.asLongArray(): LongArray
asReversed
Returns a reversed read-only view of the original List. All changes made in the original list will be reflected in the reversed one.
Returns a reversed mutable view of the original mutable List. All changes made in the original list will be reflected in the reversed one and vice versa.
fun <T> MutableList<T>.asReversed(): MutableList<T>
asSequence
Creates a Sequence instance that wraps the original array returning its elements when being iterated.
fun <T> any_array<T>.asSequence(): Sequence<T>
Creates a Sequence instance that wraps the original collection returning its elements when being iterated.
asShortArray
Returns an array of type ShortArray, which is a view of this array where each element is a signed reinterpretation of the corresponding element of this array.
fun UShortArray.asShortArray(): ShortArray
associate
associateBy
Returns a Map containing the elements from the given array indexed by the key returned from keySelector function applied to each element.
fun <T, K> any_array<T>.associateBy(
keySelector: (T) -> K
): Map<K, T>
Returns a Map containing the values provided by valueTransform and indexed by keySelector functions applied to elements of the given array.
fun <T, K, V> any_array<T>.associateBy(
keySelector: (T) -> K,
valueTransform: (T) -> V
): Map<K, V>
Returns a Map containing the elements from the given collection indexed by the key returned from keySelector function applied to each element.
Returns a Map containing the values provided by valueTransform and indexed by keySelector functions applied to elements of the given collection.
associateByTo
Populates and returns the destination mutable map with key-value pairs, where key is provided by the keySelector function applied to each element of the given array and value is the element itself.
fun <T, K, M : MutableMap<in K, in T>> any_array<T>.associateByTo(
destination: M,
keySelector: (T) -> K
): M
Populates and returns the destination mutable map with key-value pairs, where key is provided by the keySelector function and and value is provided by the valueTransform function applied to elements of the given array.
fun <T, K, V, M : MutableMap<in K, in V>> any_array<T>.associateByTo(
destination: M,
keySelector: (T) -> K,
valueTransform: (T) -> V
): M
Populates and returns the destination mutable map with key-value pairs, where key is provided by the keySelector function applied to each element of the given collection and value is the element itself.
fun <T, K, M : MutableMap<in K, in T>> Iterable<T>.associateByTo(
destination: M,
keySelector: (T) -> K
): M
Populates and returns the destination mutable map with key-value pairs, where key is provided by the keySelector function and and value is provided by the valueTransform function applied to elements of the given collection.
fun <T, K, V, M : MutableMap<in K, in V>> Iterable<T>.associateByTo(
destination: M,
keySelector: (T) -> K,
valueTransform: (T) -> V
): M
associateTo
Populates and returns the destination mutable map with key-value pairs provided by transform function applied to each element of the given array.
fun <T, K, V, M : MutableMap<in K, in V>> any_array<T>.associateTo(
destination: M,
transform: (T) -> Pair<K, V>
): M
Populates and returns the destination mutable map with key-value pairs provided by transform function applied to each element of the given collection.
fun <T, K, V, M : MutableMap<in K, in V>> Iterable<T>.associateTo(
destination: M,
transform: (T) -> Pair<K, V>
): M
associateWith
Returns a Map where keys are elements from the given collection and values are produced by the valueSelector function applied to each element.
associateWithTo
Populates and returns the destination mutable map with key-value pairs for each element of the given collection, where key is the element itself and value is provided by the valueSelector function applied to that key.
fun <K, V, M : MutableMap<in K, in V>> Iterable<K>.associateWithTo(
destination: M,
valueSelector: (K) -> V
): M
asUByteArray
Returns an array of type UByteArray, which is a view of this array where each element is an unsigned reinterpretation of the corresponding element of this array.
fun ByteArray.asUByteArray(): UByteArray
asULongArray
Returns an array of type ULongArray, which is a view of this array where each element is an unsigned reinterpretation of the corresponding element of this array.
fun LongArray.asULongArray(): ULongArray
asUShortArray
Returns an array of type UShortArray, which is a view of this array where each element is an unsigned reinterpretation of the corresponding element of this array.
fun ShortArray.asUShortArray(): UShortArray
average
Returns an average value of elements in the array.
fun Array<out Byte>.average(): Double
fun Array<out Short>.average(): Double
fun Array<out Int>.average(): Double
fun Array<out Long>.average(): Double
fun Array<out Float>.average(): Double
fun Array<out Double>.average(): Double
fun ByteArray.average(): Double
fun ShortArray.average(): Double
fun IntArray.average(): Double
fun LongArray.average(): Double
fun FloatArray.average(): Double
fun DoubleArray.average(): Double
binarySearch
Searches this list or its range for the provided element using the binary search algorithm. The list is expected to be sorted into ascending order according to the Comparable natural ordering of its elements, otherwise the result is undefined.
fun <T : Comparable<T>> List<T?>.binarySearch(
element: T?,
fromIndex: Int = 0,
toIndex: Int = size
): Int
Searches this list or its range for the provided element using the binary search algorithm. The list is expected to be sorted into ascending order according to the specified comparator, otherwise the result is undefined.
fun <T> List<T>.binarySearch(
element: T,
comparator: Comparator<in T>,
fromIndex: Int = 0,
toIndex: Int = size
): Int
Searches this list or its range for an element for which the given comparison function returns zero using the binary search algorithm.
fun <T> List<T>.binarySearch(
fromIndex: Int = 0,
toIndex: Int = size,
comparison: (T) -> Int
): 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 according to the specified comparator, otherwise the result is undefined.
fun <T> Array<out T>.binarySearch(
element: T,
comparator: Comparator<in T>,
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.
fun <T> Array<out T>.binarySearch(
element: T,
fromIndex: Int = 0,
toIndex: Int = size
): Int
fun ByteArray.binarySearch(
element: Byte,
fromIndex: Int = 0,
toIndex: Int = size
): Int
fun ShortArray.binarySearch(
element: Short,
fromIndex: Int = 0,
toIndex: Int = size
): Int
fun IntArray.binarySearch(
element: Int,
fromIndex: Int = 0,
toIndex: Int = size
): Int
fun LongArray.binarySearch(
element: Long,
fromIndex: Int = 0,
toIndex: Int = size
): Int
fun FloatArray.binarySearch(
element: Float,
fromIndex: Int = 0,
toIndex: Int = size
): Int
fun DoubleArray.binarySearch(
element: Double,
fromIndex: Int = 0,
toIndex: Int = size
): Int
fun CharArray.binarySearch(
element: Char,
fromIndex: Int = 0,
toIndex: Int = size
): Int
fun ULongArray.binarySearch(
element: ULong,
fromIndex: Int = 0,
toIndex: Int = size
): Int
fun UByteArray.binarySearch(
element: UByte,
fromIndex: Int = 0,
toIndex: Int = size
): Int
fun UShortArray.binarySearch(
element: UShort,
fromIndex: Int = 0,
toIndex: Int = size
): Int
binarySearchBy
Searches this list or its range for an element having the key returned by the specified selector function equal to the provided key value using the binary search algorithm. The list is expected to be sorted into ascending order according to the Comparable natural ordering of keys of its elements. otherwise the result is undefined.
fun <T, K : Comparable<K>> List<T>.binarySearchBy(
key: K?,
fromIndex: Int = 0,
toIndex: Int = size,
selector: (T) -> K?
): Int
buildList
Builds a new read-only List by populating a MutableList using the given builderAction and returning a read-only list with the same elements.
fun <E> buildList(
builderAction: MutableList<E>.() -> Unit
): List<E>
fun <E> buildList(
capacity: Int,
builderAction: MutableList<E>.() -> Unit
): List<E>
buildMap
Builds a new read-only Map by populating a MutableMap using the given builderAction and returning a read-only map with the same key-value pairs.
fun <K, V> buildMap(
builderAction: MutableMap<K, V>.() -> Unit
): Map<K, V>
fun <K, V> buildMap(
capacity: Int,
builderAction: MutableMap<K, V>.() -> Unit
): Map<K, V>
buildSet
Builds a new read-only Set by populating a MutableSet using the given builderAction and returning a read-only set with the same elements.
fun <E> buildSet(
builderAction: MutableSet<E>.() -> Unit
): Set<E>
fun <E> buildSet(
capacity: Int,
builderAction: MutableSet<E>.() -> Unit
): Set<E>
component1
Returns 1st element from the array.
operator fun <T> Array<out T>.component1(): T
operator fun ByteArray.component1(): Byte
operator fun ShortArray.component1(): Short
operator fun IntArray.component1(): Int
operator fun LongArray.component1(): Long
operator fun FloatArray.component1(): Float
operator fun DoubleArray.component1(): Double
operator fun BooleanArray.component1(): Boolean
operator fun CharArray.component1(): Char
operator fun ULongArray.component1(): ULong
operator fun UByteArray.component1(): UByte
operator fun UShortArray.component1(): UShort
Returns 1st element from the list.
operator fun <T> List<T>.component1(): T
Returns the key component of the map entry.
operator fun <K, V> Entry<K, V>.component1(): K
component2
Returns 2nd element from the array.
operator fun <T> Array<out T>.component2(): T
operator fun ByteArray.component2(): Byte
operator fun ShortArray.component2(): Short
operator fun IntArray.component2(): Int
operator fun LongArray.component2(): Long
operator fun FloatArray.component2(): Float
operator fun DoubleArray.component2(): Double
operator fun BooleanArray.component2(): Boolean
operator fun CharArray.component2(): Char
operator fun ULongArray.component2(): ULong
operator fun UByteArray.component2(): UByte
operator fun UShortArray.component2(): UShort
Returns 2nd element from the list.
operator fun <T> List<T>.component2(): T
Returns the value component of the map entry.
operator fun <K, V> Entry<K, V>.component2(): V
component3
Returns 3rd element from the array.
operator fun <T> Array<out T>.component3(): T
operator fun ByteArray.component3(): Byte
operator fun ShortArray.component3(): Short
operator fun IntArray.component3(): Int
operator fun LongArray.component3(): Long
operator fun FloatArray.component3(): Float
operator fun DoubleArray.component3(): Double
operator fun BooleanArray.component3(): Boolean
operator fun CharArray.component3(): Char
operator fun ULongArray.component3(): ULong
operator fun UByteArray.component3(): UByte
operator fun UShortArray.component3(): UShort
Returns 3rd element from the list.
operator fun <T> List<T>.component3(): T
component4
Returns 4th element from the array.
operator fun <T> Array<out T>.component4(): T
operator fun ByteArray.component4(): Byte
operator fun ShortArray.component4(): Short
operator fun IntArray.component4(): Int
operator fun LongArray.component4(): Long
operator fun FloatArray.component4(): Float
operator fun DoubleArray.component4(): Double
operator fun BooleanArray.component4(): Boolean
operator fun CharArray.component4(): Char
operator fun ULongArray.component4(): ULong
operator fun UByteArray.component4(): UByte
operator fun UShortArray.component4(): UShort
Returns 4th element from the list.
operator fun <T> List<T>.component4(): T
component5
Returns 5th element from the array.
operator fun <T> Array<out T>.component5(): T
operator fun ByteArray.component5(): Byte
operator fun ShortArray.component5(): Short
operator fun IntArray.component5(): Int
operator fun LongArray.component5(): Long
operator fun FloatArray.component5(): Float
operator fun DoubleArray.component5(): Double
operator fun BooleanArray.component5(): Boolean
operator fun CharArray.component5(): Char
operator fun ULongArray.component5(): ULong
operator fun UByteArray.component5(): UByte
operator fun UShortArray.component5(): UShort
Returns 5th element from the list.
operator fun <T> List<T>.component5(): T
contains
Returns true
if element is found in the array.
operator fun <T> any_array<T>.contains(element: T): Boolean
Returns true
if element is found in the collection.
operator fun <T> Iterable<T>.contains(element: T): Boolean
Checks if the map contains the given key.
operator fun <K, V> Map<out K, V>.contains(key: K): Boolean
containsAll
Checks if all elements in the specified collection are contained in this collection.
fun <T> Collection<T>.containsAll(
elements: Collection<T>
): Boolean
contentDeepEquals
Returns true
if the two specified arrays are deeply equal to one another,
i.e. contain the same number of the same elements in the same order.
infix fun <T> any_array<T>.contentDeepEquals(
other: Array<out T>
): Boolean
contentDeepHashCode
Returns a hash code based on the contents of this array as if it is List. Nested arrays are treated as lists too.
fun <T> any_array<T>.contentDeepHashCode(): Int
contentDeepToString
Returns a string representation of the contents of this array as if it is a List. Nested arrays are treated as lists too.
fun <T> any_array<T>.contentDeepToString(): String
contentEquals
Returns true
if the two specified arrays are structurally equal to one another,
i.e. contain the same number of the same elements in the same order.
infix fun ULongArray.contentEquals(
other: ULongArray
): Boolean
infix fun UByteArray.contentEquals(
other: UByteArray
): Boolean
infix fun UShortArray.contentEquals(
other: UShortArray
): Boolean
infix fun <T> Array<out T>.contentEquals(
other: Array<out T>
): Boolean
infix fun ShortArray.contentEquals(
other: ShortArray
): Boolean
infix fun FloatArray.contentEquals(
other: FloatArray
): Boolean
infix fun DoubleArray.contentEquals(
other: DoubleArray
): Boolean
infix fun BooleanArray.contentEquals(
other: BooleanArray
): Boolean
contentHashCode
Returns a hash code based on the contents of this array as if it is List.
fun UIntArray.contentHashCode(): Int
fun ULongArray.contentHashCode(): Int
fun UByteArray.contentHashCode(): Int
fun UShortArray.contentHashCode(): Int
fun <T> Array<out T>.contentHashCode(): Int
fun ByteArray.contentHashCode(): Int
fun ShortArray.contentHashCode(): Int
fun IntArray.contentHashCode(): Int
fun LongArray.contentHashCode(): Int
fun FloatArray.contentHashCode(): Int
fun DoubleArray.contentHashCode(): Int
fun BooleanArray.contentHashCode(): Int
fun CharArray.contentHashCode(): Int
contentToString
Returns a string representation of the contents of the specified array as if it is List.
fun UIntArray.contentToString(): String
fun ULongArray.contentToString(): String
fun UByteArray.contentToString(): String
fun UShortArray.contentToString(): String
fun <T> Array<out T>.contentToString(): String
fun ByteArray.contentToString(): String
fun ShortArray.contentToString(): String
fun IntArray.contentToString(): String
fun LongArray.contentToString(): String
fun FloatArray.contentToString(): String
fun DoubleArray.contentToString(): String
fun BooleanArray.contentToString(): String
fun CharArray.contentToString(): String
copyInto
Copies this array or its subrange into the destination array and returns that array.
fun ULongArray.copyInto(
destination: ULongArray,
destinationOffset: Int = 0,
startIndex: Int = 0,
endIndex: Int = size
): ULongArray
fun UByteArray.copyInto(
destination: UByteArray,
destinationOffset: Int = 0,
startIndex: Int = 0,
endIndex: Int = size
): UByteArray
fun UShortArray.copyInto(
destination: UShortArray,
destinationOffset: Int = 0,
startIndex: Int = 0,
endIndex: Int = size
): UShortArray
fun <T> Array<out T>.copyInto(
destination: Array<T>,
destinationOffset: Int = 0,
startIndex: Int = 0,
endIndex: Int = size
): Array<T>
fun ShortArray.copyInto(
destination: ShortArray,
destinationOffset: Int = 0,
startIndex: Int = 0,
endIndex: Int = size
): ShortArray
fun FloatArray.copyInto(
destination: FloatArray,
destinationOffset: Int = 0,
startIndex: Int = 0,
endIndex: Int = size
): FloatArray
fun DoubleArray.copyInto(
destination: DoubleArray,
destinationOffset: Int = 0,
startIndex: Int = 0,
endIndex: Int = size
): DoubleArray
fun BooleanArray.copyInto(
destination: BooleanArray,
destinationOffset: Int = 0,
startIndex: Int = 0,
endIndex: Int = size
): BooleanArray
copyOf
Returns new array which is a copy of the original array.
fun ULongArray.copyOf(): ULongArray
fun UByteArray.copyOf(): UByteArray
fun UShortArray.copyOf(): UShortArray
fun <T> Array<T>.copyOf(): Array<T>
fun <T> Array<out T>.copyOf(): Array<T>
fun ShortArray.copyOf(): ShortArray
fun FloatArray.copyOf(): FloatArray
fun DoubleArray.copyOf(): DoubleArray
fun BooleanArray.copyOf(): BooleanArray
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.
fun ULongArray.copyOf(newSize: Int): ULongArray
fun UByteArray.copyOf(newSize: Int): UByteArray
fun UShortArray.copyOf(newSize: Int): UShortArray
fun ShortArray.copyOf(newSize: Int): ShortArray
fun FloatArray.copyOf(newSize: Int): FloatArray
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 false
values if necessary.
fun BooleanArray.copyOf(newSize: Int): BooleanArray
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 null char (\u0000
) values if necessary.
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 null
values if necessary.
fun <T> any_array<T>.copyOf(newSize: Int): Array<T?>
copyOfRange
Returns a new array which is a copy of the specified range of the original array.
fun ULongArray.copyOfRange(
fromIndex: Int,
toIndex: Int
): ULongArray
fun UByteArray.copyOfRange(
fromIndex: Int,
toIndex: Int
): UByteArray
fun UShortArray.copyOfRange(
fromIndex: Int,
toIndex: Int
): UShortArray
fun <T> Array<T>.copyOfRange(
fromIndex: Int,
toIndex: Int
): Array<T>
fun <T> Array<out T>.copyOfRange(
fromIndex: Int,
toIndex: Int
): Array<T>
fun ShortArray.copyOfRange(
fromIndex: Int,
toIndex: Int
): ShortArray
fun FloatArray.copyOfRange(
fromIndex: Int,
toIndex: Int
): FloatArray
fun DoubleArray.copyOfRange(
fromIndex: Int,
toIndex: Int
): DoubleArray
fun BooleanArray.copyOfRange(
fromIndex: Int,
toIndex: Int
): BooleanArray
count
Returns the number of elements in this array.
fun <T> any_array<T>.count(): Int
Returns the number of elements matching the given predicate.
fun <T> Array<out T>.count(predicate: (T) -> Boolean): Int
fun ByteArray.count(predicate: (Byte) -> Boolean): Int
fun ShortArray.count(predicate: (Short) -> Boolean): Int
fun IntArray.count(predicate: (Int) -> Boolean): Int
fun LongArray.count(predicate: (Long) -> Boolean): Int
fun FloatArray.count(predicate: (Float) -> Boolean): Int
fun DoubleArray.count(predicate: (Double) -> Boolean): Int
fun BooleanArray.count(predicate: (Boolean) -> Boolean): Int
fun CharArray.count(predicate: (Char) -> Boolean): Int
fun <T> Iterable<T>.count(predicate: (T) -> Boolean): Int
fun ULongArray.count(predicate: (ULong) -> Boolean): Int
fun UByteArray.count(predicate: (UByte) -> Boolean): Int
fun UShortArray.count(predicate: (UShort) -> Boolean): Int
Returns the number of elements in this collection.
fun <T> Iterable<T>.count(): Int
fun <T> Collection<T>.count(): Int
Returns the number of entries in this map.
fun <K, V> Map<out K, V>.count(): Int
distinct
Returns a list containing only distinct elements from the given array.
fun <T> any_array<T>.distinct(): List<T>
distinctBy
drop
Returns a list containing all elements except first n elements.
fun <T> Array<out T>.drop(n: Int): List<T>
fun ShortArray.drop(n: Int): List<Short>
fun FloatArray.drop(n: Int): List<Float>
fun DoubleArray.drop(n: Int): List<Double>
fun BooleanArray.drop(n: Int): List<Boolean>
fun ULongArray.drop(n: Int): List<ULong>
fun UByteArray.drop(n: Int): List<UByte>
fun UShortArray.drop(n: Int): List<UShort>
dropLast
Returns a list containing all elements except last n elements.
fun <T> Array<out T>.dropLast(n: Int): List<T>
fun ShortArray.dropLast(n: Int): List<Short>
fun FloatArray.dropLast(n: Int): List<Float>
fun DoubleArray.dropLast(n: Int): List<Double>
fun BooleanArray.dropLast(n: Int): List<Boolean>
fun ULongArray.dropLast(n: Int): List<ULong>
fun UByteArray.dropLast(n: Int): List<UByte>
fun UShortArray.dropLast(n: Int): List<UShort>
dropLastWhile
Returns a list containing all elements except last elements that satisfy the given predicate.
fun <T> Array<out T>.dropLastWhile(
predicate: (T) -> Boolean
): List<T>
fun ShortArray.dropLastWhile(
predicate: (Short) -> Boolean
): List<Short>
fun FloatArray.dropLastWhile(
predicate: (Float) -> Boolean
): List<Float>
fun DoubleArray.dropLastWhile(
predicate: (Double) -> Boolean
): List<Double>
fun BooleanArray.dropLastWhile(
predicate: (Boolean) -> Boolean
): List<Boolean>
fun ULongArray.dropLastWhile(
predicate: (ULong) -> Boolean
): List<ULong>
fun UByteArray.dropLastWhile(
predicate: (UByte) -> Boolean
): List<UByte>
fun UShortArray.dropLastWhile(
predicate: (UShort) -> Boolean
): List<UShort>
dropWhile
Returns a list containing all elements except first elements that satisfy the given predicate.
fun <T> Array<out T>.dropWhile(
predicate: (T) -> Boolean
): List<T>
fun ShortArray.dropWhile(
predicate: (Short) -> Boolean
): List<Short>
fun FloatArray.dropWhile(
predicate: (Float) -> Boolean
): List<Float>
fun DoubleArray.dropWhile(
predicate: (Double) -> Boolean
): List<Double>
fun BooleanArray.dropWhile(
predicate: (Boolean) -> Boolean
): List<Boolean>
fun ULongArray.dropWhile(
predicate: (ULong) -> Boolean
): List<ULong>
fun UByteArray.dropWhile(
predicate: (UByte) -> Boolean
): List<UByte>
fun UShortArray.dropWhile(
predicate: (UShort) -> Boolean
): List<UShort>
eachCountTo
Groups elements from the Grouping source by key and counts elements in each group to the given destination map.
fun <T, K, M : MutableMap<in K, Int>> Grouping<T, K>.eachCountTo(
destination: M
): M
elementAt
Returns an element at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this collection.
fun <T> Iterable<T>.elementAt(index: Int): T
Returns an element at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this list.
fun <T> List<T>.elementAt(index: Int): T
Returns an element at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this array.
fun <T> Array<out T>.elementAt(index: Int): T
fun ByteArray.elementAt(index: Int): Byte
fun ShortArray.elementAt(index: Int): Short
fun IntArray.elementAt(index: Int): Int
fun LongArray.elementAt(index: Int): Long
fun FloatArray.elementAt(index: Int): Float
fun DoubleArray.elementAt(index: Int): Double
fun BooleanArray.elementAt(index: Int): Boolean
fun CharArray.elementAt(index: Int): Char
fun ULongArray.elementAt(index: Int): ULong
fun UByteArray.elementAt(index: Int): UByte
fun UShortArray.elementAt(index: Int): UShort
elementAtOrElse
Returns an element at the given index or the result of calling the defaultValue function if the index is out of bounds of this array.
fun <T> Array<out T>.elementAtOrElse(
index: Int,
defaultValue: (Int) -> T
): T
fun ByteArray.elementAtOrElse(
index: Int,
defaultValue: (Int) -> Byte
): Byte
fun ShortArray.elementAtOrElse(
index: Int,
defaultValue: (Int) -> Short
): Short
fun IntArray.elementAtOrElse(
index: Int,
defaultValue: (Int) -> Int
): Int
fun LongArray.elementAtOrElse(
index: Int,
defaultValue: (Int) -> Long
): Long
fun FloatArray.elementAtOrElse(
index: Int,
defaultValue: (Int) -> Float
): Float
fun DoubleArray.elementAtOrElse(
index: Int,
defaultValue: (Int) -> Double
): Double
fun BooleanArray.elementAtOrElse(
index: Int,
defaultValue: (Int) -> Boolean
): Boolean
fun CharArray.elementAtOrElse(
index: Int,
defaultValue: (Int) -> Char
): Char
fun ULongArray.elementAtOrElse(
index: Int,
defaultValue: (Int) -> ULong
): ULong
fun UByteArray.elementAtOrElse(
index: Int,
defaultValue: (Int) -> UByte
): UByte
fun UShortArray.elementAtOrElse(
index: Int,
defaultValue: (Int) -> UShort
): UShort
Returns an element at the given index or the result of calling the defaultValue function if the index is out of bounds of this collection.
fun <T> Iterable<T>.elementAtOrElse(
index: Int,
defaultValue: (Int) -> T
): T
Returns an element at the given index or the result of calling the defaultValue function if the index is out of bounds of this list.
fun <T> List<T>.elementAtOrElse(
index: Int,
defaultValue: (Int) -> T
): T
elementAtOrNull
Returns an element at the given index or null
if the index is out of bounds of this array.
fun <T> Array<out T>.elementAtOrNull(index: Int): T?
fun ByteArray.elementAtOrNull(index: Int): Byte?
fun ShortArray.elementAtOrNull(index: Int): Short?
fun IntArray.elementAtOrNull(index: Int): Int?
fun LongArray.elementAtOrNull(index: Int): Long?
fun FloatArray.elementAtOrNull(index: Int): Float?
fun DoubleArray.elementAtOrNull(index: Int): Double?
fun BooleanArray.elementAtOrNull(index: Int): Boolean?
fun CharArray.elementAtOrNull(index: Int): Char?
fun ULongArray.elementAtOrNull(index: Int): ULong?
fun UByteArray.elementAtOrNull(index: Int): UByte?
fun UShortArray.elementAtOrNull(index: Int): UShort?
emptyList
Returns an empty read-only list. The returned list is serializable (JVM).
fun <T> emptyList(): List<T>
emptySet
Returns an empty read-only set. The returned set is serializable (JVM).
fun <T> emptySet(): Set<T>
fill
Fills this array or its subrange with the specified element value.
fun ULongArray.fill(
element: ULong,
fromIndex: Int = 0,
toIndex: Int = size)
fun UByteArray.fill(
element: UByte,
fromIndex: Int = 0,
toIndex: Int = size)
fun UShortArray.fill(
element: UShort,
fromIndex: Int = 0,
toIndex: Int = size)
fun <T> Array<T>.fill(
element: T,
fromIndex: Int = 0,
toIndex: Int = size)
fun ByteArray.fill(
element: Byte,
fromIndex: Int = 0,
toIndex: Int = size)
fun ShortArray.fill(
element: Short,
fromIndex: Int = 0,
toIndex: Int = size)
fun IntArray.fill(
element: Int,
fromIndex: Int = 0,
toIndex: Int = size)
fun LongArray.fill(
element: Long,
fromIndex: Int = 0,
toIndex: Int = size)
fun FloatArray.fill(
element: Float,
fromIndex: Int = 0,
toIndex: Int = size)
fun DoubleArray.fill(
element: Double,
fromIndex: Int = 0,
toIndex: Int = size)
fun BooleanArray.fill(
element: Boolean,
fromIndex: Int = 0,
toIndex: Int = size)
fun CharArray.fill(
element: Char,
fromIndex: Int = 0,
toIndex: Int = size)
Fills the list with the provided value.
fun <T> MutableList<T>.fill(value: T)
filter
Returns a list containing only elements matching the given predicate.
fun <T> Array<out T>.filter(
predicate: (T) -> Boolean
): List<T>
fun ShortArray.filter(
predicate: (Short) -> Boolean
): List<Short>
fun FloatArray.filter(
predicate: (Float) -> Boolean
): List<Float>
fun DoubleArray.filter(
predicate: (Double) -> Boolean
): List<Double>
fun BooleanArray.filter(
predicate: (Boolean) -> Boolean
): List<Boolean>
fun ULongArray.filter(
predicate: (ULong) -> Boolean
): List<ULong>
fun UByteArray.filter(
predicate: (UByte) -> Boolean
): List<UByte>
fun UShortArray.filter(
predicate: (UShort) -> Boolean
): List<UShort>
filterIndexed
Returns a list containing only elements matching the given predicate.
fun <T> Array<out T>.filterIndexed(
predicate: (index: Int, T) -> Boolean
): List<T>
fun ShortArray.filterIndexed(
predicate: (index: Int, Short) -> Boolean
): List<Short>
fun FloatArray.filterIndexed(
predicate: (index: Int, Float) -> Boolean
): List<Float>
fun DoubleArray.filterIndexed(
predicate: (index: Int, Double) -> Boolean
): List<Double>
fun BooleanArray.filterIndexed(
predicate: (index: Int, Boolean) -> Boolean
): List<Boolean>
fun ULongArray.filterIndexed(
predicate: (index: Int, ULong) -> Boolean
): List<ULong>
fun UByteArray.filterIndexed(
predicate: (index: Int, UByte) -> Boolean
): List<UByte>
fun UShortArray.filterIndexed(
predicate: (index: Int, UShort) -> Boolean
): List<UShort>
filterIndexedTo
Appends all elements matching the given predicate to the given destination.
fun <T, C : MutableCollection<in T>> Array<out T>.filterIndexedTo(
destination: C,
predicate: (index: Int, T) -> Boolean
): C
fun <C : MutableCollection<in Byte>> ByteArray.filterIndexedTo(
destination: C,
predicate: (index: Int, Byte) -> Boolean
): C
fun <C : MutableCollection<in Short>> ShortArray.filterIndexedTo(
destination: C,
predicate: (index: Int, Short) -> Boolean
): C
fun <C : MutableCollection<in Int>> IntArray.filterIndexedTo(
destination: C,
predicate: (index: Int, Int) -> Boolean
): C
fun <C : MutableCollection<in Long>> LongArray.filterIndexedTo(
destination: C,
predicate: (index: Int, Long) -> Boolean
): C
fun <C : MutableCollection<in Float>> FloatArray.filterIndexedTo(
destination: C,
predicate: (index: Int, Float) -> Boolean
): C
fun <C : MutableCollection<in Double>> DoubleArray.filterIndexedTo(
destination: C,
predicate: (index: Int, Double) -> Boolean
): C
fun <C : MutableCollection<in Boolean>> BooleanArray.filterIndexedTo(
destination: C,
predicate: (index: Int, Boolean) -> Boolean
): C
fun <C : MutableCollection<in Char>> CharArray.filterIndexedTo(
destination: C,
predicate: (index: Int, Char) -> Boolean
): C
fun <T, C : MutableCollection<in T>> Iterable<T>.filterIndexedTo(
destination: C,
predicate: (index: Int, T) -> Boolean
): C
fun <C : MutableCollection<in UInt>> UIntArray.filterIndexedTo(
destination: C,
predicate: (index: Int, UInt) -> Boolean
): C
fun <C : MutableCollection<in ULong>> ULongArray.filterIndexedTo(
destination: C,
predicate: (index: Int, ULong) -> Boolean
): C
fun <C : MutableCollection<in UByte>> UByteArray.filterIndexedTo(
destination: C,
predicate: (index: Int, UByte) -> Boolean
): C
fun <C : MutableCollection<in UShort>> UShortArray.filterIndexedTo(
destination: C,
predicate: (index: Int, UShort) -> Boolean
): C
filterIsInstance
Returns a list containing all elements that are instances of specified type parameter R.
fun <R> Array<*>.filterIsInstance(): List<R>
filterIsInstanceTo
Appends all elements that are instances of specified type parameter R to the given destination.
fun <R, C : MutableCollection<in R>> Array<*>.filterIsInstanceTo(
destination: C
): C
fun <R, C : MutableCollection<in R>> Iterable<*>.filterIsInstanceTo(
destination: C
): C
Appends all elements that are instances of specified class to the given destination.
fun <C : MutableCollection<in R>, R> Array<*>.filterIsInstanceTo(
destination: C,
klass: Class<R>
): C
fun <C : MutableCollection<in R>, R> Iterable<*>.filterIsInstanceTo(
destination: C,
klass: Class<R>
): C
filterNot
Returns a list containing all elements not matching the given predicate.
fun <T> Array<out T>.filterNot(
predicate: (T) -> Boolean
): List<T>
fun ShortArray.filterNot(
predicate: (Short) -> Boolean
): List<Short>
fun FloatArray.filterNot(
predicate: (Float) -> Boolean
): List<Float>
fun DoubleArray.filterNot(
predicate: (Double) -> Boolean
): List<Double>
fun BooleanArray.filterNot(
predicate: (Boolean) -> Boolean
): List<Boolean>
fun ULongArray.filterNot(
predicate: (ULong) -> Boolean
): List<ULong>
fun UByteArray.filterNot(
predicate: (UByte) -> Boolean
): List<UByte>
fun UShortArray.filterNot(
predicate: (UShort) -> Boolean
): List<UShort>
filterNotNullTo
Appends all elements that are not null
to the given destination.
fun <C : MutableCollection<in T>, T : Any> Array<out T?>.filterNotNullTo(
destination: C
): C
fun <C : MutableCollection<in T>, T : Any> Iterable<T?>.filterNotNullTo(
destination: C
): C
filterNotTo
Appends all elements not matching the given predicate to the given destination.
fun <T, C : MutableCollection<in T>> Array<out T>.filterNotTo(
destination: C,
predicate: (T) -> Boolean
): C
fun <C : MutableCollection<in Byte>> ByteArray.filterNotTo(
destination: C,
predicate: (Byte) -> Boolean
): C
fun <C : MutableCollection<in Short>> ShortArray.filterNotTo(
destination: C,
predicate: (Short) -> Boolean
): C
fun <C : MutableCollection<in Int>> IntArray.filterNotTo(
destination: C,
predicate: (Int) -> Boolean
): C
fun <C : MutableCollection<in Long>> LongArray.filterNotTo(
destination: C,
predicate: (Long) -> Boolean
): C
fun <C : MutableCollection<in Float>> FloatArray.filterNotTo(
destination: C,
predicate: (Float) -> Boolean
): C
fun <C : MutableCollection<in Double>> DoubleArray.filterNotTo(
destination: C,
predicate: (Double) -> Boolean
): C
fun <C : MutableCollection<in Boolean>> BooleanArray.filterNotTo(
destination: C,
predicate: (Boolean) -> Boolean
): C
fun <C : MutableCollection<in Char>> CharArray.filterNotTo(
destination: C,
predicate: (Char) -> Boolean
): C
fun <T, C : MutableCollection<in T>> Iterable<T>.filterNotTo(
destination: C,
predicate: (T) -> Boolean
): C
fun <C : MutableCollection<in UInt>> UIntArray.filterNotTo(
destination: C,
predicate: (UInt) -> Boolean
): C
fun <C : MutableCollection<in ULong>> ULongArray.filterNotTo(
destination: C,
predicate: (ULong) -> Boolean
): C
fun <C : MutableCollection<in UByte>> UByteArray.filterNotTo(
destination: C,
predicate: (UByte) -> Boolean
): C
fun <C : MutableCollection<in UShort>> UShortArray.filterNotTo(
destination: C,
predicate: (UShort) -> Boolean
): C
Appends all entries not matching the given predicate into the given destination.
fun <K, V, M : MutableMap<in K, in V>> Map<out K, V>.filterNotTo(
destination: M,
predicate: (Entry<K, V>) -> Boolean
): M
filterTo
Appends all elements matching the given predicate to the given destination.
fun <T, C : MutableCollection<in T>> Array<out T>.filterTo(
destination: C,
predicate: (T) -> Boolean
): C
fun <C : MutableCollection<in Byte>> ByteArray.filterTo(
destination: C,
predicate: (Byte) -> Boolean
): C
fun <C : MutableCollection<in Short>> ShortArray.filterTo(
destination: C,
predicate: (Short) -> Boolean
): C
fun <C : MutableCollection<in Int>> IntArray.filterTo(
destination: C,
predicate: (Int) -> Boolean
): C
fun <C : MutableCollection<in Long>> LongArray.filterTo(
destination: C,
predicate: (Long) -> Boolean
): C
fun <C : MutableCollection<in Float>> FloatArray.filterTo(
destination: C,
predicate: (Float) -> Boolean
): C
fun <C : MutableCollection<in Double>> DoubleArray.filterTo(
destination: C,
predicate: (Double) -> Boolean
): C
fun <C : MutableCollection<in Boolean>> BooleanArray.filterTo(
destination: C,
predicate: (Boolean) -> Boolean
): C
fun <C : MutableCollection<in Char>> CharArray.filterTo(
destination: C,
predicate: (Char) -> Boolean
): C
fun <T, C : MutableCollection<in T>> Iterable<T>.filterTo(
destination: C,
predicate: (T) -> Boolean
): C
fun <C : MutableCollection<in UInt>> UIntArray.filterTo(
destination: C,
predicate: (UInt) -> Boolean
): C
fun <C : MutableCollection<in ULong>> ULongArray.filterTo(
destination: C,
predicate: (ULong) -> Boolean
): C
fun <C : MutableCollection<in UByte>> UByteArray.filterTo(
destination: C,
predicate: (UByte) -> Boolean
): C
fun <C : MutableCollection<in UShort>> UShortArray.filterTo(
destination: C,
predicate: (UShort) -> Boolean
): C
Appends all entries matching the given predicate into the mutable map given as destination parameter.
fun <K, V, M : MutableMap<in K, in V>> Map<out K, V>.filterTo(
destination: M,
predicate: (Entry<K, V>) -> Boolean
): M
find
Returns the first element matching the given predicate, or null
if no such element was found.
fun <T> Array<out T>.find(predicate: (T) -> Boolean): T?
fun ByteArray.find(predicate: (Byte) -> Boolean): Byte?
fun ShortArray.find(predicate: (Short) -> Boolean): Short?
fun IntArray.find(predicate: (Int) -> Boolean): Int?
fun LongArray.find(predicate: (Long) -> Boolean): Long?
fun FloatArray.find(predicate: (Float) -> Boolean): Float?
fun DoubleArray.find(predicate: (Double) -> Boolean): Double?
fun BooleanArray.find(
predicate: (Boolean) -> Boolean
): Boolean?
fun CharArray.find(predicate: (Char) -> Boolean): Char?
fun <T> Iterable<T>.find(predicate: (T) -> Boolean): T?
fun ULongArray.find(predicate: (ULong) -> Boolean): ULong?
fun UByteArray.find(predicate: (UByte) -> Boolean): UByte?
fun UShortArray.find(predicate: (UShort) -> Boolean): UShort?
findLast
Returns the last element matching the given predicate, or null
if no such element was found.
fun <T> Array<out T>.findLast(predicate: (T) -> Boolean): T?
fun ByteArray.findLast(predicate: (Byte) -> Boolean): Byte?
fun ShortArray.findLast(
predicate: (Short) -> Boolean
): Short?
fun IntArray.findLast(predicate: (Int) -> Boolean): Int?
fun LongArray.findLast(predicate: (Long) -> Boolean): Long?
fun FloatArray.findLast(
predicate: (Float) -> Boolean
): Float?
fun DoubleArray.findLast(
predicate: (Double) -> Boolean
): Double?
fun BooleanArray.findLast(
predicate: (Boolean) -> Boolean
): Boolean?
fun CharArray.findLast(predicate: (Char) -> Boolean): Char?
fun <T> Iterable<T>.findLast(predicate: (T) -> Boolean): T?
fun <T> List<T>.findLast(predicate: (T) -> Boolean): T?
fun ULongArray.findLast(
predicate: (ULong) -> Boolean
): ULong?
fun UByteArray.findLast(
predicate: (UByte) -> Boolean
): UByte?
fun UShortArray.findLast(
predicate: (UShort) -> Boolean
): UShort?
first
Returns first element.
fun <T> Array<out T>.first(): T
fun ByteArray.first(): Byte
fun ShortArray.first(): Short
fun IntArray.first(): Int
fun LongArray.first(): Long
fun FloatArray.first(): Float
fun DoubleArray.first(): Double
fun BooleanArray.first(): Boolean
fun CharArray.first(): Char
fun <T> Iterable<T>.first(): T
fun <T> List<T>.first(): T
fun ULongArray.first(): ULong
fun UByteArray.first(): UByte
fun UShortArray.first(): UShort
Returns the first element matching the given predicate.
fun <T> Array<out T>.first(predicate: (T) -> Boolean): T
fun ByteArray.first(predicate: (Byte) -> Boolean): Byte
fun ShortArray.first(predicate: (Short) -> Boolean): Short
fun IntArray.first(predicate: (Int) -> Boolean): Int
fun LongArray.first(predicate: (Long) -> Boolean): Long
fun FloatArray.first(predicate: (Float) -> Boolean): Float
fun DoubleArray.first(predicate: (Double) -> Boolean): Double
fun BooleanArray.first(
predicate: (Boolean) -> Boolean
): Boolean
fun CharArray.first(predicate: (Char) -> Boolean): Char
fun <T> Iterable<T>.first(predicate: (T) -> Boolean): T
fun ULongArray.first(predicate: (ULong) -> Boolean): ULong
fun UByteArray.first(predicate: (UByte) -> Boolean): UByte
fun UShortArray.first(predicate: (UShort) -> Boolean): UShort
firstOrNull
Returns the first element, or null
if the array is empty.
fun <T> Array<out T>.firstOrNull(): T?
fun ByteArray.firstOrNull(): Byte?
fun ShortArray.firstOrNull(): Short?
fun IntArray.firstOrNull(): Int?
fun LongArray.firstOrNull(): Long?
fun FloatArray.firstOrNull(): Float?
fun DoubleArray.firstOrNull(): Double?
fun BooleanArray.firstOrNull(): Boolean?
fun CharArray.firstOrNull(): Char?
fun ULongArray.firstOrNull(): ULong?
fun UByteArray.firstOrNull(): UByte?
fun UShortArray.firstOrNull(): UShort?
Returns the first element matching the given predicate, or null
if element was not found.
fun <T> Array<out T>.firstOrNull(
predicate: (T) -> Boolean
): T?
fun ByteArray.firstOrNull(
predicate: (Byte) -> Boolean
): Byte?
fun ShortArray.firstOrNull(
predicate: (Short) -> Boolean
): Short?
fun IntArray.firstOrNull(predicate: (Int) -> Boolean): Int?
fun LongArray.firstOrNull(
predicate: (Long) -> Boolean
): Long?
fun FloatArray.firstOrNull(
predicate: (Float) -> Boolean
): Float?
fun DoubleArray.firstOrNull(
predicate: (Double) -> Boolean
): Double?
fun BooleanArray.firstOrNull(
predicate: (Boolean) -> Boolean
): Boolean?
fun CharArray.firstOrNull(
predicate: (Char) -> Boolean
): Char?
fun <T> Iterable<T>.firstOrNull(
predicate: (T) -> Boolean
): T?
fun ULongArray.firstOrNull(
predicate: (ULong) -> Boolean
): ULong?
fun UByteArray.firstOrNull(
predicate: (UByte) -> Boolean
): UByte?
fun UShortArray.firstOrNull(
predicate: (UShort) -> Boolean
): UShort?
Returns the first element, or null
if the collection is empty.
fun <T> Iterable<T>.firstOrNull(): T?
Returns the first element, or null
if the list is empty.
fun <T> List<T>.firstOrNull(): T?
flatMap
Returns a single list of all elements yielded from results of transform function being invoked on each element of original array.
fun <R> ShortArray.flatMap(
transform: (Short) -> Iterable<R>
): List<R>
fun <R> FloatArray.flatMap(
transform: (Float) -> Iterable<R>
): List<R>
fun <R> DoubleArray.flatMap(
transform: (Double) -> Iterable<R>
): List<R>
fun <R> BooleanArray.flatMap(
transform: (Boolean) -> Iterable<R>
): List<R>
fun <R> ULongArray.flatMap(
transform: (ULong) -> Iterable<R>
): List<R>
fun <R> UByteArray.flatMap(
transform: (UByte) -> Iterable<R>
): List<R>
fun <R> UShortArray.flatMap(
transform: (UShort) -> Iterable<R>
): List<R>
Returns a single list of all elements yielded from results of transform function being invoked on each element of original collection.
flatMapTo
Appends all elements yielded from results of transform function being invoked on each element of original array, to the given destination.
fun <T, R, C : MutableCollection<in R>> Array<out T>.flatMapTo(
destination: C,
transform: (T) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> ByteArray.flatMapTo(
destination: C,
transform: (Byte) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> ShortArray.flatMapTo(
destination: C,
transform: (Short) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> IntArray.flatMapTo(
destination: C,
transform: (Int) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> LongArray.flatMapTo(
destination: C,
transform: (Long) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> FloatArray.flatMapTo(
destination: C,
transform: (Float) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> DoubleArray.flatMapTo(
destination: C,
transform: (Double) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> BooleanArray.flatMapTo(
destination: C,
transform: (Boolean) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> CharArray.flatMapTo(
destination: C,
transform: (Char) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> UIntArray.flatMapTo(
destination: C,
transform: (UInt) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> ULongArray.flatMapTo(
destination: C,
transform: (ULong) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> UByteArray.flatMapTo(
destination: C,
transform: (UByte) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> UShortArray.flatMapTo(
destination: C,
transform: (UShort) -> Iterable<R>
): C
Appends all elements yielded from results of transform function being invoked on each element of original collection, to the given destination.
fun <T, R, C : MutableCollection<in R>> Iterable<T>.flatMapTo(
destination: C,
transform: (T) -> Iterable<R>
): C
Appends all elements yielded from results of transform function being invoked on each entry of original map, to the given destination.
fun <K, V, R, C : MutableCollection<in R>> Map<out K, V>.flatMapTo(
destination: C,
transform: (Entry<K, V>) -> Iterable<R>
): C
flatten
Returns a single list of all elements from all arrays in the given array.
fun <T> Array<out Array<out T>>.flatten(): List<T>
fold
Accumulates value starting with initial value and applying operation from left to right to current accumulator value and each element.
fun <T, R> Array<out T>.fold(
initial: R,
operation: (acc: R, T) -> R
): R
fun <R> ByteArray.fold(
initial: R,
operation: (acc: R, Byte) -> R
): R
fun <R> ShortArray.fold(
initial: R,
operation: (acc: R, Short) -> R
): R
fun <R> IntArray.fold(
initial: R,
operation: (acc: R, Int) -> R
): R
fun <R> LongArray.fold(
initial: R,
operation: (acc: R, Long) -> R
): R
fun <R> FloatArray.fold(
initial: R,
operation: (acc: R, Float) -> R
): R
fun <R> DoubleArray.fold(
initial: R,
operation: (acc: R, Double) -> R
): R
fun <R> BooleanArray.fold(
initial: R,
operation: (acc: R, Boolean) -> R
): R
fun <R> CharArray.fold(
initial: R,
operation: (acc: R, Char) -> R
): R
fun <T, R> Iterable<T>.fold(
initial: R,
operation: (acc: R, T) -> R
): R
fun <R> ULongArray.fold(
initial: R,
operation: (acc: R, ULong) -> R
): R
fun <R> UByteArray.fold(
initial: R,
operation: (acc: R, UByte) -> R
): R
fun <R> UShortArray.fold(
initial: R,
operation: (acc: R, UShort) -> R
): R
Groups elements from the Grouping source by key and applies operation to the elements of each group sequentially, passing the previously accumulated value and the current element as arguments, and stores the results in a new map. An initial value of accumulator is provided by initialValueSelector function.
Groups elements from the Grouping source by key and applies operation to the elements of each group sequentially, passing the previously accumulated value and the current element as arguments, and stores the results in a new map. An initial value of accumulator is the same initialValue for each group.
foldIndexed
Accumulates value starting with initial value and applying operation from left to right to current accumulator value and each element with its index in the original array.
fun <T, R> Array<out T>.foldIndexed(
initial: R,
operation: (index: Int, acc: R, T) -> R
): R
fun <R> ByteArray.foldIndexed(
initial: R,
operation: (index: Int, acc: R, Byte) -> R
): R
fun <R> ShortArray.foldIndexed(
initial: R,
operation: (index: Int, acc: R, Short) -> R
): R
fun <R> IntArray.foldIndexed(
initial: R,
operation: (index: Int, acc: R, Int) -> R
): R
fun <R> LongArray.foldIndexed(
initial: R,
operation: (index: Int, acc: R, Long) -> R
): R
fun <R> FloatArray.foldIndexed(
initial: R,
operation: (index: Int, acc: R, Float) -> R
): R
fun <R> DoubleArray.foldIndexed(
initial: R,
operation: (index: Int, acc: R, Double) -> R
): R
fun <R> BooleanArray.foldIndexed(
initial: R,
operation: (index: Int, acc: R, Boolean) -> R
): R
fun <R> CharArray.foldIndexed(
initial: R,
operation: (index: Int, acc: R, Char) -> R
): R
fun <R> ULongArray.foldIndexed(
initial: R,
operation: (index: Int, acc: R, ULong) -> R
): R
fun <R> UByteArray.foldIndexed(
initial: R,
operation: (index: Int, acc: R, UByte) -> R
): R
fun <R> UShortArray.foldIndexed(
initial: R,
operation: (index: Int, acc: R, UShort) -> R
): R
foldRight
Accumulates value starting with initial value and applying operation from right to left to each element and current accumulator value.
fun <T, R> Array<out T>.foldRight(
initial: R,
operation: (T, acc: R) -> R
): R
fun <R> ByteArray.foldRight(
initial: R,
operation: (Byte, acc: R) -> R
): R
fun <R> ShortArray.foldRight(
initial: R,
operation: (Short, acc: R) -> R
): R
fun <R> IntArray.foldRight(
initial: R,
operation: (Int, acc: R) -> R
): R
fun <R> LongArray.foldRight(
initial: R,
operation: (Long, acc: R) -> R
): R
fun <R> FloatArray.foldRight(
initial: R,
operation: (Float, acc: R) -> R
): R
fun <R> DoubleArray.foldRight(
initial: R,
operation: (Double, acc: R) -> R
): R
fun <R> BooleanArray.foldRight(
initial: R,
operation: (Boolean, acc: R) -> R
): R
fun <R> CharArray.foldRight(
initial: R,
operation: (Char, acc: R) -> R
): R
fun <T, R> List<T>.foldRight(
initial: R,
operation: (T, acc: R) -> R
): R
fun <R> ULongArray.foldRight(
initial: R,
operation: (ULong, acc: R) -> R
): R
fun <R> UByteArray.foldRight(
initial: R,
operation: (UByte, acc: R) -> R
): R
fun <R> UShortArray.foldRight(
initial: R,
operation: (UShort, acc: R) -> R
): R
foldRightIndexed
Accumulates value starting with initial value and applying operation from right to left to each element with its index in the original array and current accumulator value.
fun <T, R> Array<out T>.foldRightIndexed(
initial: R,
operation: (index: Int, T, acc: R) -> R
): R
fun <R> ByteArray.foldRightIndexed(
initial: R,
operation: (index: Int, Byte, acc: R) -> R
): R
fun <R> ShortArray.foldRightIndexed(
initial: R,
operation: (index: Int, Short, acc: R) -> R
): R
fun <R> IntArray.foldRightIndexed(
initial: R,
operation: (index: Int, Int, acc: R) -> R
): R
fun <R> LongArray.foldRightIndexed(
initial: R,
operation: (index: Int, Long, acc: R) -> R
): R
fun <R> FloatArray.foldRightIndexed(
initial: R,
operation: (index: Int, Float, acc: R) -> R
): R
fun <R> DoubleArray.foldRightIndexed(
initial: R,
operation: (index: Int, Double, acc: R) -> R
): R
fun <R> BooleanArray.foldRightIndexed(
initial: R,
operation: (index: Int, Boolean, acc: R) -> R
): R
fun <R> CharArray.foldRightIndexed(
initial: R,
operation: (index: Int, Char, acc: R) -> R
): R
fun <R> ULongArray.foldRightIndexed(
initial: R,
operation: (index: Int, ULong, acc: R) -> R
): R
fun <R> UByteArray.foldRightIndexed(
initial: R,
operation: (index: Int, UByte, acc: R) -> R
): R
fun <R> UShortArray.foldRightIndexed(
initial: R,
operation: (index: Int, UShort, acc: R) -> R
): R
foldTo
Groups elements from the Grouping source by key and applies operation to the elements of each group sequentially, passing the previously accumulated value and the current element as arguments, and stores the results in the given destination map. An initial value of accumulator is provided by initialValueSelector function.
fun <T, K, R, M : MutableMap<in K, R>> Grouping<T, K>.foldTo(
destination: M,
initialValueSelector: (key: K, element: T) -> R,
operation: (key: K, accumulator: R, element: T) -> R
): M
Groups elements from the Grouping source by key and applies operation to the elements of each group sequentially, passing the previously accumulated value and the current element as arguments, and stores the results in the given destination map. An initial value of accumulator is the same initialValue for each group.
fun <T, K, R, M : MutableMap<in K, R>> Grouping<T, K>.foldTo(
destination: M,
initialValue: R,
operation: (accumulator: R, element: T) -> R
): M
forEach
Performs the given action on each element.
fun <T> Array<out T>.forEach(action: (T) -> Unit)
fun ByteArray.forEach(action: (Byte) -> Unit)
fun ShortArray.forEach(action: (Short) -> Unit)
fun IntArray.forEach(action: (Int) -> Unit)
fun LongArray.forEach(action: (Long) -> Unit)
fun FloatArray.forEach(action: (Float) -> Unit)
fun DoubleArray.forEach(action: (Double) -> Unit)
fun BooleanArray.forEach(action: (Boolean) -> Unit)
fun CharArray.forEach(action: (Char) -> Unit)
fun <T> Iterable<T>.forEach(action: (T) -> Unit)
fun ULongArray.forEach(action: (ULong) -> Unit)
fun UByteArray.forEach(action: (UByte) -> Unit)
fun UShortArray.forEach(action: (UShort) -> Unit)
Performs the given action on each entry.
forEachIndexed
Performs the given action on each element, providing sequential index with the element.
fun <T> Array<out T>.forEachIndexed(
action: (index: Int, T) -> Unit)
fun ByteArray.forEachIndexed(
action: (index: Int, Byte) -> Unit)
fun ShortArray.forEachIndexed(
action: (index: Int, Short) -> Unit)
fun IntArray.forEachIndexed(
action: (index: Int, Int) -> Unit)
fun LongArray.forEachIndexed(
action: (index: Int, Long) -> Unit)
fun FloatArray.forEachIndexed(
action: (index: Int, Float) -> Unit)
fun DoubleArray.forEachIndexed(
action: (index: Int, Double) -> Unit)
fun BooleanArray.forEachIndexed(
action: (index: Int, Boolean) -> Unit)
fun CharArray.forEachIndexed(
action: (index: Int, Char) -> Unit)
fun <T> Iterable<T>.forEachIndexed(
action: (index: Int, T) -> Unit)
fun ULongArray.forEachIndexed(
action: (index: Int, ULong) -> Unit)
fun UByteArray.forEachIndexed(
action: (index: Int, UByte) -> Unit)
fun UShortArray.forEachIndexed(
action: (index: Int, UShort) -> Unit)
getOrDefault
Returns the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key.
fun <K, V> Map<out K, V>.getOrDefault(
key: K,
defaultValue: V
): V
getOrElse
Returns an element at the given index or the result of calling the defaultValue function if the index is out of bounds of this array.
fun <T> Array<out T>.getOrElse(
index: Int,
defaultValue: (Int) -> T
): T
fun ByteArray.getOrElse(
index: Int,
defaultValue: (Int) -> Byte
): Byte
fun ShortArray.getOrElse(
index: Int,
defaultValue: (Int) -> Short
): Short
fun IntArray.getOrElse(
index: Int,
defaultValue: (Int) -> Int
): Int
fun LongArray.getOrElse(
index: Int,
defaultValue: (Int) -> Long
): Long
fun FloatArray.getOrElse(
index: Int,
defaultValue: (Int) -> Float
): Float
fun DoubleArray.getOrElse(
index: Int,
defaultValue: (Int) -> Double
): Double
fun BooleanArray.getOrElse(
index: Int,
defaultValue: (Int) -> Boolean
): Boolean
fun CharArray.getOrElse(
index: Int,
defaultValue: (Int) -> Char
): Char
fun ULongArray.getOrElse(
index: Int,
defaultValue: (Int) -> ULong
): ULong
fun UByteArray.getOrElse(
index: Int,
defaultValue: (Int) -> UByte
): UByte
fun UShortArray.getOrElse(
index: Int,
defaultValue: (Int) -> UShort
): UShort
Returns an element at the given index or the result of calling the defaultValue function if the index is out of bounds of this list.
fun <T> List<T>.getOrElse(
index: Int,
defaultValue: (Int) -> T
): T
Returns the value for the given key, or the result of the defaultValue function if there was no entry for the given key.
fun <K, V> Map<K, V>.getOrElse(
key: K,
defaultValue: () -> V
): V
getOrNull
Returns an element at the given index or null
if the index is out of bounds of this array.
fun <T> Array<out T>.getOrNull(index: Int): T?
fun ByteArray.getOrNull(index: Int): Byte?
fun ShortArray.getOrNull(index: Int): Short?
fun IntArray.getOrNull(index: Int): Int?
fun LongArray.getOrNull(index: Int): Long?
fun FloatArray.getOrNull(index: Int): Float?
fun DoubleArray.getOrNull(index: Int): Double?
fun BooleanArray.getOrNull(index: Int): Boolean?
fun CharArray.getOrNull(index: Int): Char?
fun ULongArray.getOrNull(index: Int): ULong?
fun UByteArray.getOrNull(index: Int): UByte?
fun UShortArray.getOrNull(index: Int): UShort?
getOrPut
Returns the value for the given key. If the key is not found in the map, calls the defaultValue function, puts its result into the map under the given key and returns it.
fun <K, V> MutableMap<K, V>.getOrPut(
key: K,
defaultValue: () -> V
): V
getValue
Returns the value of the property for the given object from this read-only map.
Returns the value of the property for the given object from this mutable map.
operator fun <V, V1 : V> MutableMap<in String, out V>.getValue(
thisRef: Any?,
property: KProperty<*>
): V1
groupBy
Groups elements of the original array by the key returned by the given keySelector function applied to each element and returns a map where each group key is associated with a list of corresponding elements.
fun <K> ShortArray.groupBy(
keySelector: (Short) -> K
): Map<K, List<Short>>
fun <K> FloatArray.groupBy(
keySelector: (Float) -> K
): Map<K, List<Float>>
fun <K> DoubleArray.groupBy(
keySelector: (Double) -> K
): Map<K, List<Double>>
fun <K> BooleanArray.groupBy(
keySelector: (Boolean) -> K
): Map<K, List<Boolean>>
fun <K> ULongArray.groupBy(
keySelector: (ULong) -> K
): Map<K, List<ULong>>
fun <K> UByteArray.groupBy(
keySelector: (UByte) -> K
): Map<K, List<UByte>>
fun <K> UShortArray.groupBy(
keySelector: (UShort) -> K
): Map<K, List<UShort>>
Groups values returned by the valueTransform function applied to each element of the original array by the key returned by the given keySelector function applied to the element and returns a map where each group key is associated with a list of corresponding values.
fun <K, V> ShortArray.groupBy(
keySelector: (Short) -> K,
valueTransform: (Short) -> V
): Map<K, List<V>>
fun <K, V> FloatArray.groupBy(
keySelector: (Float) -> K,
valueTransform: (Float) -> V
): Map<K, List<V>>
fun <K, V> DoubleArray.groupBy(
keySelector: (Double) -> K,
valueTransform: (Double) -> V
): Map<K, List<V>>
fun <K, V> BooleanArray.groupBy(
keySelector: (Boolean) -> K,
valueTransform: (Boolean) -> V
): Map<K, List<V>>
fun <K, V> ULongArray.groupBy(
keySelector: (ULong) -> K,
valueTransform: (ULong) -> V
): Map<K, List<V>>
fun <K, V> UByteArray.groupBy(
keySelector: (UByte) -> K,
valueTransform: (UByte) -> V
): Map<K, List<V>>
fun <K, V> UShortArray.groupBy(
keySelector: (UShort) -> K,
valueTransform: (UShort) -> V
): Map<K, List<V>>
Groups elements of the original collection by the key returned by the given keySelector function applied to each element and returns a map where each group key is associated with a list of corresponding elements.
Groups values returned by the valueTransform function applied to each element of the original collection by the key returned by the given keySelector function applied to the element and returns a map where each group key is associated with a list of corresponding values.
groupByTo
Groups elements of the original array by the key returned by the given keySelector function applied to each element and puts to the destination map each group key associated with a list of corresponding elements.
fun <T, K, M : MutableMap<in K, MutableList<T>>> Array<out T>.groupByTo(
destination: M,
keySelector: (T) -> K
): M
fun <K, M : MutableMap<in K, MutableList<Byte>>> ByteArray.groupByTo(
destination: M,
keySelector: (Byte) -> K
): M
fun <K, M : MutableMap<in K, MutableList<Short>>> ShortArray.groupByTo(
destination: M,
keySelector: (Short) -> K
): M
fun <K, M : MutableMap<in K, MutableList<Int>>> IntArray.groupByTo(
destination: M,
keySelector: (Int) -> K
): M
fun <K, M : MutableMap<in K, MutableList<Long>>> LongArray.groupByTo(
destination: M,
keySelector: (Long) -> K
): M
fun <K, M : MutableMap<in K, MutableList<Float>>> FloatArray.groupByTo(
destination: M,
keySelector: (Float) -> K
): M
fun <K, M : MutableMap<in K, MutableList<Double>>> DoubleArray.groupByTo(
destination: M,
keySelector: (Double) -> K
): M
fun <K, M : MutableMap<in K, MutableList<Boolean>>> BooleanArray.groupByTo(
destination: M,
keySelector: (Boolean) -> K
): M
fun <K, M : MutableMap<in K, MutableList<Char>>> CharArray.groupByTo(
destination: M,
keySelector: (Char) -> K
): M
fun <K, M : MutableMap<in K, MutableList<UInt>>> UIntArray.groupByTo(
destination: M,
keySelector: (UInt) -> K
): M
fun <K, M : MutableMap<in K, MutableList<ULong>>> ULongArray.groupByTo(
destination: M,
keySelector: (ULong) -> K
): M
fun <K, M : MutableMap<in K, MutableList<UByte>>> UByteArray.groupByTo(
destination: M,
keySelector: (UByte) -> K
): M
fun <K, M : MutableMap<in K, MutableList<UShort>>> UShortArray.groupByTo(
destination: M,
keySelector: (UShort) -> K
): M
Groups values returned by the valueTransform function applied to each element of the original array by the key returned by the given keySelector function applied to the element and puts to the destination map each group key associated with a list of corresponding values.
fun <T, K, V, M : MutableMap<in K, MutableList<V>>> Array<out T>.groupByTo(
destination: M,
keySelector: (T) -> K,
valueTransform: (T) -> V
): M
fun <K, V, M : MutableMap<in K, MutableList<V>>> ByteArray.groupByTo(
destination: M,
keySelector: (Byte) -> K,
valueTransform: (Byte) -> V
): M
fun <K, V, M : MutableMap<in K, MutableList<V>>> ShortArray.groupByTo(
destination: M,
keySelector: (Short) -> K,
valueTransform: (Short) -> V
): M
fun <K, V, M : MutableMap<in K, MutableList<V>>> IntArray.groupByTo(
destination: M,
keySelector: (Int) -> K,
valueTransform: (Int) -> V
): M
fun <K, V, M : MutableMap<in K, MutableList<V>>> LongArray.groupByTo(
destination: M,
keySelector: (Long) -> K,
valueTransform: (Long) -> V
): M
fun <K, V, M : MutableMap<in K, MutableList<V>>> FloatArray.groupByTo(
destination: M,
keySelector: (Float) -> K,
valueTransform: (Float) -> V
): M
fun <K, V, M : MutableMap<in K, MutableList<V>>> DoubleArray.groupByTo(
destination: M,
keySelector: (Double) -> K,
valueTransform: (Double) -> V
): M
fun <K, V, M : MutableMap<in K, MutableList<V>>> BooleanArray.groupByTo(
destination: M,
keySelector: (Boolean) -> K,
valueTransform: (Boolean) -> V
): M
fun <K, V, M : MutableMap<in K, MutableList<V>>> CharArray.groupByTo(
destination: M,
keySelector: (Char) -> K,
valueTransform: (Char) -> V
): M
fun <K, V, M : MutableMap<in K, MutableList<V>>> UIntArray.groupByTo(
destination: M,
keySelector: (UInt) -> K,
valueTransform: (UInt) -> V
): M
fun <K, V, M : MutableMap<in K, MutableList<V>>> ULongArray.groupByTo(
destination: M,
keySelector: (ULong) -> K,
valueTransform: (ULong) -> V
): M
fun <K, V, M : MutableMap<in K, MutableList<V>>> UByteArray.groupByTo(
destination: M,
keySelector: (UByte) -> K,
valueTransform: (UByte) -> V
): M
fun <K, V, M : MutableMap<in K, MutableList<V>>> UShortArray.groupByTo(
destination: M,
keySelector: (UShort) -> K,
valueTransform: (UShort) -> V
): M
Groups elements of the original collection by the key returned by the given keySelector function applied to each element and puts to the destination map each group key associated with a list of corresponding elements.
fun <T, K, M : MutableMap<in K, MutableList<T>>> Iterable<T>.groupByTo(
destination: M,
keySelector: (T) -> K
): M
Groups values returned by the valueTransform function applied to each element of the original collection by the key returned by the given keySelector function applied to the element and puts to the destination map each group key associated with a list of corresponding values.
fun <T, K, V, M : MutableMap<in K, MutableList<V>>> Iterable<T>.groupByTo(
destination: M,
keySelector: (T) -> K,
valueTransform: (T) -> V
): M
groupingBy
Creates a Grouping source from an array to be used later with one of group-and-fold operations using the specified keySelector function to extract a key from each element.
fun <T, K> Array<out T>.groupingBy(
keySelector: (T) -> K
): Grouping<T, K>
Creates a Grouping source from a collection to be used later with one of group-and-fold operations using the specified keySelector function to extract a key from each element.
ifEmpty
Returns this array if it's not empty or the result of calling defaultValue function if the array is empty.
fun <C, R> C.ifEmpty(
defaultValue: () -> R
): R where C : Array<*>, C : R
Returns this map if it's not empty or the result of calling defaultValue function if the map is empty.
fun <M, R> M.ifEmpty(
defaultValue: () -> R
): R where M : Map<*, *>, M : R
indexOf
Returns first index of element, or -1 if the array does not contain element.
fun <T> Array<out T>.indexOf(element: T): Int
fun ByteArray.indexOf(element: Byte): Int
fun ShortArray.indexOf(element: Short): Int
fun IntArray.indexOf(element: Int): Int
fun LongArray.indexOf(element: Long): Int
fun FloatArray.indexOf(element: Float): Int
fun DoubleArray.indexOf(element: Double): Int
fun BooleanArray.indexOf(element: Boolean): Int
fun CharArray.indexOf(element: Char): Int
fun ULongArray.indexOf(element: ULong): Int
fun UByteArray.indexOf(element: UByte): Int
fun UShortArray.indexOf(element: UShort): Int
indexOfFirst
Returns index of the first element matching the given predicate, or -1 if the array does not contain such element.
fun <T> Array<out T>.indexOfFirst(
predicate: (T) -> Boolean
): Int
fun ByteArray.indexOfFirst(predicate: (Byte) -> Boolean): Int
fun ShortArray.indexOfFirst(
predicate: (Short) -> Boolean
): Int
fun IntArray.indexOfFirst(predicate: (Int) -> Boolean): Int
fun LongArray.indexOfFirst(predicate: (Long) -> Boolean): Int
fun FloatArray.indexOfFirst(
predicate: (Float) -> Boolean
): Int
fun DoubleArray.indexOfFirst(
predicate: (Double) -> Boolean
): Int
fun BooleanArray.indexOfFirst(
predicate: (Boolean) -> Boolean
): Int
fun CharArray.indexOfFirst(predicate: (Char) -> Boolean): Int
fun ULongArray.indexOfFirst(
predicate: (ULong) -> Boolean
): Int
fun UByteArray.indexOfFirst(
predicate: (UByte) -> Boolean
): Int
fun UShortArray.indexOfFirst(
predicate: (UShort) -> Boolean
): Int
indexOfLast
Returns index of the last element matching the given predicate, or -1 if the array does not contain such element.
fun <T> Array<out T>.indexOfLast(
predicate: (T) -> Boolean
): Int
fun ByteArray.indexOfLast(predicate: (Byte) -> Boolean): Int
fun ShortArray.indexOfLast(
predicate: (Short) -> Boolean
): Int
fun IntArray.indexOfLast(predicate: (Int) -> Boolean): Int
fun LongArray.indexOfLast(predicate: (Long) -> Boolean): Int
fun FloatArray.indexOfLast(
predicate: (Float) -> Boolean
): Int
fun DoubleArray.indexOfLast(
predicate: (Double) -> Boolean
): Int
fun BooleanArray.indexOfLast(
predicate: (Boolean) -> Boolean
): Int
fun CharArray.indexOfLast(predicate: (Char) -> Boolean): Int
fun ULongArray.indexOfLast(
predicate: (ULong) -> Boolean
): Int
fun UByteArray.indexOfLast(
predicate: (UByte) -> Boolean
): Int
fun UShortArray.indexOfLast(
predicate: (UShort) -> Boolean
): Int
intersect
Returns a set containing all elements that are contained by both this array and the specified collection.
isEmpty
Returns true
if the array is empty.
fun <T> any_array<T>.isEmpty(): Boolean
isNotEmpty
Returns true
if the array is not empty.
fun <T> any_array<T>.isNotEmpty(): Boolean
Returns true
if the collection is not empty.
fun <T> Collection<T>.isNotEmpty(): Boolean
Returns true
if this map is not empty.
fun <K, V> Map<out K, V>.isNotEmpty(): Boolean
isNullOrEmpty
Returns true
if this nullable array is either null or empty.
fun Array<*>?.isNullOrEmpty(): Boolean
Returns true
if this nullable collection is either null or empty.
fun <T> Collection<T>?.isNullOrEmpty(): Boolean
Returns true
if this nullable map is either null or empty.
fun <K, V> Map<out K, V>?.isNullOrEmpty(): Boolean
iterator
Returns the given iterator itself. This allows to use an instance of iterator in a for
loop.
Returns a MutableIterator over the mutable entries in the MutableMap.
operator fun <K, V> MutableMap<K, V>.iterator(): MutableIterator<MutableEntry<K, V>>
joinTo
Appends the string from all the elements separated using separator and using the given prefix and postfix if supplied.
fun <T, A : Appendable> Array<out T>.joinTo(
buffer: A,
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((T) -> CharSequence)? = null
): A
fun <A : Appendable> ByteArray.joinTo(
buffer: A,
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((Byte) -> CharSequence)? = null
): A
fun <A : Appendable> ShortArray.joinTo(
buffer: A,
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((Short) -> CharSequence)? = null
): A
fun <A : Appendable> IntArray.joinTo(
buffer: A,
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((Int) -> CharSequence)? = null
): A
fun <A : Appendable> LongArray.joinTo(
buffer: A,
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((Long) -> CharSequence)? = null
): A
fun <A : Appendable> FloatArray.joinTo(
buffer: A,
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((Float) -> CharSequence)? = null
): A
fun <A : Appendable> DoubleArray.joinTo(
buffer: A,
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((Double) -> CharSequence)? = null
): A
fun <A : Appendable> BooleanArray.joinTo(
buffer: A,
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((Boolean) -> CharSequence)? = null
): A
fun <A : Appendable> CharArray.joinTo(
buffer: A,
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((Char) -> CharSequence)? = null
): A
fun <T, A : Appendable> Iterable<T>.joinTo(
buffer: A,
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((T) -> CharSequence)? = null
): A
joinToString
Creates a string from all the elements separated using separator and using the given prefix and postfix if supplied.
fun <T> Array<out T>.joinToString(
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((T) -> CharSequence)? = null
): String
fun ByteArray.joinToString(
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((Byte) -> CharSequence)? = null
): String
fun ShortArray.joinToString(
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((Short) -> CharSequence)? = null
): String
fun IntArray.joinToString(
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((Int) -> CharSequence)? = null
): String
fun LongArray.joinToString(
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((Long) -> CharSequence)? = null
): String
fun FloatArray.joinToString(
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((Float) -> CharSequence)? = null
): String
fun DoubleArray.joinToString(
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((Double) -> CharSequence)? = null
): String
fun BooleanArray.joinToString(
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((Boolean) -> CharSequence)? = null
): String
fun CharArray.joinToString(
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((Char) -> CharSequence)? = null
): String
fun <T> Iterable<T>.joinToString(
separator: CharSequence = ", ",
prefix: CharSequence = "",
postfix: CharSequence = "",
limit: Int = -1,
truncated: CharSequence = "...",
transform: ((T) -> CharSequence)? = null
): String
last
Returns the last element.
fun <T> Array<out T>.last(): T
fun ByteArray.last(): Byte
fun ShortArray.last(): Short
fun IntArray.last(): Int
fun LongArray.last(): Long
fun FloatArray.last(): Float
fun DoubleArray.last(): Double
fun BooleanArray.last(): Boolean
fun CharArray.last(): Char
fun <T> Iterable<T>.last(): T
fun <T> List<T>.last(): T
fun ULongArray.last(): ULong
fun UByteArray.last(): UByte
fun UShortArray.last(): UShort
Returns the last element matching the given predicate.
fun <T> Array<out T>.last(predicate: (T) -> Boolean): T
fun ByteArray.last(predicate: (Byte) -> Boolean): Byte
fun ShortArray.last(predicate: (Short) -> Boolean): Short
fun IntArray.last(predicate: (Int) -> Boolean): Int
fun LongArray.last(predicate: (Long) -> Boolean): Long
fun FloatArray.last(predicate: (Float) -> Boolean): Float
fun DoubleArray.last(predicate: (Double) -> Boolean): Double
fun BooleanArray.last(
predicate: (Boolean) -> Boolean
): Boolean
fun CharArray.last(predicate: (Char) -> Boolean): Char
fun <T> Iterable<T>.last(predicate: (T) -> Boolean): T
fun <T> List<T>.last(predicate: (T) -> Boolean): T
fun ULongArray.last(predicate: (ULong) -> Boolean): ULong
fun UByteArray.last(predicate: (UByte) -> Boolean): UByte
fun UShortArray.last(predicate: (UShort) -> Boolean): UShort
lastIndexOf
Returns last index of element, or -1 if the array does not contain element.
fun <T> Array<out T>.lastIndexOf(element: T): Int
fun ByteArray.lastIndexOf(element: Byte): Int
fun ShortArray.lastIndexOf(element: Short): Int
fun IntArray.lastIndexOf(element: Int): Int
fun LongArray.lastIndexOf(element: Long): Int
fun FloatArray.lastIndexOf(element: Float): Int
fun DoubleArray.lastIndexOf(element: Double): Int
fun BooleanArray.lastIndexOf(element: Boolean): Int
fun CharArray.lastIndexOf(element: Char): Int
fun ULongArray.lastIndexOf(element: ULong): Int
fun UByteArray.lastIndexOf(element: UByte): Int
fun UShortArray.lastIndexOf(element: UShort): Int
lastOrNull
Returns the last element, or null
if the array is empty.
fun <T> Array<out T>.lastOrNull(): T?
fun ByteArray.lastOrNull(): Byte?
fun ShortArray.lastOrNull(): Short?
fun IntArray.lastOrNull(): Int?
fun LongArray.lastOrNull(): Long?
fun FloatArray.lastOrNull(): Float?
fun DoubleArray.lastOrNull(): Double?
fun BooleanArray.lastOrNull(): Boolean?
fun CharArray.lastOrNull(): Char?
fun ULongArray.lastOrNull(): ULong?
fun UByteArray.lastOrNull(): UByte?
fun UShortArray.lastOrNull(): UShort?
Returns the last element matching the given predicate, or null
if no such element was found.
fun <T> Array<out T>.lastOrNull(
predicate: (T) -> Boolean
): T?
fun ByteArray.lastOrNull(predicate: (Byte) -> Boolean): Byte?
fun ShortArray.lastOrNull(
predicate: (Short) -> Boolean
): Short?
fun IntArray.lastOrNull(predicate: (Int) -> Boolean): Int?
fun LongArray.lastOrNull(predicate: (Long) -> Boolean): Long?
fun FloatArray.lastOrNull(
predicate: (Float) -> Boolean
): Float?
fun DoubleArray.lastOrNull(
predicate: (Double) -> Boolean
): Double?
fun BooleanArray.lastOrNull(
predicate: (Boolean) -> Boolean
): Boolean?
fun CharArray.lastOrNull(predicate: (Char) -> Boolean): Char?
fun <T> Iterable<T>.lastOrNull(predicate: (T) -> Boolean): T?
fun <T> List<T>.lastOrNull(predicate: (T) -> Boolean): T?
fun ULongArray.lastOrNull(
predicate: (ULong) -> Boolean
): ULong?
fun UByteArray.lastOrNull(
predicate: (UByte) -> Boolean
): UByte?
fun UShortArray.lastOrNull(
predicate: (UShort) -> Boolean
): UShort?
Returns the last element, or null
if the collection is empty.
fun <T> Iterable<T>.lastOrNull(): T?
Returns the last element, or null
if the list is empty.
fun <T> List<T>.lastOrNull(): T?
linkedMapOf
Returns an empty new LinkedHashMap.
fun <K, V> linkedMapOf(): LinkedHashMap<K, V>
Returns a new LinkedHashMap with the specified contents, given as a list of pairs where the first component is the key and the second is the value.
fun <K, V> linkedMapOf(
vararg pairs: Pair<K, V>
): LinkedHashMap<K, V>
linkedSetOf
Returns an empty new LinkedHashSet.
fun <T> linkedSetOf(): LinkedHashSet<T>
Returns a new LinkedHashSet with the given elements. Elements of the set are iterated in the order they were specified.
fun <T> linkedSetOf(vararg elements: T): LinkedHashSet<T>
linkedStringMapOf
Constructs the specialized implementation of LinkedHashMap with String keys, which stores the keys as properties of JS object without hashing them.
fun <V> linkedStringMapOf(
vararg pairs: Pair<String, V>
): LinkedHashMap<String, V>
linkedStringSetOf
Creates a new instance of the specialized implementation of LinkedHashSet with the specified String elements, which elements the keys as properties of JS object without hashing them.
fun linkedStringSetOf(
vararg elements: String
): LinkedHashSet<String>
listOf
Returns a new read-only list of given elements. The returned list is serializable (JVM).
fun <T> listOf(vararg elements: T): List<T>
Returns an empty read-only list. The returned list is serializable (JVM).
fun <T> listOf(): List<T>
listOfNotNull
Returns a new read-only list either of single given element, if it is not null, or empty list if the element is null. The returned list is serializable (JVM).
fun <T : Any> listOfNotNull(element: T?): List<T>
Returns a new read-only list only of those given elements, that are not null. The returned list is serializable (JVM).
fun <T : Any> listOfNotNull(vararg elements: T?): List<T>
map
Returns a list containing the results of applying the given transform function to each element in the original array.
fun <T, R> Array<out T>.map(transform: (T) -> R): List<R>
fun <R> ShortArray.map(transform: (Short) -> R): List<R>
fun <R> FloatArray.map(transform: (Float) -> R): List<R>
fun <R> DoubleArray.map(transform: (Double) -> R): List<R>
fun <R> BooleanArray.map(transform: (Boolean) -> R): List<R>
fun <R> ULongArray.map(transform: (ULong) -> R): List<R>
fun <R> UByteArray.map(transform: (UByte) -> R): List<R>
fun <R> UShortArray.map(transform: (UShort) -> R): List<R>
Returns a list containing the results of applying the given transform function to each element in the original collection.
mapIndexed
Returns a list containing the results of applying the given transform function to each element and its index in the original array.
fun <T, R> Array<out T>.mapIndexed(
transform: (index: Int, T) -> R
): List<R>
fun <R> ShortArray.mapIndexed(
transform: (index: Int, Short) -> R
): List<R>
fun <R> FloatArray.mapIndexed(
transform: (index: Int, Float) -> R
): List<R>
fun <R> DoubleArray.mapIndexed(
transform: (index: Int, Double) -> R
): List<R>
fun <R> BooleanArray.mapIndexed(
transform: (index: Int, Boolean) -> R
): List<R>
fun <R> ULongArray.mapIndexed(
transform: (index: Int, ULong) -> R
): List<R>
fun <R> UByteArray.mapIndexed(
transform: (index: Int, UByte) -> R
): List<R>
fun <R> UShortArray.mapIndexed(
transform: (index: Int, UShort) -> R
): List<R>
mapIndexedNotNull
mapIndexedNotNullTo
Applies the given transform function to each element and its index in the original array and appends only the non-null results to the given destination.
fun <T, R : Any, C : MutableCollection<in R>> Array<out T>.mapIndexedNotNullTo(
destination: C,
transform: (index: Int, T) -> R?
): C
Applies the given transform function to each element and its index in the original collection and appends only the non-null results to the given destination.
fun <T, R : Any, C : MutableCollection<in R>> Iterable<T>.mapIndexedNotNullTo(
destination: C,
transform: (index: Int, T) -> R?
): C
mapIndexedTo
Applies the given transform function to each element and its index in the original array and appends the results to the given destination.
fun <T, R, C : MutableCollection<in R>> Array<out T>.mapIndexedTo(
destination: C,
transform: (index: Int, T) -> R
): C
fun <R, C : MutableCollection<in R>> ByteArray.mapIndexedTo(
destination: C,
transform: (index: Int, Byte) -> R
): C
fun <R, C : MutableCollection<in R>> ShortArray.mapIndexedTo(
destination: C,
transform: (index: Int, Short) -> R
): C
fun <R, C : MutableCollection<in R>> IntArray.mapIndexedTo(
destination: C,
transform: (index: Int, Int) -> R
): C
fun <R, C : MutableCollection<in R>> LongArray.mapIndexedTo(
destination: C,
transform: (index: Int, Long) -> R
): C
fun <R, C : MutableCollection<in R>> FloatArray.mapIndexedTo(
destination: C,
transform: (index: Int, Float) -> R
): C
fun <R, C : MutableCollection<in R>> DoubleArray.mapIndexedTo(
destination: C,
transform: (index: Int, Double) -> R
): C
fun <R, C : MutableCollection<in R>> BooleanArray.mapIndexedTo(
destination: C,
transform: (index: Int, Boolean) -> R
): C
fun <R, C : MutableCollection<in R>> CharArray.mapIndexedTo(
destination: C,
transform: (index: Int, Char) -> R
): C
fun <R, C : MutableCollection<in R>> UIntArray.mapIndexedTo(
destination: C,
transform: (index: Int, UInt) -> R
): C
fun <R, C : MutableCollection<in R>> ULongArray.mapIndexedTo(
destination: C,
transform: (index: Int, ULong) -> R
): C
fun <R, C : MutableCollection<in R>> UByteArray.mapIndexedTo(
destination: C,
transform: (index: Int, UByte) -> R
): C
fun <R, C : MutableCollection<in R>> UShortArray.mapIndexedTo(
destination: C,
transform: (index: Int, UShort) -> R
): C
Applies the given transform function to each element and its index in the original collection and appends the results to the given destination.
fun <T, R, C : MutableCollection<in R>> Iterable<T>.mapIndexedTo(
destination: C,
transform: (index: Int, T) -> R
): C
mapKeysTo
Populates the given destination map with entries having the keys obtained by applying the transform function to each entry in this Map and the values of this map.
fun <K, V, R, M : MutableMap<in R, in V>> Map<out K, V>.mapKeysTo(
destination: M,
transform: (Entry<K, V>) -> R
): M
mapNotNull
Returns a list containing only the non-null results of applying the given transform function to each element in the original array.
fun <T, R : Any> Array<out T>.mapNotNull(
transform: (T) -> R?
): List<R>
Returns a list containing only the non-null results of applying the given transform function to each element in the original collection.
mapNotNullTo
Applies the given transform function to each element in the original array and appends only the non-null results to the given destination.
fun <T, R : Any, C : MutableCollection<in R>> Array<out T>.mapNotNullTo(
destination: C,
transform: (T) -> R?
): C
Applies the given transform function to each element in the original collection and appends only the non-null results to the given destination.
fun <T, R : Any, C : MutableCollection<in R>> Iterable<T>.mapNotNullTo(
destination: C,
transform: (T) -> R?
): C
Applies the given transform function to each entry in the original map and appends only the non-null results to the given destination.
fun <K, V, R : Any, C : MutableCollection<in R>> Map<out K, V>.mapNotNullTo(
destination: C,
transform: (Entry<K, V>) -> R?
): C
mapOf
Returns a new read-only map with the specified contents, given as a list of pairs where the first value is the key and the second is the value.
Returns an empty read-only map.
fun <K, V> mapOf(): Map<K, V>
mapTo
Applies the given transform function to each element of the original array and appends the results to the given destination.
fun <T, R, C : MutableCollection<in R>> Array<out T>.mapTo(
destination: C,
transform: (T) -> R
): C
fun <R, C : MutableCollection<in R>> ByteArray.mapTo(
destination: C,
transform: (Byte) -> R
): C
fun <R, C : MutableCollection<in R>> ShortArray.mapTo(
destination: C,
transform: (Short) -> R
): C
fun <R, C : MutableCollection<in R>> IntArray.mapTo(
destination: C,
transform: (Int) -> R
): C
fun <R, C : MutableCollection<in R>> LongArray.mapTo(
destination: C,
transform: (Long) -> R
): C
fun <R, C : MutableCollection<in R>> FloatArray.mapTo(
destination: C,
transform: (Float) -> R
): C
fun <R, C : MutableCollection<in R>> DoubleArray.mapTo(
destination: C,
transform: (Double) -> R
): C
fun <R, C : MutableCollection<in R>> BooleanArray.mapTo(
destination: C,
transform: (Boolean) -> R
): C
fun <R, C : MutableCollection<in R>> CharArray.mapTo(
destination: C,
transform: (Char) -> R
): C
fun <R, C : MutableCollection<in R>> UIntArray.mapTo(
destination: C,
transform: (UInt) -> R
): C
fun <R, C : MutableCollection<in R>> ULongArray.mapTo(
destination: C,
transform: (ULong) -> R
): C
fun <R, C : MutableCollection<in R>> UByteArray.mapTo(
destination: C,
transform: (UByte) -> R
): C
fun <R, C : MutableCollection<in R>> UShortArray.mapTo(
destination: C,
transform: (UShort) -> R
): C
Applies the given transform function to each element of the original collection and appends the results to the given destination.
fun <T, R, C : MutableCollection<in R>> Iterable<T>.mapTo(
destination: C,
transform: (T) -> R
): C
Applies the given transform function to each entry of the original map and appends the results to the given destination.
fun <K, V, R, C : MutableCollection<in R>> Map<out K, V>.mapTo(
destination: C,
transform: (Entry<K, V>) -> R
): C
mapValuesTo
Populates the given destination map with entries having the keys of this map and the values obtained by applying the transform function to each entry in this Map.
fun <K, V, R, M : MutableMap<in K, in R>> Map<out K, V>.mapValuesTo(
destination: M,
transform: (Entry<K, V>) -> R
): M
max
Returns the largest element or null
if there are no elements.
fun Array<out Double>.max(): Double?
fun Array<out Float>.max(): Float?
fun <T : Comparable<T>> Array<out T>.max(): T?
fun ByteArray.max(): Byte?
fun ShortArray.max(): Short?
fun IntArray.max(): Int?
fun LongArray.max(): Long?
fun FloatArray.max(): Float?
fun DoubleArray.max(): Double?
fun CharArray.max(): Char?
fun Iterable<Double>.max(): Double?
fun Iterable<Float>.max(): Float?
fun <T : Comparable<T>> Iterable<T>.max(): T?
fun ULongArray.max(): ULong?
fun UByteArray.max(): UByte?
fun UShortArray.max(): UShort?
maxBy
Returns the first element yielding the largest value of the given function or null
if there are no elements.
fun <T, R : Comparable<R>> Array<out T>.maxBy(
selector: (T) -> R
): T?
fun <R : Comparable<R>> ByteArray.maxBy(
selector: (Byte) -> R
): Byte?
fun <R : Comparable<R>> ShortArray.maxBy(
selector: (Short) -> R
): Short?
fun <R : Comparable<R>> IntArray.maxBy(
selector: (Int) -> R
): Int?
fun <R : Comparable<R>> LongArray.maxBy(
selector: (Long) -> R
): Long?
fun <R : Comparable<R>> FloatArray.maxBy(
selector: (Float) -> R
): Float?
fun <R : Comparable<R>> DoubleArray.maxBy(
selector: (Double) -> R
): Double?
fun <R : Comparable<R>> BooleanArray.maxBy(
selector: (Boolean) -> R
): Boolean?
fun <R : Comparable<R>> CharArray.maxBy(
selector: (Char) -> R
): Char?
fun <T, R : Comparable<R>> Iterable<T>.maxBy(
selector: (T) -> R
): T?
fun <R : Comparable<R>> UIntArray.maxBy(
selector: (UInt) -> R
): UInt?
fun <R : Comparable<R>> ULongArray.maxBy(
selector: (ULong) -> R
): ULong?
fun <R : Comparable<R>> UByteArray.maxBy(
selector: (UByte) -> R
): UByte?
fun <R : Comparable<R>> UShortArray.maxBy(
selector: (UShort) -> R
): UShort?
Returns the first entry yielding the largest value of the given function or null
if there are no entries.
fun <K, V, R : Comparable<R>> Map<out K, V>.maxBy(
selector: (Entry<K, V>) -> R
): Entry<K, V>?
maxWith
Returns the first element having the largest value according to the provided comparator or null
if there are no elements.
fun <T> Array<out T>.maxWith(
comparator: Comparator<in T>
): T?
fun ByteArray.maxWith(comparator: Comparator<in Byte>): Byte?
fun ShortArray.maxWith(
comparator: Comparator<in Short>
): Short?
fun IntArray.maxWith(comparator: Comparator<in Int>): Int?
fun LongArray.maxWith(comparator: Comparator<in Long>): Long?
fun FloatArray.maxWith(
comparator: Comparator<in Float>
): Float?
fun DoubleArray.maxWith(
comparator: Comparator<in Double>
): Double?
fun BooleanArray.maxWith(
comparator: Comparator<in Boolean>
): Boolean?
fun CharArray.maxWith(comparator: Comparator<in Char>): Char?
fun <T> Iterable<T>.maxWith(comparator: Comparator<in T>): T?
fun UIntArray.maxWith(comparator: Comparator<in UInt>): UInt?
fun ULongArray.maxWith(
comparator: Comparator<in ULong>
): ULong?
fun UByteArray.maxWith(
comparator: Comparator<in UByte>
): UByte?
fun UShortArray.maxWith(
comparator: Comparator<in UShort>
): UShort?
Returns the first entry having the largest value according to the provided comparator or null
if there are no entries.
fun <K, V> Map<out K, V>.maxWith(
comparator: Comparator<in Entry<K, V>>
): Entry<K, V>?
min
Returns the smallest element or null
if there are no elements.
fun Array<out Double>.min(): Double?
fun Array<out Float>.min(): Float?
fun <T : Comparable<T>> Array<out T>.min(): T?
fun ByteArray.min(): Byte?
fun ShortArray.min(): Short?
fun IntArray.min(): Int?
fun LongArray.min(): Long?
fun FloatArray.min(): Float?
fun DoubleArray.min(): Double?
fun CharArray.min(): Char?
fun Iterable<Double>.min(): Double?
fun Iterable<Float>.min(): Float?
fun <T : Comparable<T>> Iterable<T>.min(): T?
fun ULongArray.min(): ULong?
fun UByteArray.min(): UByte?
fun UShortArray.min(): UShort?
minBy
Returns the first element yielding the smallest value of the given function or null
if there are no elements.
fun <T, R : Comparable<R>> Array<out T>.minBy(
selector: (T) -> R
): T?
fun <R : Comparable<R>> ByteArray.minBy(
selector: (Byte) -> R
): Byte?
fun <R : Comparable<R>> ShortArray.minBy(
selector: (Short) -> R
): Short?
fun <R : Comparable<R>> IntArray.minBy(
selector: (Int) -> R
): Int?
fun <R : Comparable<R>> LongArray.minBy(
selector: (Long) -> R
): Long?
fun <R : Comparable<R>> FloatArray.minBy(
selector: (Float) -> R
): Float?
fun <R : Comparable<R>> DoubleArray.minBy(
selector: (Double) -> R
): Double?
fun <R : Comparable<R>> BooleanArray.minBy(
selector: (Boolean) -> R
): Boolean?
fun <R : Comparable<R>> CharArray.minBy(
selector: (Char) -> R
): Char?
fun <T, R : Comparable<R>> Iterable<T>.minBy(
selector: (T) -> R
): T?
fun <R : Comparable<R>> UIntArray.minBy(
selector: (UInt) -> R
): UInt?
fun <R : Comparable<R>> ULongArray.minBy(
selector: (ULong) -> R
): ULong?
fun <R : Comparable<R>> UByteArray.minBy(
selector: (UByte) -> R
): UByte?
fun <R : Comparable<R>> UShortArray.minBy(
selector: (UShort) -> R
): UShort?
Returns the first entry yielding the smallest value of the given function or null
if there are no entries.
fun <K, V, R : Comparable<R>> Map<out K, V>.minBy(
selector: (Entry<K, V>) -> R
): Entry<K, V>?
minus
Returns a list containing all elements of the original collection without the first occurrence of the given element.
Returns a list containing all elements of the original collection except the elements contained in the given elements array.
Returns a list containing all elements of the original collection except the elements contained in the given elements collection.
Returns a list containing all elements of the original collection except the elements contained in the given elements sequence.
Returns a set containing all elements of the original set except the given element.
Returns a set containing all elements of the original set except the elements contained in the given elements array.
Returns a set containing all elements of the original set except the elements contained in the given elements collection.
Returns a set containing all elements of the original set except the elements contained in the given elements sequence.
Returns a map containing all entries of the original map except the entry with the given key.
Returns a map containing all entries of the original map except those entries the keys of which are contained in the given keys collection.
Returns a map containing all entries of the original map except those entries the keys of which are contained in the given keys array.
minusAssign
Removes the entry with the given key from this mutable map.
operator fun <K, V> MutableMap<K, V>.minusAssign(key: K)
Removes all entries the keys of which are contained in the given keys collection from this mutable map.
operator fun <K, V> MutableMap<K, V>.minusAssign(
keys: Iterable<K>)
Removes all entries the keys of which are contained in the given keys array from this mutable map.
operator fun <K, V> MutableMap<K, V>.minusAssign(
keys: Array<out K>)
Removes all entries from the keys of which are contained in the given keys sequence from this mutable map.
operator fun <K, V> MutableMap<K, V>.minusAssign(
keys: Sequence<K>)
Removes a single instance of the specified element from this mutable collection.
operator fun <T> MutableCollection<in T>.minusAssign(
element: T)
Removes all elements contained in the given elements collection from this mutable collection.
operator fun <T> MutableCollection<in T>.minusAssign(
elements: Iterable<T>)
Removes all elements contained in the given elements array from this mutable collection.
operator fun <T> MutableCollection<in T>.minusAssign(
elements: Array<T>)
Removes all elements contained in the given elements sequence from this mutable collection.
operator fun <T> MutableCollection<in T>.minusAssign(
elements: Sequence<T>)
minusElement
Returns a list containing all elements of the original collection without the first occurrence of the given element.
minWith
Returns the first element having the smallest value according to the provided comparator or null
if there are no elements.
fun <T> Array<out T>.minWith(
comparator: Comparator<in T>
): T?
fun ByteArray.minWith(comparator: Comparator<in Byte>): Byte?
fun ShortArray.minWith(
comparator: Comparator<in Short>
): Short?
fun IntArray.minWith(comparator: Comparator<in Int>): Int?
fun LongArray.minWith(comparator: Comparator<in Long>): Long?
fun FloatArray.minWith(
comparator: Comparator<in Float>
): Float?
fun DoubleArray.minWith(
comparator: Comparator<in Double>
): Double?
fun BooleanArray.minWith(
comparator: Comparator<in Boolean>
): Boolean?
fun CharArray.minWith(comparator: Comparator<in Char>): Char?
fun <T> Iterable<T>.minWith(comparator: Comparator<in T>): T?
fun UIntArray.minWith(comparator: Comparator<in UInt>): UInt?
fun ULongArray.minWith(
comparator: Comparator<in ULong>
): ULong?
fun UByteArray.minWith(
comparator: Comparator<in UByte>
): UByte?
fun UShortArray.minWith(
comparator: Comparator<in UShort>
): UShort?
Returns the first entry having the smallest value according to the provided comparator or null
if there are no entries.
fun <K, V> Map<out K, V>.minWith(
comparator: Comparator<in Entry<K, V>>
): Entry<K, V>?
MutableList
Creates a new mutable list with the specified size, where each element is calculated by calling the specified init function.
fun <T> MutableList(
size: Int,
init: (index: Int) -> T
): MutableList<T>
mutableListOf
Returns an empty new MutableList.
fun <T> mutableListOf(): MutableList<T>
Returns a new MutableList with the given elements.
fun <T> mutableListOf(vararg elements: T): MutableList<T>
mutableMapOf
Returns an empty new MutableMap.
fun <K, V> mutableMapOf(): MutableMap<K, V>
Returns a new MutableMap with the specified contents, given as a list of pairs where the first component is the key and the second is the value.
fun <K, V> mutableMapOf(
vararg pairs: Pair<K, V>
): MutableMap<K, V>
mutableSetOf
Returns an empty new MutableSet.
fun <T> mutableSetOf(): MutableSet<T>
Returns a new MutableSet with the given elements. Elements of the set are iterated in the order they were specified.
fun <T> mutableSetOf(vararg elements: T): MutableSet<T>
none
Returns true
if the array has no elements.
fun <T> Array<out T>.none(): Boolean
fun ByteArray.none(): Boolean
fun ShortArray.none(): Boolean
fun IntArray.none(): Boolean
fun LongArray.none(): Boolean
fun FloatArray.none(): Boolean
fun DoubleArray.none(): Boolean
fun BooleanArray.none(): Boolean
fun CharArray.none(): Boolean
fun UIntArray.none(): Boolean
fun ULongArray.none(): Boolean
fun UByteArray.none(): Boolean
fun UShortArray.none(): Boolean
Returns true
if no elements match the given predicate.
fun <T> Array<out T>.none(predicate: (T) -> Boolean): Boolean
fun ByteArray.none(predicate: (Byte) -> Boolean): Boolean
fun ShortArray.none(predicate: (Short) -> Boolean): Boolean
fun IntArray.none(predicate: (Int) -> Boolean): Boolean
fun LongArray.none(predicate: (Long) -> Boolean): Boolean
fun FloatArray.none(predicate: (Float) -> Boolean): Boolean
fun DoubleArray.none(predicate: (Double) -> Boolean): Boolean
fun BooleanArray.none(
predicate: (Boolean) -> Boolean
): Boolean
fun CharArray.none(predicate: (Char) -> Boolean): Boolean
fun <T> Iterable<T>.none(predicate: (T) -> Boolean): Boolean
fun ULongArray.none(predicate: (ULong) -> Boolean): Boolean
fun UByteArray.none(predicate: (UByte) -> Boolean): Boolean
fun UShortArray.none(predicate: (UShort) -> Boolean): Boolean
Returns true
if the collection has no elements.
fun <T> Iterable<T>.none(): Boolean
Returns true
if the map has no entries.
fun <K, V> Map<out K, V>.none(): Boolean
onEach
orEmpty
Returns this Collection if it's not null
and the empty list otherwise.
fun <T> Collection<T>?.orEmpty(): Collection<T>
Returns this List if it's not null
and the empty list otherwise.
Returns the array if it's not null
, or an empty array otherwise.
fun <T> any_array<T>.orEmpty(): Array<out T>
partition
plus
Returns a list containing all elements of the original collection and then the given element.
operator fun <T> Collection<T>.plus(element: T): List<T>
Returns a list containing all elements of the original collection and then all elements of the given elements array.
operator fun <T> Collection<T>.plus(
elements: Array<out T>
): List<T>
Returns a list containing all elements of the original collection and then all elements of the given elements collection.
operator fun <T> Collection<T>.plus(
elements: Iterable<T>
): List<T>
Returns a list containing all elements of the original collection and then all elements of the given elements sequence.
operator fun <T> Collection<T>.plus(
elements: Sequence<T>
): List<T>
Returns a set containing all elements of the original set and then the given element if it isn't already in this set.
Returns a set containing all elements of the original set and the given elements array, which aren't already in this set.
Returns a set containing all elements of the original set and the given elements collection, which aren't already in this set. The returned set preserves the element iteration order of the original set.
Returns a set containing all elements of the original set and the given elements sequence, which aren't already in this set.
Returns an array containing all elements of the original array and then the given element.
operator fun ULongArray.plus(element: ULong): ULongArray
operator fun UByteArray.plus(element: UByte): UByteArray
operator fun UShortArray.plus(element: UShort): UShortArray
operator fun <T> Array<T>.plus(element: T): Array<T>
operator fun <T> Array<out T>.plus(element: T): Array<T>
operator fun ShortArray.plus(element: Short): ShortArray
operator fun FloatArray.plus(element: Float): FloatArray
operator fun DoubleArray.plus(element: Double): DoubleArray
operator fun BooleanArray.plus(
element: Boolean
): BooleanArray
Returns an array containing all elements of the original array and then all elements of the given elements collection.
operator fun UIntArray.plus(
elements: Collection<UInt>
): UIntArray
operator fun ULongArray.plus(
elements: Collection<ULong>
): ULongArray
operator fun UByteArray.plus(
elements: Collection<UByte>
): UByteArray
operator fun UShortArray.plus(
elements: Collection<UShort>
): UShortArray
operator fun <T> Array<T>.plus(
elements: Collection<T>
): Array<T>
operator fun <T> Array<out T>.plus(
elements: Collection<T>
): Array<T>
operator fun ByteArray.plus(
elements: Collection<Byte>
): ByteArray
operator fun ShortArray.plus(
elements: Collection<Short>
): ShortArray
operator fun IntArray.plus(
elements: Collection<Int>
): IntArray
operator fun LongArray.plus(
elements: Collection<Long>
): LongArray
operator fun FloatArray.plus(
elements: Collection<Float>
): FloatArray
operator fun DoubleArray.plus(
elements: Collection<Double>
): DoubleArray
operator fun BooleanArray.plus(
elements: Collection<Boolean>
): BooleanArray
operator fun CharArray.plus(
elements: Collection<Char>
): CharArray
Returns an array containing all elements of the original array and then all elements of the given elements array.
operator fun ULongArray.plus(
elements: ULongArray
): ULongArray
operator fun UByteArray.plus(
elements: UByteArray
): UByteArray
operator fun UShortArray.plus(
elements: UShortArray
): UShortArray
operator fun <T> Array<T>.plus(
elements: Array<out T>
): Array<T>
operator fun <T> Array<out T>.plus(
elements: Array<out T>
): Array<T>
operator fun ShortArray.plus(
elements: ShortArray
): ShortArray
operator fun FloatArray.plus(
elements: FloatArray
): FloatArray
operator fun DoubleArray.plus(
elements: DoubleArray
): DoubleArray
operator fun BooleanArray.plus(
elements: BooleanArray
): BooleanArray
Creates a new read-only map by replacing or adding an entry to this map from a given key-value pair.
Creates a new read-only map by replacing or adding entries to this map from a given collection of key-value pairs.
Creates a new read-only map by replacing or adding entries to this map from a given array of key-value pairs.
Creates a new read-only map by replacing or adding entries to this map from a given sequence of key-value pairs.
plusAssign
Appends or replaces the given pair in this mutable map.
operator fun <K, V> MutableMap<in K, in V>.plusAssign(
pair: Pair<K, V>)
Appends or replaces all pairs from the given collection of pairs in this mutable map.
operator fun <K, V> MutableMap<in K, in V>.plusAssign(
pairs: Iterable<Pair<K, V>>)
Appends or replaces all pairs from the given array of pairs in this mutable map.
operator fun <K, V> MutableMap<in K, in V>.plusAssign(
pairs: Array<out Pair<K, V>>)
Appends or replaces all pairs from the given sequence of pairs in this mutable map.
operator fun <K, V> MutableMap<in K, in V>.plusAssign(
pairs: Sequence<Pair<K, V>>)
Appends or replaces all entries from the given map in this mutable map.
operator fun <K, V> MutableMap<in K, in V>.plusAssign(
map: Map<K, V>)
Adds the specified element to this mutable collection.
operator fun <T> MutableCollection<in T>.plusAssign(
element: T)
Adds all elements of the given elements collection to this mutable collection.
operator fun <T> MutableCollection<in T>.plusAssign(
elements: Iterable<T>)
Adds all elements of the given elements array to this mutable collection.
operator fun <T> MutableCollection<in T>.plusAssign(
elements: Array<T>)
Adds all elements of the given elements sequence to this mutable collection.
operator fun <T> MutableCollection<in T>.plusAssign(
elements: Sequence<T>)
plusElement
Returns a list containing all elements of the original collection and then the given element.
fun <T> Collection<T>.plusElement(element: T): List<T>
Returns a set containing all elements of the original set and then the given element if it isn't already in this set.
Returns an array containing all elements of the original array and then the given element.
fun <T> any_array<T>.plusElement(element: T): Array<T>
putAll
Puts all the given pairs into this MutableMap with the first component in the pair being the key and the second the value.
fun <K, V> MutableMap<in K, in V>.putAll(
pairs: Array<out Pair<K, V>>)
Puts all the elements of the given collection into this MutableMap with the first component in the pair being the key and the second the value.
fun <K, V> MutableMap<in K, in V>.putAll(
pairs: Iterable<Pair<K, V>>)
Puts all the elements of the given sequence into this MutableMap with the first component in the pair being the key and the second the value.
fun <K, V> MutableMap<in K, in V>.putAll(
pairs: Sequence<Pair<K, V>>)
random
Returns a random element from this array.
fun <T> Array<out T>.random(): T
fun ByteArray.random(): Byte
fun ShortArray.random(): Short
fun IntArray.random(): Int
fun LongArray.random(): Long
fun FloatArray.random(): Float
fun DoubleArray.random(): Double
fun BooleanArray.random(): Boolean
fun CharArray.random(): Char
fun ULongArray.random(): ULong
fun UByteArray.random(): UByte
fun UShortArray.random(): UShort
Returns a random element from this array using the specified source of randomness.
fun <T> Array<out T>.random(random: Random): T
fun ShortArray.random(random: Random): Short
fun FloatArray.random(random: Random): Float
fun DoubleArray.random(random: Random): Double
fun BooleanArray.random(random: Random): Boolean
fun ULongArray.random(random: Random): ULong
fun UByteArray.random(random: Random): UByte
fun UShortArray.random(random: Random): UShort
Returns a random element from this collection.
fun <T> Collection<T>.random(): T
Returns a random element from this collection using the specified source of randomness.
fun <T> Collection<T>.random(random: Random): T
randomOrNull
Returns a random element from this array, or null
if this array is empty.
fun <T> Array<out T>.randomOrNull(): T?
fun ByteArray.randomOrNull(): Byte?
fun ShortArray.randomOrNull(): Short?
fun IntArray.randomOrNull(): Int?
fun LongArray.randomOrNull(): Long?
fun FloatArray.randomOrNull(): Float?
fun DoubleArray.randomOrNull(): Double?
fun BooleanArray.randomOrNull(): Boolean?
fun CharArray.randomOrNull(): Char?
fun ULongArray.randomOrNull(): ULong?
fun UByteArray.randomOrNull(): UByte?
fun UShortArray.randomOrNull(): UShort?
Returns a random element from this array using the specified source of randomness, or null
if this array is empty.
fun <T> Array<out T>.randomOrNull(random: Random): T?
fun ShortArray.randomOrNull(random: Random): Short?
fun FloatArray.randomOrNull(random: Random): Float?
fun DoubleArray.randomOrNull(random: Random): Double?
fun BooleanArray.randomOrNull(random: Random): Boolean?
fun ULongArray.randomOrNull(random: Random): ULong?
fun UByteArray.randomOrNull(random: Random): UByte?
fun UShortArray.randomOrNull(random: Random): UShort?
Returns a random element from this collection, or null
if this collection is empty.
fun <T> Collection<T>.randomOrNull(): T?
Returns a random element from this collection using the specified source of randomness, or null
if this collection is empty.
fun <T> Collection<T>.randomOrNull(random: Random): T?
reduce
Accumulates value starting with the first element and applying operation from left to right to current accumulator value and each element.
fun <S, T : S> Array<out T>.reduce(
operation: (acc: S, T) -> S
): S
fun ByteArray.reduce(
operation: (acc: Byte, Byte) -> Byte
): Byte
fun ShortArray.reduce(
operation: (acc: Short, Short) -> Short
): Short
fun IntArray.reduce(operation: (acc: Int, Int) -> Int): Int
fun LongArray.reduce(
operation: (acc: Long, Long) -> Long
): Long
fun FloatArray.reduce(
operation: (acc: Float, Float) -> Float
): Float
fun DoubleArray.reduce(
operation: (acc: Double, Double) -> Double
): Double
fun BooleanArray.reduce(
operation: (acc: Boolean, Boolean) -> Boolean
): Boolean
fun CharArray.reduce(
operation: (acc: Char, Char) -> Char
): Char
fun <S, T : S> Iterable<T>.reduce(
operation: (acc: S, T) -> S
): S
fun ULongArray.reduce(
operation: (acc: ULong, ULong) -> ULong
): ULong
fun UByteArray.reduce(
operation: (acc: UByte, UByte) -> UByte
): UByte
fun UShortArray.reduce(
operation: (acc: UShort, UShort) -> UShort
): UShort
Groups elements from the Grouping source by key and applies the reducing operation to the elements of each group sequentially starting from the second element of the group, passing the previously accumulated value and the current element as arguments, and stores the results in a new map. An initial value of accumulator is the first element of the group.
reduceIndexed
Accumulates value starting with the first element and applying operation from left to right to current accumulator value and each element with its index in the original array.
fun <S, T : S> Array<out T>.reduceIndexed(
operation: (index: Int, acc: S, T) -> S
): S
fun ByteArray.reduceIndexed(
operation: (index: Int, acc: Byte, Byte) -> Byte
): Byte
fun ShortArray.reduceIndexed(
operation: (index: Int, acc: Short, Short) -> Short
): Short
fun IntArray.reduceIndexed(
operation: (index: Int, acc: Int, Int) -> Int
): Int
fun LongArray.reduceIndexed(
operation: (index: Int, acc: Long, Long) -> Long
): Long
fun FloatArray.reduceIndexed(
operation: (index: Int, acc: Float, Float) -> Float
): Float
fun DoubleArray.reduceIndexed(
operation: (index: Int, acc: Double, Double) -> Double
): Double
fun BooleanArray.reduceIndexed(
operation: (index: Int, acc: Boolean, Boolean) -> Boolean
): Boolean
fun CharArray.reduceIndexed(
operation: (index: Int, acc: Char, Char) -> Char
): Char
fun ULongArray.reduceIndexed(
operation: (index: Int, acc: ULong, ULong) -> ULong
): ULong
fun UByteArray.reduceIndexed(
operation: (index: Int, acc: UByte, UByte) -> UByte
): UByte
fun UShortArray.reduceIndexed(
operation: (index: Int, acc: UShort, UShort) -> UShort
): UShort
reduceOrNull
Accumulates value starting with the first element and applying operation from left to right to current accumulator value and each element. Returns null if the array is empty.
fun <S, T : S> Array<out T>.reduceOrNull(
operation: (acc: S, T) -> S
): S?
fun ByteArray.reduceOrNull(
operation: (acc: Byte, Byte) -> Byte
): Byte?
fun ShortArray.reduceOrNull(
operation: (acc: Short, Short) -> Short
): Short?
fun IntArray.reduceOrNull(
operation: (acc: Int, Int) -> Int
): Int?
fun LongArray.reduceOrNull(
operation: (acc: Long, Long) -> Long
): Long?
fun FloatArray.reduceOrNull(
operation: (acc: Float, Float) -> Float
): Float?
fun DoubleArray.reduceOrNull(
operation: (acc: Double, Double) -> Double
): Double?
fun BooleanArray.reduceOrNull(
operation: (acc: Boolean, Boolean) -> Boolean
): Boolean?
fun CharArray.reduceOrNull(
operation: (acc: Char, Char) -> Char
): Char?
fun ULongArray.reduceOrNull(
operation: (acc: ULong, ULong) -> ULong
): ULong?
fun UByteArray.reduceOrNull(
operation: (acc: UByte, UByte) -> UByte
): UByte?
fun UShortArray.reduceOrNull(
operation: (acc: UShort, UShort) -> UShort
): UShort?
reduceRight
Accumulates value starting with last element and applying operation from right to left to each element and current accumulator value.
fun <S, T : S> Array<out T>.reduceRight(
operation: (T, acc: S) -> S
): S
fun ByteArray.reduceRight(
operation: (Byte, acc: Byte) -> Byte
): Byte
fun ShortArray.reduceRight(
operation: (Short, acc: Short) -> Short
): Short
fun IntArray.reduceRight(
operation: (Int, acc: Int) -> Int
): Int
fun LongArray.reduceRight(
operation: (Long, acc: Long) -> Long
): Long
fun FloatArray.reduceRight(
operation: (Float, acc: Float) -> Float
): Float
fun DoubleArray.reduceRight(
operation: (Double, acc: Double) -> Double
): Double
fun BooleanArray.reduceRight(
operation: (Boolean, acc: Boolean) -> Boolean
): Boolean
fun CharArray.reduceRight(
operation: (Char, acc: Char) -> Char
): Char
fun <S, T : S> List<T>.reduceRight(
operation: (T, acc: S) -> S
): S
fun ULongArray.reduceRight(
operation: (ULong, acc: ULong) -> ULong
): ULong
fun UByteArray.reduceRight(
operation: (UByte, acc: UByte) -> UByte
): UByte
fun UShortArray.reduceRight(
operation: (UShort, acc: UShort) -> UShort
): UShort
reduceRightIndexed
Accumulates value starting with last element and applying operation from right to left to each element with its index in the original array and current accumulator value.
fun <S, T : S> Array<out T>.reduceRightIndexed(
operation: (index: Int, T, acc: S) -> S
): S
fun ByteArray.reduceRightIndexed(
operation: (index: Int, Byte, acc: Byte) -> Byte
): Byte
fun ShortArray.reduceRightIndexed(
operation: (index: Int, Short, acc: Short) -> Short
): Short
fun IntArray.reduceRightIndexed(
operation: (index: Int, Int, acc: Int) -> Int
): Int
fun LongArray.reduceRightIndexed(
operation: (index: Int, Long, acc: Long) -> Long
): Long
fun FloatArray.reduceRightIndexed(
operation: (index: Int, Float, acc: Float) -> Float
): Float
fun DoubleArray.reduceRightIndexed(
operation: (index: Int, Double, acc: Double) -> Double
): Double
fun BooleanArray.reduceRightIndexed(
operation: (index: Int, Boolean, acc: Boolean) -> Boolean
): Boolean
fun CharArray.reduceRightIndexed(
operation: (index: Int, Char, acc: Char) -> Char
): Char
fun ULongArray.reduceRightIndexed(
operation: (index: Int, ULong, acc: ULong) -> ULong
): ULong
fun UByteArray.reduceRightIndexed(
operation: (index: Int, UByte, acc: UByte) -> UByte
): UByte
fun UShortArray.reduceRightIndexed(
operation: (index: Int, UShort, acc: UShort) -> UShort
): UShort
reduceRightOrNull
Accumulates value starting with last element and applying operation from right to left to each element and current accumulator value. Returns null if the array is empty.
fun <S, T : S> Array<out T>.reduceRightOrNull(
operation: (T, acc: S) -> S
): S?
fun ByteArray.reduceRightOrNull(
operation: (Byte, acc: Byte) -> Byte
): Byte?
fun ShortArray.reduceRightOrNull(
operation: (Short, acc: Short) -> Short
): Short?
fun IntArray.reduceRightOrNull(
operation: (Int, acc: Int) -> Int
): Int?
fun LongArray.reduceRightOrNull(
operation: (Long, acc: Long) -> Long
): Long?
fun FloatArray.reduceRightOrNull(
operation: (Float, acc: Float) -> Float
): Float?
fun DoubleArray.reduceRightOrNull(
operation: (Double, acc: Double) -> Double
): Double?
fun BooleanArray.reduceRightOrNull(
operation: (Boolean, acc: Boolean) -> Boolean
): Boolean?
fun CharArray.reduceRightOrNull(
operation: (Char, acc: Char) -> Char
): Char?
fun ULongArray.reduceRightOrNull(
operation: (ULong, acc: ULong) -> ULong
): ULong?
fun UByteArray.reduceRightOrNull(
operation: (UByte, acc: UByte) -> UByte
): UByte?
fun UShortArray.reduceRightOrNull(
operation: (UShort, acc: UShort) -> UShort
): UShort?
reduceTo
Groups elements from the Grouping source by key and applies the reducing operation to the elements of each group sequentially starting from the second element of the group, passing the previously accumulated value and the current element as arguments, and stores the results in the given destination map. An initial value of accumulator is the first element of the group.
fun <S, T : S, K, M : MutableMap<in K, S>> Grouping<T, K>.reduceTo(
destination: M,
operation: (key: K, accumulator: S, element: T) -> S
): M
remove
Removes the specified key and its corresponding value from this map.
fun <K, V> MutableMap<out K, V>.remove(key: K): V?
Removes a single instance of the specified element from this collection, if it is present.
fun <T> MutableCollection<out T>.remove(element: T): Boolean
Removes the element at the specified index from this list. In Kotlin one should use the MutableList.removeAt function instead.
fun <T> MutableList<T>.remove(index: Int): T
Removes the entry for the specified key only if it is currently mapped to the specified value.
fun <K, V> MutableMap<out K, out V>.remove(
key: K,
value: V
): Boolean
removeAll
Removes all of this collection's elements that are also contained in the specified collection.
fun <T> MutableCollection<out T>.removeAll(
elements: Collection<T>
): Boolean
Removes all elements from this MutableCollection that are also contained in the given elements collection.
fun <T> MutableCollection<in T>.removeAll(
elements: Iterable<T>
): Boolean
Removes all elements from this MutableCollection that are also contained in the given elements sequence.
fun <T> MutableCollection<in T>.removeAll(
elements: Sequence<T>
): Boolean
Removes all elements from this MutableCollection that are also contained in the given elements array.
fun <T> MutableCollection<in T>.removeAll(
elements: Array<out T>
): Boolean
Removes all elements from this MutableIterable that match the given predicate.
fun <T> MutableIterable<T>.removeAll(
predicate: (T) -> Boolean
): Boolean
Removes all elements from this MutableList that match the given predicate.
fun <T> MutableList<T>.removeAll(
predicate: (T) -> Boolean
): Boolean
removeFirst
Removes the first element from this mutable list and returns that removed element, or throws NoSuchElementException if this list is empty.
fun <T> MutableList<T>.removeFirst(): T
removeFirstOrNull
Removes the first element from this mutable list and returns that removed element, or returns null
if this list is empty.
fun <T> MutableList<T>.removeFirstOrNull(): T?
removeLast
Removes the last element from this mutable list and returns that removed element, or throws NoSuchElementException if this list is empty.
fun <T> MutableList<T>.removeLast(): T
removeLastOrNull
Removes the last element from this mutable list and returns that removed element, or returns null
if this list is empty.
fun <T> MutableList<T>.removeLastOrNull(): T?
replaceAll
Replaces each element in the list with a result of a transformation specified.
fun <T> MutableList<T>.replaceAll(transformation: (T) -> T)
requireNoNulls
Returns an original collection containing all the non-null
elements, throwing an IllegalArgumentException if there are any null
elements.
fun <T : Any> Array<T?>.requireNoNulls(): Array<T>
retainAll
Retains only the elements in this collection that are contained in the specified collection.
fun <T> MutableCollection<out T>.retainAll(
elements: Collection<T>
): Boolean
Retains only elements of this MutableCollection that are contained in the given elements collection.
fun <T> MutableCollection<in T>.retainAll(
elements: Iterable<T>
): Boolean
Retains only elements of this MutableCollection that are contained in the given elements array.
fun <T> MutableCollection<in T>.retainAll(
elements: Array<out T>
): Boolean
Retains only elements of this MutableCollection that are contained in the given elements sequence.
fun <T> MutableCollection<in T>.retainAll(
elements: Sequence<T>
): Boolean
Retains only elements of this MutableIterable that match the given predicate.
fun <T> MutableIterable<T>.retainAll(
predicate: (T) -> Boolean
): Boolean
Retains only elements of this MutableList that match the given predicate.
fun <T> MutableList<T>.retainAll(
predicate: (T) -> Boolean
): Boolean
reverse
Reverses elements in the array in-place.
fun <T> Array<T>.reverse()
fun ByteArray.reverse()
fun ShortArray.reverse()
fun IntArray.reverse()
fun LongArray.reverse()
fun FloatArray.reverse()
fun DoubleArray.reverse()
fun BooleanArray.reverse()
fun CharArray.reverse()
fun UIntArray.reverse()
fun ULongArray.reverse()
fun UByteArray.reverse()
fun UShortArray.reverse()
Reverses elements in the list in-place.
fun <T> MutableList<T>.reverse()
reversed
Returns a list with elements in reversed order.
fun <T> Array<out T>.reversed(): List<T>
fun ShortArray.reversed(): List<Short>
fun FloatArray.reversed(): List<Float>
fun DoubleArray.reversed(): List<Double>
fun BooleanArray.reversed(): List<Boolean>
fun ULongArray.reversed(): List<ULong>
fun UByteArray.reversed(): List<UByte>
fun UShortArray.reversed(): List<UShort>
reversedArray
Returns an array with elements of this array in reversed order.
fun <T> Array<T>.reversedArray(): Array<T>
fun ShortArray.reversedArray(): ShortArray
fun FloatArray.reversedArray(): FloatArray
fun DoubleArray.reversedArray(): DoubleArray
fun BooleanArray.reversedArray(): BooleanArray
fun ULongArray.reversedArray(): ULongArray
fun UByteArray.reversedArray(): UByteArray
fun UShortArray.reversedArray(): UShortArray
scan
Returns a list containing successive accumulation values generated by applying operation from left to right to each element and current accumulator value that starts with initial value.
fun <T, R> Array<out T>.scan(
initial: R,
operation: (acc: R, T) -> R
): List<R>
fun <R> ShortArray.scan(
initial: R,
operation: (acc: R, Short) -> R
): List<R>
fun <R> FloatArray.scan(
initial: R,
operation: (acc: R, Float) -> R
): List<R>
fun <R> DoubleArray.scan(
initial: R,
operation: (acc: R, Double) -> R
): List<R>
fun <R> BooleanArray.scan(
initial: R,
operation: (acc: R, Boolean) -> R
): List<R>
fun <R> ULongArray.scan(
initial: R,
operation: (acc: R, ULong) -> R
): List<R>
fun <R> UByteArray.scan(
initial: R,
operation: (acc: R, UByte) -> R
): List<R>
fun <R> UShortArray.scan(
initial: R,
operation: (acc: R, UShort) -> R
): List<R>
scanIndexed
Returns a list containing successive accumulation values generated by applying operation from left to right to each element, its index in the original array and current accumulator value that starts with initial value.
fun <T, R> Array<out T>.scanIndexed(
initial: R,
operation: (index: Int, acc: R, T) -> R
): List<R>
fun <R> ShortArray.scanIndexed(
initial: R,
operation: (index: Int, acc: R, Short) -> R
): List<R>
fun <R> FloatArray.scanIndexed(
initial: R,
operation: (index: Int, acc: R, Float) -> R
): List<R>
fun <R> DoubleArray.scanIndexed(
initial: R,
operation: (index: Int, acc: R, Double) -> R
): List<R>
fun <R> BooleanArray.scanIndexed(
initial: R,
operation: (index: Int, acc: R, Boolean) -> R
): List<R>
fun <R> ULongArray.scanIndexed(
initial: R,
operation: (index: Int, acc: R, ULong) -> R
): List<R>
fun <R> UByteArray.scanIndexed(
initial: R,
operation: (index: Int, acc: R, UByte) -> R
): List<R>
fun <R> UShortArray.scanIndexed(
initial: R,
operation: (index: Int, acc: R, UShort) -> R
): List<R>
scanReduce
Returns a list containing successive accumulation values generated by applying operation from left to right to each element and current accumulator value that starts with the first element of this array.
fun <S, T : S> Array<out T>.scanReduce(
operation: (acc: S, T) -> S
): List<S>
fun ShortArray.scanReduce(
operation: (acc: Short, Short) -> Short
): List<Short>
fun FloatArray.scanReduce(
operation: (acc: Float, Float) -> Float
): List<Float>
fun DoubleArray.scanReduce(
operation: (acc: Double, Double) -> Double
): List<Double>
fun BooleanArray.scanReduce(
operation: (acc: Boolean, Boolean) -> Boolean
): List<Boolean>
scanReduceIndexed
Returns a list containing successive accumulation values generated by applying operation from left to right to each element, its index in the original array and current accumulator value that starts with the first element of this array.
fun <S, T : S> Array<out T>.scanReduceIndexed(
operation: (index: Int, acc: S, T) -> S
): List<S>
fun ShortArray.scanReduceIndexed(
operation: (index: Int, acc: Short, Short) -> Short
): List<Short>
fun FloatArray.scanReduceIndexed(
operation: (index: Int, acc: Float, Float) -> Float
): List<Float>
fun DoubleArray.scanReduceIndexed(
operation: (index: Int, acc: Double, Double) -> Double
): List<Double>
fun BooleanArray.scanReduceIndexed(
operation: (index: Int, acc: Boolean, Boolean) -> Boolean
): List<Boolean>
Returns a list containing successive accumulation values generated by applying operation from left to right to each element, its index in the original collection and current accumulator value that starts with the first element of this collection.
set
Allows to use the index operator for storing values in a mutable map.
operator fun <K, V> MutableMap<K, V>.set(key: K, value: V)
setOf
Returns a new read-only set with the given elements. Elements of the set are iterated in the order they were specified. The returned set is serializable (JVM).
fun <T> setOf(vararg elements: T): Set<T>
Returns an empty read-only set. The returned set is serializable (JVM).
fun <T> setOf(): Set<T>
setValue
Stores the value of the property for the given object in this mutable map.
operator fun <V> MutableMap<in String, in V>.setValue(
thisRef: Any?,
property: KProperty<*>,
value: V)
shuffle
Randomly shuffles elements in this mutable list using the specified random instance as the source of randomness.
fun <T> MutableList<T>.shuffle(random: Random)
fun <T> MutableList<T>.shuffle(random: Random)
Randomly shuffles elements in this mutable list.
fun <T> MutableList<T>.shuffle()
shuffled
Returns a new list with the elements of this list randomly shuffled using the specified random instance as the source of randomness.
single
Returns the single element, or throws an exception if the array is empty or has more than one element.
fun <T> Array<out T>.single(): T
fun ByteArray.single(): Byte
fun ShortArray.single(): Short
fun IntArray.single(): Int
fun LongArray.single(): Long
fun FloatArray.single(): Float
fun DoubleArray.single(): Double
fun BooleanArray.single(): Boolean
fun CharArray.single(): Char
fun ULongArray.single(): ULong
fun UByteArray.single(): UByte
fun UShortArray.single(): UShort
Returns the single element matching the given predicate, or throws exception if there is no or more than one matching element.
fun <T> Array<out T>.single(predicate: (T) -> Boolean): T
fun ByteArray.single(predicate: (Byte) -> Boolean): Byte
fun ShortArray.single(predicate: (Short) -> Boolean): Short
fun IntArray.single(predicate: (Int) -> Boolean): Int
fun LongArray.single(predicate: (Long) -> Boolean): Long
fun FloatArray.single(predicate: (Float) -> Boolean): Float
fun DoubleArray.single(
predicate: (Double) -> Boolean
): Double
fun BooleanArray.single(
predicate: (Boolean) -> Boolean
): Boolean
fun CharArray.single(predicate: (Char) -> Boolean): Char
fun <T> Iterable<T>.single(predicate: (T) -> Boolean): T
fun ULongArray.single(predicate: (ULong) -> Boolean): ULong
fun UByteArray.single(predicate: (UByte) -> Boolean): UByte
fun UShortArray.single(
predicate: (UShort) -> Boolean
): UShort
Returns the single element, or throws an exception if the collection is empty or has more than one element.
fun <T> Iterable<T>.single(): T
Returns the single element, or throws an exception if the list is empty or has more than one element.
fun <T> List<T>.single(): T
singleOrNull
Returns single element, or null
if the array is empty or has more than one element.
fun <T> Array<out T>.singleOrNull(): T?
fun ByteArray.singleOrNull(): Byte?
fun ShortArray.singleOrNull(): Short?
fun IntArray.singleOrNull(): Int?
fun LongArray.singleOrNull(): Long?
fun FloatArray.singleOrNull(): Float?
fun DoubleArray.singleOrNull(): Double?
fun BooleanArray.singleOrNull(): Boolean?
fun CharArray.singleOrNull(): Char?
fun ULongArray.singleOrNull(): ULong?
fun UByteArray.singleOrNull(): UByte?
fun UShortArray.singleOrNull(): UShort?
Returns the single element matching the given predicate, or null
if element was not found or more than one element was found.
fun <T> Array<out T>.singleOrNull(
predicate: (T) -> Boolean
): T?
fun ByteArray.singleOrNull(
predicate: (Byte) -> Boolean
): Byte?
fun ShortArray.singleOrNull(
predicate: (Short) -> Boolean
): Short?
fun IntArray.singleOrNull(predicate: (Int) -> Boolean): Int?
fun LongArray.singleOrNull(
predicate: (Long) -> Boolean
): Long?
fun FloatArray.singleOrNull(
predicate: (Float) -> Boolean
): Float?
fun DoubleArray.singleOrNull(
predicate: (Double) -> Boolean
): Double?
fun BooleanArray.singleOrNull(
predicate: (Boolean) -> Boolean
): Boolean?
fun CharArray.singleOrNull(
predicate: (Char) -> Boolean
): Char?
fun <T> Iterable<T>.singleOrNull(
predicate: (T) -> Boolean
): T?
fun ULongArray.singleOrNull(
predicate: (ULong) -> Boolean
): ULong?
fun UByteArray.singleOrNull(
predicate: (UByte) -> Boolean
): UByte?
fun UShortArray.singleOrNull(
predicate: (UShort) -> Boolean
): UShort?
Returns single element, or null
if the collection is empty or has more than one element.
fun <T> Iterable<T>.singleOrNull(): T?
Returns single element, or null
if the list is empty or has more than one element.
fun <T> List<T>.singleOrNull(): T?
slice
Returns a list containing elements at indices in the specified indices range.
fun ShortArray.slice(indices: IntRange): List<Short>
fun FloatArray.slice(indices: IntRange): List<Float>
fun DoubleArray.slice(indices: IntRange): List<Double>
fun BooleanArray.slice(indices: IntRange): List<Boolean>
fun ULongArray.slice(indices: IntRange): List<ULong>
fun UByteArray.slice(indices: IntRange): List<UByte>
fun UShortArray.slice(indices: IntRange): List<UShort>
Returns a list containing elements at specified indices.
fun ShortArray.slice(indices: Iterable<Int>): List<Short>
fun FloatArray.slice(indices: Iterable<Int>): List<Float>
fun DoubleArray.slice(indices: Iterable<Int>): List<Double>
fun BooleanArray.slice(indices: Iterable<Int>): List<Boolean>
fun ULongArray.slice(indices: Iterable<Int>): List<ULong>
fun UByteArray.slice(indices: Iterable<Int>): List<UByte>
fun UShortArray.slice(indices: Iterable<Int>): List<UShort>
sliceArray
Returns an array containing elements of this array at specified indices.
fun <T> Array<T>.sliceArray(
indices: Collection<Int>
): Array<T>
fun ByteArray.sliceArray(indices: Collection<Int>): ByteArray
fun ShortArray.sliceArray(
indices: Collection<Int>
): ShortArray
fun IntArray.sliceArray(indices: Collection<Int>): IntArray
fun LongArray.sliceArray(indices: Collection<Int>): LongArray
fun FloatArray.sliceArray(
indices: Collection<Int>
): FloatArray
fun DoubleArray.sliceArray(
indices: Collection<Int>
): DoubleArray
fun BooleanArray.sliceArray(
indices: Collection<Int>
): BooleanArray
fun CharArray.sliceArray(indices: Collection<Int>): CharArray
fun UIntArray.sliceArray(indices: Collection<Int>): UIntArray
fun ULongArray.sliceArray(
indices: Collection<Int>
): ULongArray
fun UByteArray.sliceArray(
indices: Collection<Int>
): UByteArray
fun UShortArray.sliceArray(
indices: Collection<Int>
): UShortArray
Returns an array containing elements at indices in the specified indices range.
fun <T> Array<T>.sliceArray(indices: IntRange): Array<T>
fun ShortArray.sliceArray(indices: IntRange): ShortArray
fun FloatArray.sliceArray(indices: IntRange): FloatArray
fun DoubleArray.sliceArray(indices: IntRange): DoubleArray
fun BooleanArray.sliceArray(indices: IntRange): BooleanArray
fun ULongArray.sliceArray(indices: IntRange): ULongArray
fun UByteArray.sliceArray(indices: IntRange): UByteArray
fun UShortArray.sliceArray(indices: IntRange): UShortArray
sort
Sorts the array in-place.
fun UIntArray.sort()
fun ULongArray.sort()
fun UByteArray.sort()
fun UShortArray.sort()
fun IntArray.sort()
fun LongArray.sort()
fun ByteArray.sort()
fun ShortArray.sort()
fun DoubleArray.sort()
fun FloatArray.sort()
fun CharArray.sort()
Sorts a range in the array in-place.
fun <T> any_array<T>.sort(
fromIndex: Int = 0,
toIndex: Int = size)
fun <T> MutableList<T>.sort(comparator: Comparator<in T>)
fun <T> MutableList<T>.sort(comparison: (T, T) -> Int)
Sorts the array in-place according to the order specified by the given comparison function.
fun <T> any_array<T>.sort(comparison: (a: T, b: T) -> Int)
Sorts the array in-place according to the natural order of its elements.
fun <T : Comparable<T>> any_array<T>.sort()
Sorts elements in the list in-place according to their natural sort order.
fun <T : Comparable<T>> MutableList<T>.sort()
sortBy
Sorts elements in the array in-place according to natural sort order of the value returned by specified selector function.
fun <T, R : Comparable<R>> Array<out T>.sortBy(
selector: (T) -> R?)
Sorts elements in the list in-place according to natural sort order of the value returned by specified selector function.
fun <T, R : Comparable<R>> MutableList<T>.sortBy(
selector: (T) -> R?)
sortByDescending
Sorts elements in the array in-place descending according to natural sort order of the value returned by specified selector function.
fun <T, R : Comparable<R>> Array<out T>.sortByDescending(
selector: (T) -> R?)
Sorts elements in the list in-place descending according to natural sort order of the value returned by specified selector function.
fun <T, R : Comparable<R>> MutableList<T>.sortByDescending(
selector: (T) -> R?)
sortDescending
Sorts elements in the array in-place descending according to their natural sort order.
fun <T : Comparable<T>> Array<out T>.sortDescending()
fun ByteArray.sortDescending()
fun ShortArray.sortDescending()
fun IntArray.sortDescending()
fun LongArray.sortDescending()
fun FloatArray.sortDescending()
fun DoubleArray.sortDescending()
fun CharArray.sortDescending()
fun UIntArray.sortDescending()
fun ULongArray.sortDescending()
fun UByteArray.sortDescending()
fun UShortArray.sortDescending()
Sorts elements in the list in-place descending according to their natural sort order.
fun <T : Comparable<T>> MutableList<T>.sortDescending()
sorted
Returns a list of all elements sorted according to their natural sort order.
fun <T : Comparable<T>> Array<out T>.sorted(): List<T>
fun ShortArray.sorted(): List<Short>
fun FloatArray.sorted(): List<Float>
fun DoubleArray.sorted(): List<Double>
fun <T : Comparable<T>> Iterable<T>.sorted(): List<T>
fun ULongArray.sorted(): List<ULong>
fun UByteArray.sorted(): List<UByte>
fun UShortArray.sorted(): List<UShort>
sortedArray
Returns an array with all elements of this array sorted according to their natural sort order.
fun <T : Comparable<T>> Array<T>.sortedArray(): Array<T>
fun ShortArray.sortedArray(): ShortArray
fun FloatArray.sortedArray(): FloatArray
fun DoubleArray.sortedArray(): DoubleArray
fun ULongArray.sortedArray(): ULongArray
fun UByteArray.sortedArray(): UByteArray
fun UShortArray.sortedArray(): UShortArray
sortedArrayDescending
Returns an array with all elements of this array sorted descending according to their natural sort order.
fun <T : Comparable<T>> Array<T>.sortedArrayDescending(): Array<T>
fun ShortArray.sortedArrayDescending(): ShortArray
fun FloatArray.sortedArrayDescending(): FloatArray
fun DoubleArray.sortedArrayDescending(): DoubleArray
fun ULongArray.sortedArrayDescending(): ULongArray
fun UByteArray.sortedArrayDescending(): UByteArray
fun UShortArray.sortedArrayDescending(): UShortArray
sortedArrayWith
Returns an array with all elements of this array sorted according the specified comparator.
fun <T> Array<out T>.sortedArrayWith(
comparator: Comparator<in T>
): Array<out T>
sortedBy
Returns a list of all elements sorted according to natural sort order of the value returned by specified selector function.
fun <T, R : Comparable<R>> Array<out T>.sortedBy(
selector: (T) -> R?
): List<T>
fun <R : Comparable<R>> ByteArray.sortedBy(
selector: (Byte) -> R?
): List<Byte>
fun <R : Comparable<R>> ShortArray.sortedBy(
selector: (Short) -> R?
): List<Short>
fun <R : Comparable<R>> IntArray.sortedBy(
selector: (Int) -> R?
): List<Int>
fun <R : Comparable<R>> LongArray.sortedBy(
selector: (Long) -> R?
): List<Long>
fun <R : Comparable<R>> FloatArray.sortedBy(
selector: (Float) -> R?
): List<Float>
fun <R : Comparable<R>> DoubleArray.sortedBy(
selector: (Double) -> R?
): List<Double>
fun <R : Comparable<R>> BooleanArray.sortedBy(
selector: (Boolean) -> R?
): List<Boolean>
fun <R : Comparable<R>> CharArray.sortedBy(
selector: (Char) -> R?
): List<Char>
fun <T, R : Comparable<R>> Iterable<T>.sortedBy(
selector: (T) -> R?
): List<T>
sortedByDescending
Returns a list of all elements sorted descending according to natural sort order of the value returned by specified selector function.
fun <T, R : Comparable<R>> Array<out T>.sortedByDescending(
selector: (T) -> R?
): List<T>
fun <R : Comparable<R>> ByteArray.sortedByDescending(
selector: (Byte) -> R?
): List<Byte>
fun <R : Comparable<R>> ShortArray.sortedByDescending(
selector: (Short) -> R?
): List<Short>
fun <R : Comparable<R>> IntArray.sortedByDescending(
selector: (Int) -> R?
): List<Int>
fun <R : Comparable<R>> LongArray.sortedByDescending(
selector: (Long) -> R?
): List<Long>
fun <R : Comparable<R>> FloatArray.sortedByDescending(
selector: (Float) -> R?
): List<Float>
fun <R : Comparable<R>> DoubleArray.sortedByDescending(
selector: (Double) -> R?
): List<Double>
fun <R : Comparable<R>> BooleanArray.sortedByDescending(
selector: (Boolean) -> R?
): List<Boolean>
fun <R : Comparable<R>> CharArray.sortedByDescending(
selector: (Char) -> R?
): List<Char>
fun <T, R : Comparable<R>> Iterable<T>.sortedByDescending(
selector: (T) -> R?
): List<T>
sortedDescending
Returns a list of all elements sorted descending according to their natural sort order.
fun <T : Comparable<T>> Array<out T>.sortedDescending(): List<T>
fun ShortArray.sortedDescending(): List<Short>
fun FloatArray.sortedDescending(): List<Float>
fun DoubleArray.sortedDescending(): List<Double>
fun <T : Comparable<T>> Iterable<T>.sortedDescending(): List<T>
fun ULongArray.sortedDescending(): List<ULong>
fun UByteArray.sortedDescending(): List<UByte>
fun UShortArray.sortedDescending(): List<UShort>
sortedMapOf
Returns a new SortedMap with the specified contents, given as a list of pairs where the first value is the key and the second is the value.
fun <K : Comparable<K>, V> sortedMapOf(
vararg pairs: Pair<K, V>
): SortedMap<K, V>
sortedSetOf
Returns a new java.util.SortedSet with the given elements.
fun <T> sortedSetOf(vararg elements: T): TreeSet<T>
Returns a new java.util.SortedSet with the given comparator and elements.
fun <T> sortedSetOf(
comparator: Comparator<in T>,
vararg elements: T
): TreeSet<T>
sortedWith
Returns a list of all elements sorted according to the specified comparator.
fun <T> Array<out T>.sortedWith(
comparator: Comparator<in T>
): List<T>
fun ByteArray.sortedWith(
comparator: Comparator<in Byte>
): List<Byte>
fun ShortArray.sortedWith(
comparator: Comparator<in Short>
): List<Short>
fun IntArray.sortedWith(
comparator: Comparator<in Int>
): List<Int>
fun LongArray.sortedWith(
comparator: Comparator<in Long>
): List<Long>
fun FloatArray.sortedWith(
comparator: Comparator<in Float>
): List<Float>
fun DoubleArray.sortedWith(
comparator: Comparator<in Double>
): List<Double>
fun BooleanArray.sortedWith(
comparator: Comparator<in Boolean>
): List<Boolean>
fun CharArray.sortedWith(
comparator: Comparator<in Char>
): List<Char>
fun <T> Iterable<T>.sortedWith(
comparator: Comparator<in T>
): List<T>
sortWith
Sorts the array in-place according to the order specified by the given comparator.
fun <T> any_array<T>.sortWith(comparator: Comparator<in T>)
Sorts a range in the array in-place with the given comparator.
fun <T> any_array<T>.sortWith(
comparator: Comparator<in T>,
fromIndex: Int = 0,
toIndex: Int = size)
Sorts elements in the list in-place according to the order specified with comparator.
fun <T> MutableList<T>.sortWith(comparator: Comparator<in T>)
fun <T> MutableList<T>.sortWith(comparator: Comparator<in T>)
subarrayContentToString
Returns a string representation of the contents of the subarray of the specified array as if it is List.
fun <T> Array<out T>.subarrayContentToString(
offset: Int,
length: Int
): String
subtract
Returns a set containing all elements that are contained by this array and not contained by the specified collection.
sum
Returns the sum of all elements in the array.
fun Array<out Byte>.sum(): Int
fun Array<out Short>.sum(): Int
fun Array<out Int>.sum(): Int
fun Array<out Long>.sum(): Long
fun Array<out Float>.sum(): Float
fun Array<out Double>.sum(): Double
fun ByteArray.sum(): Int
fun ShortArray.sum(): Int
fun IntArray.sum(): Int
fun LongArray.sum(): Long
fun FloatArray.sum(): Float
fun DoubleArray.sum(): Double
fun ULongArray.sum(): ULong
fun UByteArray.sum(): UInt
fun UShortArray.sum(): UInt
sumBy
Returns the sum of all values produced by selector function applied to each element in the array.
fun <T> Array<out T>.sumBy(selector: (T) -> Int): Int
fun ByteArray.sumBy(selector: (Byte) -> Int): Int
fun ShortArray.sumBy(selector: (Short) -> Int): Int
fun IntArray.sumBy(selector: (Int) -> Int): Int
fun LongArray.sumBy(selector: (Long) -> Int): Int
fun FloatArray.sumBy(selector: (Float) -> Int): Int
fun DoubleArray.sumBy(selector: (Double) -> Int): Int
fun BooleanArray.sumBy(selector: (Boolean) -> Int): Int
fun CharArray.sumBy(selector: (Char) -> Int): Int
fun ULongArray.sumBy(selector: (ULong) -> UInt): UInt
fun UByteArray.sumBy(selector: (UByte) -> UInt): UInt
fun UShortArray.sumBy(selector: (UShort) -> UInt): UInt
sumByDouble
Returns the sum of all values produced by selector function applied to each element in the array.
fun <T> Array<out T>.sumByDouble(
selector: (T) -> Double
): Double
fun ByteArray.sumByDouble(selector: (Byte) -> Double): Double
fun ShortArray.sumByDouble(
selector: (Short) -> Double
): Double
fun IntArray.sumByDouble(selector: (Int) -> Double): Double
fun LongArray.sumByDouble(selector: (Long) -> Double): Double
fun FloatArray.sumByDouble(
selector: (Float) -> Double
): Double
fun DoubleArray.sumByDouble(
selector: (Double) -> Double
): Double
fun BooleanArray.sumByDouble(
selector: (Boolean) -> Double
): Double
fun CharArray.sumByDouble(selector: (Char) -> Double): Double
fun ULongArray.sumByDouble(
selector: (ULong) -> Double
): Double
fun UByteArray.sumByDouble(
selector: (UByte) -> Double
): Double
fun UShortArray.sumByDouble(
selector: (UShort) -> Double
): Double
take
Returns a list containing first n elements.
fun <T> Array<out T>.take(n: Int): List<T>
fun ShortArray.take(n: Int): List<Short>
fun FloatArray.take(n: Int): List<Float>
fun DoubleArray.take(n: Int): List<Double>
fun BooleanArray.take(n: Int): List<Boolean>
fun ULongArray.take(n: Int): List<ULong>
fun UByteArray.take(n: Int): List<UByte>
fun UShortArray.take(n: Int): List<UShort>
takeLast
Returns a list containing last n elements.
fun <T> Array<out T>.takeLast(n: Int): List<T>
fun ShortArray.takeLast(n: Int): List<Short>
fun FloatArray.takeLast(n: Int): List<Float>
fun DoubleArray.takeLast(n: Int): List<Double>
fun BooleanArray.takeLast(n: Int): List<Boolean>
fun ULongArray.takeLast(n: Int): List<ULong>
fun UByteArray.takeLast(n: Int): List<UByte>
fun UShortArray.takeLast(n: Int): List<UShort>
takeLastWhile
Returns a list containing last elements satisfying the given predicate.
fun <T> Array<out T>.takeLastWhile(
predicate: (T) -> Boolean
): List<T>
fun ShortArray.takeLastWhile(
predicate: (Short) -> Boolean
): List<Short>
fun FloatArray.takeLastWhile(
predicate: (Float) -> Boolean
): List<Float>
fun DoubleArray.takeLastWhile(
predicate: (Double) -> Boolean
): List<Double>
fun BooleanArray.takeLastWhile(
predicate: (Boolean) -> Boolean
): List<Boolean>
fun ULongArray.takeLastWhile(
predicate: (ULong) -> Boolean
): List<ULong>
fun UByteArray.takeLastWhile(
predicate: (UByte) -> Boolean
): List<UByte>
fun UShortArray.takeLastWhile(
predicate: (UShort) -> Boolean
): List<UShort>
takeWhile
Returns a list containing first elements satisfying the given predicate.
fun <T> Array<out T>.takeWhile(
predicate: (T) -> Boolean
): List<T>
fun ShortArray.takeWhile(
predicate: (Short) -> Boolean
): List<Short>
fun FloatArray.takeWhile(
predicate: (Float) -> Boolean
): List<Float>
fun DoubleArray.takeWhile(
predicate: (Double) -> Boolean
): List<Double>
fun BooleanArray.takeWhile(
predicate: (Boolean) -> Boolean
): List<Boolean>
fun ULongArray.takeWhile(
predicate: (ULong) -> Boolean
): List<ULong>
fun UByteArray.takeWhile(
predicate: (UByte) -> Boolean
): List<UByte>
fun UShortArray.takeWhile(
predicate: (UShort) -> Boolean
): List<UShort>
toBooleanArray
Returns an array of Boolean containing all of the elements of this generic array.
fun Array<out Boolean>.toBooleanArray(): BooleanArray
Returns an array of Boolean containing all of the elements of this collection.
fun Collection<Boolean>.toBooleanArray(): BooleanArray
toByteArray
Returns an array of Byte containing all of the elements of this generic array.
fun Array<out Byte>.toByteArray(): ByteArray
Returns an array of Byte containing all of the elements of this collection.
fun Collection<Byte>.toByteArray(): ByteArray
Returns an array of type ByteArray, which is a copy of this array where each element is a signed reinterpretation of the corresponding element of this array.
fun UByteArray.toByteArray(): ByteArray
toCharArray
Returns an array of Char containing all of the elements of this generic array.
fun Array<out Char>.toCharArray(): CharArray
Returns an array of Char containing all of the elements of this collection.
fun Collection<Char>.toCharArray(): CharArray
toCollection
Appends all elements to the given destination collection.
fun <T, C : MutableCollection<in T>> Array<out T>.toCollection(
destination: C
): C
fun <C : MutableCollection<in Byte>> ByteArray.toCollection(
destination: C
): C
fun <C : MutableCollection<in Short>> ShortArray.toCollection(
destination: C
): C
fun <C : MutableCollection<in Int>> IntArray.toCollection(
destination: C
): C
fun <C : MutableCollection<in Long>> LongArray.toCollection(
destination: C
): C
fun <C : MutableCollection<in Float>> FloatArray.toCollection(
destination: C
): C
fun <C : MutableCollection<in Double>> DoubleArray.toCollection(
destination: C
): C
fun <C : MutableCollection<in Boolean>> BooleanArray.toCollection(
destination: C
): C
fun <C : MutableCollection<in Char>> CharArray.toCollection(
destination: C
): C
fun <T, C : MutableCollection<in T>> Iterable<T>.toCollection(
destination: C
): C
toDoubleArray
Returns an array of Double containing all of the elements of this generic array.
fun Array<out Double>.toDoubleArray(): DoubleArray
Returns an array of Double containing all of the elements of this collection.
fun Collection<Double>.toDoubleArray(): DoubleArray
toFloatArray
Returns an array of Float containing all of the elements of this generic array.
fun Array<out Float>.toFloatArray(): FloatArray
Returns an array of Float containing all of the elements of this collection.
fun Collection<Float>.toFloatArray(): FloatArray
toHashSet
Returns a HashSet of all elements.
fun <T> Array<out T>.toHashSet(): HashSet<T>
fun ShortArray.toHashSet(): HashSet<Short>
fun FloatArray.toHashSet(): HashSet<Float>
fun DoubleArray.toHashSet(): HashSet<Double>
fun BooleanArray.toHashSet(): HashSet<Boolean>
toIntArray
Returns an array of Int containing all of the elements of this generic array.
fun Array<out Int>.toIntArray(): IntArray
Returns an array of Int containing all of the elements of this collection.
fun Collection<Int>.toIntArray(): IntArray
toList
Returns a List containing all elements.
fun <T> Array<out T>.toList(): List<T>
fun ShortArray.toList(): List<Short>
fun FloatArray.toList(): List<Float>
fun DoubleArray.toList(): List<Double>
fun BooleanArray.toList(): List<Boolean>
toLongArray
Returns an array of Long containing all of the elements of this generic array.
fun Array<out Long>.toLongArray(): LongArray
Returns an array of Long containing all of the elements of this collection.
fun Collection<Long>.toLongArray(): LongArray
Returns an array of type LongArray, which is a copy of this array where each element is a signed reinterpretation of the corresponding element of this array.
fun ULongArray.toLongArray(): LongArray
toMap
Returns a new map containing all key-value pairs from the given collection of pairs.
Populates and returns the destination mutable map with key-value pairs from the given collection of pairs.
fun <K, V, M : MutableMap<in K, in V>> Iterable<Pair<K, V>>.toMap(
destination: M
): M
Returns a new map containing all key-value pairs from the given array of pairs.
Populates and returns the destination mutable map with key-value pairs from the given array of pairs.
fun <K, V, M : MutableMap<in K, in V>> Array<out Pair<K, V>>.toMap(
destination: M
): M
Returns a new map containing all key-value pairs from the given sequence of pairs.
Populates and returns the destination mutable map with key-value pairs from the given sequence of pairs.
fun <K, V, M : MutableMap<in K, in V>> Sequence<Pair<K, V>>.toMap(
destination: M
): M
Returns a new read-only map containing all key-value pairs from the original map.
Populates and returns the destination mutable map with key-value pairs from the given map.
fun <K, V, M : MutableMap<in K, in V>> Map<out K, V>.toMap(
destination: M
): M
toMutableList
Returns a MutableList filled with all elements of this array.
fun <T> any_array<T>.toMutableList(): MutableList<T>
Returns a MutableList filled with all elements of this collection.
fun <T> Iterable<T>.toMutableList(): MutableList<T>
fun <T> Collection<T>.toMutableList(): MutableList<T>
toMutableMap
Returns a new mutable map containing all key-value pairs from the original map.
fun <K, V> Map<out K, V>.toMutableMap(): MutableMap<K, V>
toMutableSet
Returns a mutable set containing all distinct elements from the given array.
fun <T> any_array<T>.toMutableSet(): MutableSet<T>
Returns a mutable set containing all distinct elements from the given collection.
fun <T> Iterable<T>.toMutableSet(): MutableSet<T>
toProperties
Converts this Map to a Properties object.
fun Map<String, String>.toProperties(): Properties
toSet
Returns a Set of all elements.
fun <T> Array<out T>.toSet(): Set<T>
fun ShortArray.toSet(): Set<Short>
fun FloatArray.toSet(): Set<Float>
fun DoubleArray.toSet(): Set<Double>
fun BooleanArray.toSet(): Set<Boolean>
toShortArray
Returns an array of Short containing all of the elements of this generic array.
fun Array<out Short>.toShortArray(): ShortArray
Returns an array of Short containing all of the elements of this collection.
fun Collection<Short>.toShortArray(): ShortArray
Returns an array of type ShortArray, which is a copy of this array where each element is a signed reinterpretation of the corresponding element of this array.
fun UShortArray.toShortArray(): ShortArray
toSortedMap
Converts this Map to a SortedMap. The resulting SortedMap determines the equality and order of keys according to their natural sorting order.
fun <K : Comparable<K>, V> Map<out K, V>.toSortedMap(): SortedMap<K, V>
Converts this Map to a SortedMap. The resulting SortedMap determines the equality and order of keys according to the sorting order provided by the given comparator.
fun <K, V> Map<out K, V>.toSortedMap(
comparator: Comparator<in K>
): SortedMap<K, V>
toSortedSet
Returns a SortedSet of all elements.
fun <T : Comparable<T>> Array<out T>.toSortedSet(): SortedSet<T>
fun ShortArray.toSortedSet(): SortedSet<Short>
fun FloatArray.toSortedSet(): SortedSet<Float>
fun DoubleArray.toSortedSet(): SortedSet<Double>
fun BooleanArray.toSortedSet(): SortedSet<Boolean>
fun <T> Array<out T>.toSortedSet(
comparator: Comparator<in T>
): SortedSet<T>
fun <T : Comparable<T>> Iterable<T>.toSortedSet(): SortedSet<T>
fun <T> Iterable<T>.toSortedSet(
comparator: Comparator<in T>
): SortedSet<T>
toTypedArray
Returns a typed object array containing all of the elements of this primitive array.
fun ULongArray.toTypedArray(): Array<ULong>
fun UByteArray.toTypedArray(): Array<UByte>
fun UShortArray.toTypedArray(): Array<UShort>
fun ByteArray.toTypedArray(): Array<Byte>
fun ShortArray.toTypedArray(): Array<Short>
fun IntArray.toTypedArray(): Array<Int>
fun LongArray.toTypedArray(): Array<Long>
fun FloatArray.toTypedArray(): Array<Float>
fun DoubleArray.toTypedArray(): Array<Double>
fun BooleanArray.toTypedArray(): Array<Boolean>
fun CharArray.toTypedArray(): Array<Char>
Returns a typed array containing all of the elements of this collection.
fun <T> Collection<T>.toTypedArray(): Array<T>
toUByteArray
Returns an array of UByte containing all of the elements of this generic array.
fun Array<out UByte>.toUByteArray(): UByteArray
Returns an array of type UByteArray, which is a copy of this array where each element is an unsigned reinterpretation of the corresponding element of this array.
fun ByteArray.toUByteArray(): UByteArray
Returns an array of UByte containing all of the elements of this collection.
fun Collection<UByte>.toUByteArray(): UByteArray
toUIntArray
Returns an array of UInt containing all of the elements of this generic array.
Returns an array of type UIntArray, which is a copy of this array where each element is an unsigned reinterpretation of the corresponding element of this array.
Returns an array of UInt containing all of the elements of this collection.
fun Collection<UInt>.toUIntArray(): UIntArray
toULongArray
Returns an array of ULong containing all of the elements of this generic array.
fun Array<out ULong>.toULongArray(): ULongArray
Returns an array of type ULongArray, which is a copy of this array where each element is an unsigned reinterpretation of the corresponding element of this array.
fun LongArray.toULongArray(): ULongArray
Returns an array of ULong containing all of the elements of this collection.
fun Collection<ULong>.toULongArray(): ULongArray
toUShortArray
Returns an array of UShort containing all of the elements of this generic array.
fun Array<out UShort>.toUShortArray(): UShortArray
Returns an array of type UShortArray, which is a copy of this array where each element is an unsigned reinterpretation of the corresponding element of this array.
fun ShortArray.toUShortArray(): UShortArray
Returns an array of UShort containing all of the elements of this collection.
fun Collection<UShort>.toUShortArray(): UShortArray
union
Returns a set containing all distinct elements from both collections.
infix fun ShortArray.union(
other: Iterable<Short>
): Set<Short>
infix fun FloatArray.union(
other: Iterable<Float>
): Set<Float>
infix fun DoubleArray.union(
other: Iterable<Double>
): Set<Double>
infix fun BooleanArray.union(
other: Iterable<Boolean>
): Set<Boolean>
unzip
Returns a pair of lists, where first list is built from the first values of each pair from this array, second list is built from the second values of each pair from this array.
windowed
Returns a list of snapshots of the window of the given size sliding along this collection with the given step, where each snapshot is a list.
withDefault
Returns a wrapper of this read-only map, having the implicit default value provided with the specified function defaultValue.
Returns a wrapper of this mutable map, having the implicit default value provided with the specified function defaultValue.
fun <K, V> MutableMap<K, V>.withDefault(
defaultValue: (key: K) -> V
): MutableMap<K, V>
withIndex
Returns a lazy Iterable that wraps each element of the original array into an IndexedValue containing the index of that element and the element itself.
fun <T> Array<out T>.withIndex(): Iterable<IndexedValue<T>>
fun ByteArray.withIndex(): Iterable<IndexedValue<Byte>>
fun ShortArray.withIndex(): Iterable<IndexedValue<Short>>
fun IntArray.withIndex(): Iterable<IndexedValue<Int>>
fun LongArray.withIndex(): Iterable<IndexedValue<Long>>
fun FloatArray.withIndex(): Iterable<IndexedValue<Float>>
fun DoubleArray.withIndex(): Iterable<IndexedValue<Double>>
fun BooleanArray.withIndex(): Iterable<IndexedValue<Boolean>>
fun CharArray.withIndex(): Iterable<IndexedValue<Char>>
fun UIntArray.withIndex(): Iterable<IndexedValue<UInt>>
fun ULongArray.withIndex(): Iterable<IndexedValue<ULong>>
fun UByteArray.withIndex(): Iterable<IndexedValue<UByte>>
fun UShortArray.withIndex(): Iterable<IndexedValue<UShort>>
Returns a lazy Iterable that wraps each element of the original collection into an IndexedValue containing the index of that element and the element itself.
fun <T> Iterable<T>.withIndex(): Iterable<IndexedValue<T>>
Returns an Iterator that wraps each element produced by the original iterator into an IndexedValue containing the index of that element and the element itself.
fun <T> Iterator<T>.withIndex(): Iterator<IndexedValue<T>>
zip
Returns a list of pairs built from the elements of this
array and the other array with the same index.
The returned list has length of the shortest collection.
infix fun <R> ShortArray.zip(
other: Array<out R>
): List<Pair<Short, R>>
infix fun <R> FloatArray.zip(
other: Array<out R>
): List<Pair<Float, R>>
infix fun <R> DoubleArray.zip(
other: Array<out R>
): List<Pair<Double, R>>
infix fun <R> BooleanArray.zip(
other: Array<out R>
): List<Pair<Boolean, R>>
infix fun ShortArray.zip(
other: ShortArray
): List<Pair<Short, Short>>
infix fun FloatArray.zip(
other: FloatArray
): List<Pair<Float, Float>>
infix fun DoubleArray.zip(
other: DoubleArray
): List<Pair<Double, Double>>
infix fun BooleanArray.zip(
other: BooleanArray
): List<Pair<Boolean, Boolean>>
infix fun <R> ULongArray.zip(
other: Array<out R>
): List<Pair<ULong, R>>
infix fun <R> UByteArray.zip(
other: Array<out R>
): List<Pair<UByte, R>>
infix fun <R> UShortArray.zip(
other: Array<out R>
): List<Pair<UShort, R>>
infix fun ULongArray.zip(
other: ULongArray
): List<Pair<ULong, ULong>>
infix fun UByteArray.zip(
other: UByteArray
): List<Pair<UByte, UByte>>
infix fun UShortArray.zip(
other: UShortArray
): List<Pair<UShort, UShort>>
Returns a list of values built from the elements of this
array and the other array with the same index
using the provided transform function applied to each pair of elements.
The returned list has length of the shortest collection.
fun <T, R, V> Array<out T>.zip(
other: Array<out R>,
transform: (a: T, b: R) -> V
): List<V>
fun <R, V> ShortArray.zip(
other: Array<out R>,
transform: (a: Short, b: R) -> V
): List<V>
fun <R, V> FloatArray.zip(
other: Array<out R>,
transform: (a: Float, b: R) -> V
): List<V>
fun <R, V> DoubleArray.zip(
other: Array<out R>,
transform: (a: Double, b: R) -> V
): List<V>
fun <R, V> BooleanArray.zip(
other: Array<out R>,
transform: (a: Boolean, b: R) -> V
): List<V>
fun <R, V> ULongArray.zip(
other: Array<out R>,
transform: (a: ULong, b: R) -> V
): List<V>
fun <R, V> UByteArray.zip(
other: Array<out R>,
transform: (a: UByte, b: R) -> V
): List<V>
fun <R, V> UShortArray.zip(
other: Array<out R>,
transform: (a: UShort, b: R) -> V
): List<V>
Returns a list of pairs built from the elements of this
collection and other array with the same index.
The returned list has length of the shortest collection.
infix fun <R> ShortArray.zip(
other: Iterable<R>
): List<Pair<Short, R>>
infix fun <R> FloatArray.zip(
other: Iterable<R>
): List<Pair<Float, R>>
infix fun <R> DoubleArray.zip(
other: Iterable<R>
): List<Pair<Double, R>>
infix fun <R> BooleanArray.zip(
other: Iterable<R>
): List<Pair<Boolean, R>>
infix fun <R> ULongArray.zip(
other: Iterable<R>
): List<Pair<ULong, R>>
infix fun <R> UByteArray.zip(
other: Iterable<R>
): List<Pair<UByte, R>>
infix fun <R> UShortArray.zip(
other: Iterable<R>
): List<Pair<UShort, R>>
Returns a list of values built from the elements of this
array and the other collection with the same index
using the provided transform function applied to each pair of elements.
The returned list has length of the shortest collection.
fun <R, V> ShortArray.zip(
other: Iterable<R>,
transform: (a: Short, b: R) -> V
): List<V>
fun <R, V> FloatArray.zip(
other: Iterable<R>,
transform: (a: Float, b: R) -> V
): List<V>
fun <R, V> DoubleArray.zip(
other: Iterable<R>,
transform: (a: Double, b: R) -> V
): List<V>
fun <R, V> BooleanArray.zip(
other: Iterable<R>,
transform: (a: Boolean, b: R) -> V
): List<V>
fun <R, V> ULongArray.zip(
other: Iterable<R>,
transform: (a: ULong, b: R) -> V
): List<V>
fun <R, V> UByteArray.zip(
other: Iterable<R>,
transform: (a: UByte, b: R) -> V
): List<V>
fun <R, V> UShortArray.zip(
other: Iterable<R>,
transform: (a: UShort, b: R) -> V
): List<V>
Returns a list of values built from the elements of this
array and the other array with the same index
using the provided transform function applied to each pair of elements.
The returned list has length of the shortest array.
fun <V> ShortArray.zip(
other: ShortArray,
transform: (a: Short, b: Short) -> V
): List<V>
fun <V> FloatArray.zip(
other: FloatArray,
transform: (a: Float, b: Float) -> V
): List<V>
fun <V> DoubleArray.zip(
other: DoubleArray,
transform: (a: Double, b: Double) -> V
): List<V>
fun <V> BooleanArray.zip(
other: BooleanArray,
transform: (a: Boolean, b: Boolean) -> V
): List<V>
fun <V> ULongArray.zip(
other: ULongArray,
transform: (a: ULong, b: ULong) -> V
): List<V>
fun <V> UByteArray.zip(
other: UByteArray,
transform: (a: UByte, b: UByte) -> V
): List<V>
fun <V> UShortArray.zip(
other: UShortArray,
transform: (a: UShort, b: UShort) -> V
): List<V>
Returns a list of pairs built from the elements of this
collection and the other array with the same index.
The returned list has length of the shortest collection.
Returns a list of values built from the elements of this
collection and the other array with the same index
using the provided transform function applied to each pair of elements.
The returned list has length of the shortest collection.
Returns a list of pairs built from the elements of this
collection and other collection with the same index.
The returned list has length of the shortest collection.
zipWithNext
Returns a list of pairs of each two adjacent elements in this collection.