Package kotlin.collections

Collection types, such as Iterable, Collection, List, Set, Map and related top-level and extension functions.

Types

Common
JVM
JS
Native
1.1

AbstractCollection

Provides a skeletal implementation of the read-only Collection interface.

abstract class AbstractCollection<out E> : Collection<E>
Common
JVM
JS
Native
1.0

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>
Common
JVM
JS
Native
1.1

AbstractList

Provides a skeletal implementation of the read-only List interface.

abstract class AbstractList<out E> : 
    AbstractCollection<E>,
    List<E>
Common
JVM
JS
Native
1.1

AbstractMap

Provides a skeletal implementation of the read-only Map interface.

abstract class AbstractMap<K, out V> : Map<K, V>

AbstractMutableCollection

Provides a skeletal implementation of the MutableCollection interface.

Common
JS
1.1
abstract class AbstractMutableCollection<E> : 
    MutableCollection<E>
JVM
1.1
abstract class AbstractMutableCollection<E> : 
    MutableCollection<E>,
    AbstractCollection<E>
Native
1.3
abstract class AbstractMutableCollection<E> : 
    MutableCollection<E>,
    AbstractCollection<E>

AbstractMutableList

Provides a skeletal implementation of the MutableList interface.

Common
1.0
abstract class AbstractMutableList<E> : MutableList<E>
JVM
1.1
abstract class AbstractMutableList<E> : 
    MutableList<E>,
    AbstractList<E>
JS
Native
1.1
abstract class AbstractMutableList<E> : 
    AbstractMutableCollection<E>,
    MutableList<E>

AbstractMutableMap

Provides a skeletal implementation of the MutableMap interface.

Common
JS
1.1
abstract class AbstractMutableMap<K, V> : MutableMap<K, V>
JVM
1.1
abstract class AbstractMutableMap<K, V> : 
    MutableMap<K, V>,
    AbstractMap<K, V>
Native
1.1
abstract class AbstractMutableMap<K, V> : 
    AbstractMap<K, V>,
    MutableMap<K, V>

AbstractMutableSet

Provides a skeletal implementation of the MutableSet interface.

Common
1.3
abstract class AbstractMutableSet<E> : MutableSet<E>
JVM
1.1
abstract class AbstractMutableSet<E> : 
    MutableSet<E>,
    AbstractSet<E>
JS
Native
1.1
abstract class AbstractMutableSet<E> : 
    AbstractMutableCollection<E>,
    MutableSet<E>
Common
JVM
JS
Native
1.1

AbstractSet

Provides a skeletal implementation of the read-only Set interface.

abstract class AbstractSet<out E> : 
    AbstractCollection<E>,
    Set<E>
Common
JVM
JS
Native
1.4

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.

Common
1.0
class ArrayList<E> : MutableList<E>, RandomAccess
JVM
1.1
typealias ArrayList<E> = ArrayList<E>
JS
1.1
open class ArrayList<E> : 
    AbstractMutableList<E>,
    MutableList<E>,
    RandomAccess
Native
1.3
class ArrayList<E> : 
    MutableList<E>,
    RandomAccess,
    AbstractMutableList<E>
Common
JVM
JS
Native
1.0

BooleanIterator

An iterator over a sequence of values of type Boolean.

abstract class BooleanIterator : Iterator<Boolean>
Common
JVM
JS
Native
1.0

ByteIterator

An iterator over a sequence of values of type Byte.

abstract class ByteIterator : Iterator<Byte>
Common
JVM
JS
Native
1.0

CharIterator

An iterator over a sequence of values of type Char.

abstract class CharIterator : Iterator<Char>
Common
JVM
JS
Native
1.0

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>
Common
JVM
JS
Native
1.0

DoubleIterator

An iterator over a sequence of values of type Double.

abstract class DoubleIterator : Iterator<Double>
Common
JVM
JS
Native
1.0

FloatIterator

An iterator over a sequence of values of type Float.

abstract class FloatIterator : Iterator<Float>
Common
JVM
JS
Native
1.1

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.

Common
Native
1.0
class HashMap<K, V> : MutableMap<K, V>
JVM
1.1
typealias HashMap<K, V> = HashMap<K, V>
JS
1.1
open class HashMap<K, V> : 
    AbstractMutableMap<K, V>,
    MutableMap<K, V>

HashSet

The implementation of the MutableSet interface, backed by a InternalMap implementation.

Common
1.0
class HashSet<E> : MutableSet<E>
JVM
1.1
typealias HashSet<E> = HashSet<E>
JS
1.1
open class HashSet<E> : AbstractMutableSet<E>, MutableSet<E>
Native
1.3
class HashSet<E> : 
    MutableSet<E>,
    KonanSet<E>,
    AbstractMutableSet<E>
Common
JVM
JS
Native
1.0

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>
Common
JVM
JS
Native
1.0

IntIterator

An iterator over a sequence of values of type Int.

abstract class IntIterator : Iterator<Int>
Common
JVM
JS
Native
1.0

Iterable

Classes that inherit from this interface can be represented as a sequence of elements that can be iterated over.

interface Iterable<out T>
Common
JVM
JS
Native
1.0

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.

Common
1.0
class LinkedHashMap<K, V> : MutableMap<K, V>
JVM
1.1
typealias LinkedHashMap<K, V> = LinkedHashMap<K, V>
JS
1.1
open class LinkedHashMap<K, V> : 
    HashMap<K, V>,
    MutableMap<K, V>
Native
1.3
typealias LinkedHashMap<K, V> = HashMap<K, V>

LinkedHashSet

The implementation of the MutableSet interface, backed by a InternalMap implementation.

Common
1.0
class LinkedHashSet<E> : MutableSet<E>
JVM
1.1
typealias LinkedHashSet<E> = LinkedHashSet<E>
JS
1.1
open class LinkedHashSet<E> : HashSet<E>, MutableSet<E>
Native
1.3
typealias LinkedHashSet<V> = HashSet<V>
Common
JVM
JS
Native
1.0

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>
Common
JVM
JS
Native
1.0

ListIterator

An iterator over a collection that supports indexed access.

interface ListIterator<out T> : Iterator<T>
Common
JVM
JS
Native
1.0

LongIterator

An iterator over a sequence of values of type Long.

abstract class LongIterator : Iterator<Long>
Common
JVM
JS
Native
1.0

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>
Common
JVM
JS
Native
1.0

MutableCollection

A generic collection of elements that supports adding and removing elements.

interface MutableCollection<E> : 
    Collection<E>,
    MutableIterable<E>
Common
JVM
JS
Native
1.0

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>
Common
JVM
JS
Native
1.0

MutableIterator

An iterator over a mutable collection. Provides the ability to remove elements while iterating.

interface MutableIterator<out T> : Iterator<T>
Common
JVM
JS
Native
1.0

MutableList

A generic ordered collection of elements that supports adding and removing elements.

interface MutableList<E> : List<E>, MutableCollection<E>
Common
JVM
JS
Native
1.0

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>
Common
JVM
JS
Native
1.0

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>
Common
JVM
JS
Native
1.0

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.

Common
JS
Native
1.0
interface RandomAccess
JVM
1.1
typealias RandomAccess = RandomAccess
Common
JVM
JS
Native
1.0

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>
Common
JVM
JS
Native
1.0

ShortIterator

An iterator over a sequence of values of type Short.

abstract class ShortIterator : Iterator<Short>

Extensions for External Classes

Properties

Common
JVM
JS
Native
1.0

indices

Returns the range of valid indices for the array.

val <T> Array<out T>.indices: IntRange
val ByteArray.indices: IntRange
val ShortArray.indices: IntRange
val IntArray.indices: IntRange
val LongArray.indices: IntRange
val FloatArray.indices: IntRange
val DoubleArray.indices: IntRange
val BooleanArray.indices: IntRange
val CharArray.indices: IntRange
val UIntArray.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
Common
JVM
JS
Native
1.0

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

Common
JVM
JS
Native
1.0

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
Common
JVM
JS
Native
1.1

aggregate

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.

fun <T, K, R> Grouping<T, K>.aggregate(
    operation: (key: K, accumulator: R?, element: T, first: Boolean) -> R
): Map<K, R>
Common
JVM
JS
Native
1.1

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
Common
JVM
JS
Native
1.0

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 UIntArray.all(predicate: (UInt) -> Boolean): Boolean
fun ULongArray.all(predicate: (ULong) -> Boolean): Boolean
fun UByteArray.all(predicate: (UByte) -> Boolean): Boolean
fun UShortArray.all(predicate: (UShort) -> Boolean): Boolean

Returns true if all entries match the given predicate.

fun <K, V> Map<out K, V>.all(
    predicate: (Entry<K, V>) -> Boolean
): Boolean
Common
JVM
JS
Native
1.0

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 UIntArray.any(predicate: (UInt) -> 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

Returns true if at least one entry matches the given predicate.

fun <K, V> Map<out K, V>.any(
    predicate: (Entry<K, V>) -> Boolean
): Boolean
Common
JVM
JS
Native
1.0

arrayListOf

Returns an empty new ArrayList.

fun <T> arrayListOf(): ArrayList<T>

Returns a new ArrayList with the given elements.

fun <T> arrayListOf(vararg elements: T): ArrayList<T>
Common
JVM
JS
Native
1.3

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
Common
JVM
JS
Native
1.3

asIntArray

Returns an array of type IntArray, which is a view of this array where each element is a signed reinterpretation of the corresponding element of this array.

fun UIntArray.asIntArray(): IntArray
Common
JVM
JS
Native
1.0

asIterable

Creates an Iterable instance that wraps the original array returning its elements when being iterated.

fun <T> any_array<T>.asIterable(): Iterable<T>

Returns this collection as an Iterable.

fun <T> Iterable<T>.asIterable(): Iterable<T>

Creates an Iterable instance that wraps the original map returning its entries when being iterated.

fun <K, V> Map<out K, V>.asIterable(): Iterable<Entry<K, V>>

asList

Returns a List that wraps the original array.

JS
1.3
fun <ERROR CLASS>.asList(): List<<ERROR CLASS>>
Common
JVM
JS
Native
1.0
fun <T> Array<out T>.asList(): List<T>
Common
JVM
JS
Native
1.0
fun ByteArray.asList(): List<Byte>
Common
JVM
JS
Native
1.0
fun ShortArray.asList(): List<Short>
Common
JVM
JS
Native
1.0
fun IntArray.asList(): List<Int>
Common
JVM
JS
Native
1.0
fun LongArray.asList(): List<Long>
Common
JVM
JS
Native
1.0
fun FloatArray.asList(): List<Float>
Common
JVM
JS
Native
1.0
fun DoubleArray.asList(): List<Double>
Common
JVM
JS
Native
1.0
fun BooleanArray.asList(): List<Boolean>
Common
JVM
JS
Native
1.0
fun CharArray.asList(): List<Char>
Common
JVM
Native
1.3
fun UIntArray.asList(): List<UInt>
Common
JVM
Native
1.3
fun ULongArray.asList(): List<ULong>
Common
JVM
Native
1.3
fun UByteArray.asList(): List<UByte>
Common
JVM
Native
1.3
fun UShortArray.asList(): List<UShort>
Common
JVM
JS
Native
1.3

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
Common
JVM
JS
Native
1.0

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.

fun <T> List<T>.asReversed(): List<T>

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>
Common
JVM
JS
Native
1.0

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.

fun <T> Iterable<T>.asSequence(): Sequence<T>

Creates a Sequence instance that wraps the original map returning its entries when being iterated.

fun <K, V> Map<out K, V>.asSequence(): Sequence<Entry<K, V>>
Common
JVM
JS
Native
1.3

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
Common
JVM
JS
Native
1.0

associate

Returns a Map containing key-value pairs provided by transform function applied to elements of the given array.

fun <T, K, V> any_array<T>.associate(
    transform: (T) -> Pair<K, V>
): Map<K, V>

Returns a Map containing key-value pairs provided by transform function applied to elements of the given collection.

fun <T, K, V> Iterable<T>.associate(
    transform: (T) -> Pair<K, V>
): Map<K, V>
Common
JVM
JS
Native
1.0

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.

fun <T, K> Iterable<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 collection.

fun <T, K, V> Iterable<T>.associateBy(
    keySelector: (T) -> K,
    valueTransform: (T) -> V
): Map<K, V>
Common
JVM
JS
Native
1.0

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
Common
JVM
JS
Native
1.0

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
Common
JVM
JS
Native
1.3

associateWith

Returns a Map where keys are elements from the given array and values are produced by the valueSelector function applied to each element.

fun <K, V> Array<out K>.associateWith(
    valueSelector: (K) -> V
): Map<K, V>
fun <V> ByteArray.associateWith(
    valueSelector: (Byte) -> V
): Map<Byte, V>
fun <V> ShortArray.associateWith(
    valueSelector: (Short) -> V
): Map<Short, V>
fun <V> IntArray.associateWith(
    valueSelector: (Int) -> V
): Map<Int, V>
fun <V> LongArray.associateWith(
    valueSelector: (Long) -> V
): Map<Long, V>
fun <V> FloatArray.associateWith(
    valueSelector: (Float) -> V
): Map<Float, V>
fun <V> DoubleArray.associateWith(
    valueSelector: (Double) -> V
): Map<Double, V>
fun <V> BooleanArray.associateWith(
    valueSelector: (Boolean) -> V
): Map<Boolean, V>
fun <V> CharArray.associateWith(
    valueSelector: (Char) -> V
): Map<Char, V>
fun <V> UIntArray.associateWith(
    valueSelector: (UInt) -> V
): Map<UInt, V>
fun <V> ULongArray.associateWith(
    valueSelector: (ULong) -> V
): Map<ULong, V>
fun <V> UByteArray.associateWith(
    valueSelector: (UByte) -> V
): Map<UByte, V>
fun <V> UShortArray.associateWith(
    valueSelector: (UShort) -> V
): Map<UShort, V>

Returns a Map where keys are elements from the given collection and values are produced by the valueSelector function applied to each element.

fun <K, V> Iterable<K>.associateWith(
    valueSelector: (K) -> V
): Map<K, V>
Common
JVM
JS
Native
1.3

associateWithTo

Populates and returns the destination mutable map with key-value pairs for each element of the given array, 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>> Array<out K>.associateWithTo(
    destination: M,
    valueSelector: (K) -> V
): M
fun <V, M : MutableMap<in Byte, in V>> ByteArray.associateWithTo(
    destination: M,
    valueSelector: (Byte) -> V
): M
fun <V, M : MutableMap<in Short, in V>> ShortArray.associateWithTo(
    destination: M,
    valueSelector: (Short) -> V
): M
fun <V, M : MutableMap<in Int, in V>> IntArray.associateWithTo(
    destination: M,
    valueSelector: (Int) -> V
): M
fun <V, M : MutableMap<in Long, in V>> LongArray.associateWithTo(
    destination: M,
    valueSelector: (Long) -> V
): M
fun <V, M : MutableMap<in Float, in V>> FloatArray.associateWithTo(
    destination: M,
    valueSelector: (Float) -> V
): M
fun <V, M : MutableMap<in Double, in V>> DoubleArray.associateWithTo(
    destination: M,
    valueSelector: (Double) -> V
): M
fun <V, M : MutableMap<in Boolean, in V>> BooleanArray.associateWithTo(
    destination: M,
    valueSelector: (Boolean) -> V
): M
fun <V, M : MutableMap<in Char, in V>> CharArray.associateWithTo(
    destination: M,
    valueSelector: (Char) -> V
): M
fun <V, M : MutableMap<in UInt, in V>> UIntArray.associateWithTo(
    destination: M,
    valueSelector: (UInt) -> V
): M
fun <V, M : MutableMap<in ULong, in V>> ULongArray.associateWithTo(
    destination: M,
    valueSelector: (ULong) -> V
): M
fun <V, M : MutableMap<in UByte, in V>> UByteArray.associateWithTo(
    destination: M,
    valueSelector: (UByte) -> V
): M
fun <V, M : MutableMap<in UShort, in V>> UShortArray.associateWithTo(
    destination: M,
    valueSelector: (UShort) -> V
): M

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
Common
JVM
JS
Native
1.3

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
Common
JVM
JS
Native
1.3

asUIntArray

Returns an array of type UIntArray, which is a view of this array where each element is an unsigned reinterpretation of the corresponding element of this array.

fun IntArray.asUIntArray(): UIntArray
Common
JVM
JS
Native
1.3

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
Common
JVM
JS
Native
1.3

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
Common
JVM
JS
Native
1.0

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

Returns an average value of elements in the collection.

fun Iterable<Byte>.average(): Double
fun Iterable<Short>.average(): Double
fun Iterable<Int>.average(): Double
fun Iterable<Long>.average(): Double
fun Iterable<Float>.average(): Double
fun Iterable<Double>.average(): Double

binarySearch

Common
JVM
JS
Native
1.0

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
Common
JVM
JS
Native
1.0

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
Common
JVM
JS
Native
1.0

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
JVM
1.0

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
JVM
1.0

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 UIntArray.binarySearch(
    element: UInt,
    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
Common
JVM
JS
Native
1.0

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
Common
JVM
JS
Native
1.6

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>
Common
JVM
JS
Native
1.6

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>
Common
JVM
JS
Native
1.6

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>
Common
JVM
JS
Native
1.2

chunked

Splits this collection into a list of lists each not exceeding the given size.

fun <T> Iterable<T>.chunked(size: Int): List<List<T>>

Splits this collection into several lists each not exceeding the given size and applies the given transform function to an each.

fun <T, R> Iterable<T>.chunked(
    size: Int,
    transform: (List<T>) -> R
): List<R>
Common
JVM
JS
Native
1.0

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 UIntArray.component1(): UInt
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
Common
JVM
JS
Native
1.0

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 UIntArray.component2(): UInt
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
Common
JVM
JS
Native
1.0

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 UIntArray.component3(): UInt
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
Common
JVM
JS
Native
1.0

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 UIntArray.component4(): UInt
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
Common
JVM
JS
Native
1.0

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 UIntArray.component5(): UInt
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
Common
JVM
JS
Native
1.0

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
Common
JVM
JS
Native
1.0

containsAll

Checks if all elements in the specified collection are contained in this collection.

fun <T> Collection<T>.containsAll(
    elements: Collection<T>
): Boolean
Common
JVM
JS
Native
1.0

containsKey

Returns true if the map contains the specified key.

fun <K> Map<out K, *>.containsKey(key: K): Boolean
Common
JVM
JS
Native
1.0

containsValue

Returns true if the map maps one or more keys to the specified value.

fun <K, V> Map<K, V>.containsValue(value: V): Boolean
Common
JVM
JS
Native
1.1

contentDeepEquals

Checks if the two specified arrays are deeply equal to one another.

infix fun <T> any_array<T>.contentDeepEquals(
    other: Array<out T>
): Boolean
Common
JVM
JS
Native
1.1

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
Common
JVM
JS
Native
1.1

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

Checks if the two specified arrays are structurally equal to one another.

Common
JVM
JS
Native
1.4
infix fun UIntArray?.contentEquals(
    other: UIntArray?
): Boolean
Common
JVM
JS
Native
1.4
infix fun ULongArray?.contentEquals(
    other: ULongArray?
): Boolean
Common
JVM
JS
Native
1.4
infix fun UByteArray?.contentEquals(
    other: UByteArray?
): Boolean
Common
JVM
JS
Native
1.4
infix fun UShortArray?.contentEquals(
    other: UShortArray?
): Boolean
Native
1.1
infix fun <T> Array<out T>.contentEquals(
    other: Array<out T>
): Boolean
Native
1.1
infix fun ByteArray.contentEquals(other: ByteArray): Boolean
Native
1.1
infix fun ShortArray.contentEquals(
    other: ShortArray
): Boolean
Native
1.1
infix fun IntArray.contentEquals(other: IntArray): Boolean
Native
1.1
infix fun LongArray.contentEquals(other: LongArray): Boolean
Native
1.1
infix fun FloatArray.contentEquals(
    other: FloatArray
): Boolean
Native
1.1
infix fun DoubleArray.contentEquals(
    other: DoubleArray
): Boolean
Native
1.1
infix fun BooleanArray.contentEquals(
    other: BooleanArray
): Boolean
Native
1.1
infix fun CharArray.contentEquals(other: CharArray): Boolean
Native
1.3
infix fun UIntArray.contentEquals(other: UIntArray): Boolean
Native
1.3
infix fun ULongArray.contentEquals(
    other: ULongArray
): Boolean
Native
1.3
infix fun UByteArray.contentEquals(
    other: UByteArray
): Boolean
Native
1.3
infix fun UShortArray.contentEquals(
    other: UShortArray
): Boolean
Common
JVM
JS
Native
1.4
infix fun <T> Array<out T>?.contentEquals(
    other: Array<out T>?
): Boolean
Common
JVM
JS
Native
1.4
infix fun ByteArray?.contentEquals(
    other: ByteArray?
): Boolean
Common
JVM
JS
Native
1.4
infix fun ShortArray?.contentEquals(
    other: ShortArray?
): Boolean
Common
JVM
JS
Native
1.4
infix fun IntArray?.contentEquals(other: IntArray?): Boolean
Common
JVM
JS
Native
1.4
infix fun LongArray?.contentEquals(
    other: LongArray?
): Boolean
Common
JVM
JS
Native
1.4
infix fun FloatArray?.contentEquals(
    other: FloatArray?
): Boolean
Common
JVM
JS
Native
1.4
infix fun DoubleArray?.contentEquals(
    other: DoubleArray?
): Boolean
Common
JVM
JS
Native
1.4
infix fun BooleanArray?.contentEquals(
    other: BooleanArray?
): Boolean
Common
JVM
JS
Native
1.4
infix fun CharArray?.contentEquals(
    other: CharArray?
): Boolean

contentHashCode

Returns a hash code based on the contents of this array as if it is List.

Common
JVM
JS
Native
1.4
fun UIntArray?.contentHashCode(): Int
Common
JVM
JS
Native
1.4
fun ULongArray?.contentHashCode(): Int
Common
JVM
JS
Native
1.4
fun UByteArray?.contentHashCode(): Int
Common
JVM
JS
Native
1.4
fun UShortArray?.contentHashCode(): Int
Native
1.1
fun <T> Array<out T>.contentHashCode(): Int
Native
1.1
fun ByteArray.contentHashCode(): Int
Native
1.1
fun ShortArray.contentHashCode(): Int
Native
1.1
fun IntArray.contentHashCode(): Int
Native
1.1
fun LongArray.contentHashCode(): Int
Native
1.1
fun FloatArray.contentHashCode(): Int
Native
1.1
fun DoubleArray.contentHashCode(): Int
Native
1.1
fun BooleanArray.contentHashCode(): Int
Native
1.1
fun CharArray.contentHashCode(): Int
Native
1.3
fun UIntArray.contentHashCode(): Int
Native
1.3
fun ULongArray.contentHashCode(): Int
Native
1.3
fun UByteArray.contentHashCode(): Int
Native
1.3
fun UShortArray.contentHashCode(): Int
Common
JVM
JS
Native
1.4
fun <T> Array<out T>?.contentHashCode(): Int
Common
JVM
JS
Native
1.4
fun ByteArray?.contentHashCode(): Int
Common
JVM
JS
Native
1.4
fun ShortArray?.contentHashCode(): Int
Common
JVM
JS
Native
1.4
fun IntArray?.contentHashCode(): Int
Common
JVM
JS
Native
1.4
fun LongArray?.contentHashCode(): Int
Common
JVM
JS
Native
1.4
fun FloatArray?.contentHashCode(): Int
Common
JVM
JS
Native
1.4
fun DoubleArray?.contentHashCode(): Int
Common
JVM
JS
Native
1.4
fun BooleanArray?.contentHashCode(): Int
Common
JVM
JS
Native
1.4
fun CharArray?.contentHashCode(): Int

contentToString

Returns a string representation of the contents of the specified array as if it is List.

Common
JVM
JS
Native
1.4
fun UIntArray?.contentToString(): String
Common
JVM
JS
Native
1.4
fun ULongArray?.contentToString(): String
Common
JVM
JS
Native
1.4
fun UByteArray?.contentToString(): String
Common
JVM
JS
Native
1.4
fun UShortArray?.contentToString(): String
Native
1.1
fun <T> Array<out T>.contentToString(): String
Native
1.1
fun ByteArray.contentToString(): String
Native
1.1
fun ShortArray.contentToString(): String
Native
1.1
fun IntArray.contentToString(): String
Native
1.1
fun LongArray.contentToString(): String
Native
1.1
fun FloatArray.contentToString(): String
Native
1.1
fun DoubleArray.contentToString(): String
Native
1.1
fun BooleanArray.contentToString(): String
Native
1.1
fun CharArray.contentToString(): String
Native
1.3
fun UIntArray.contentToString(): String
Native
1.3
fun ULongArray.contentToString(): String
Native
1.3
fun UByteArray.contentToString(): String
Native
1.3
fun UShortArray.contentToString(): String
Common
JVM
JS
Native
1.4
fun <T> Array<out T>?.contentToString(): String
Common
JVM
JS
Native
1.4
fun ByteArray?.contentToString(): String
Common
JVM
JS
Native
1.4
fun ShortArray?.contentToString(): String
Common
JVM
JS
Native
1.4
fun IntArray?.contentToString(): String
Common
JVM
JS
Native
1.4
fun LongArray?.contentToString(): String
Common
JVM
JS
Native
1.4
fun FloatArray?.contentToString(): String
Common
JVM
JS
Native
1.4
fun DoubleArray?.contentToString(): String
Common
JVM
JS
Native
1.4
fun BooleanArray?.contentToString(): String
Common
JVM
JS
Native
1.4
fun CharArray?.contentToString(): String
Common
JVM
JS
Native
1.3

copyInto

Copies this array or its subrange into the destination array and returns that array.

fun UIntArray.copyInto(
    destination: UIntArray,
    destinationOffset: Int = 0,
    startIndex: Int = 0,
    endIndex: Int = size
): UIntArray
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 ByteArray.copyInto(
    destination: ByteArray,
    destinationOffset: Int = 0,
    startIndex: Int = 0,
    endIndex: Int = size
): ByteArray
fun ShortArray.copyInto(
    destination: ShortArray,
    destinationOffset: Int = 0,
    startIndex: Int = 0,
    endIndex: Int = size
): ShortArray
fun IntArray.copyInto(
    destination: IntArray,
    destinationOffset: Int = 0,
    startIndex: Int = 0,
    endIndex: Int = size
): IntArray
fun LongArray.copyInto(
    destination: LongArray,
    destinationOffset: Int = 0,
    startIndex: Int = 0,
    endIndex: Int = size
): LongArray
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
fun CharArray.copyInto(
    destination: CharArray,
    destinationOffset: Int = 0,
    startIndex: Int = 0,
    endIndex: Int = size
): CharArray

copyOf

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

Common
JVM
JS
Native
1.3
fun UIntArray.copyOf(): UIntArray
Common
JVM
JS
Native
1.3
fun ULongArray.copyOf(): ULongArray
Common
JVM
JS
Native
1.3
fun UByteArray.copyOf(): UByteArray
Common
JVM
JS
Native
1.3
fun UShortArray.copyOf(): UShortArray
Common
JVM
Native
1.0
fun <T> Array<T>.copyOf(): Array<T>
JS
1.1
fun <T> Array<out T>.copyOf(): Array<T>
Common
JVM
JS
Native
1.0
fun ByteArray.copyOf(): ByteArray
Common
JVM
JS
Native
1.0
fun ShortArray.copyOf(): ShortArray
Common
JVM
JS
Native
1.0
fun IntArray.copyOf(): IntArray
Common
JVM
JS
Native
1.0
fun LongArray.copyOf(): LongArray
Common
JVM
JS
Native
1.0
fun FloatArray.copyOf(): FloatArray
Common
JVM
JS
Native
1.0
fun DoubleArray.copyOf(): DoubleArray
Common
JVM
JS
Native
1.0
Common
JVM
JS
Native
1.0
fun CharArray.copyOf(): CharArray

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.

Common
JVM
JS
Native
1.3
fun UIntArray.copyOf(newSize: Int): UIntArray
Common
JVM
JS
Native
1.3
fun ULongArray.copyOf(newSize: Int): ULongArray
Common
JVM
JS
Native
1.3
fun UByteArray.copyOf(newSize: Int): UByteArray
Common
JVM
JS
Native
1.3
fun UShortArray.copyOf(newSize: Int): UShortArray
Common
JVM
JS
Native
1.0
fun ByteArray.copyOf(newSize: Int): ByteArray
Common
JVM
JS
Native
1.0
fun ShortArray.copyOf(newSize: Int): ShortArray
Common
JVM
JS
Native
1.0
fun IntArray.copyOf(newSize: Int): IntArray
Common
JVM
JS
Native
1.0
fun LongArray.copyOf(newSize: Int): LongArray
Common
JVM
JS
Native
1.0
fun FloatArray.copyOf(newSize: Int): FloatArray
Common
JVM
JS
Native
1.0
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.

Common
JVM
JS
Native
1.0
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.

Common
JVM
JS
Native
1.0
fun CharArray.copyOf(newSize: Int): CharArray

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.

Common
JVM
JS
Native
1.0
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.

Common
JVM
JS
Native
1.3
fun UIntArray.copyOfRange(
    fromIndex: Int,
    toIndex: Int
): UIntArray
Common
JVM
JS
Native
1.3
fun ULongArray.copyOfRange(
    fromIndex: Int,
    toIndex: Int
): ULongArray
Common
JVM
JS
Native
1.3
fun UByteArray.copyOfRange(
    fromIndex: Int,
    toIndex: Int
): UByteArray
Common
JVM
JS
Native
1.3
fun UShortArray.copyOfRange(
    fromIndex: Int,
    toIndex: Int
): UShortArray
Common
JVM
Native
1.0
fun <T> Array<T>.copyOfRange(
    fromIndex: Int,
    toIndex: Int
): Array<T>
JS
1.1
fun <T> Array<out T>.copyOfRange(
    fromIndex: Int,
    toIndex: Int
): Array<T>
Common
JVM
JS
Native
1.0
fun ByteArray.copyOfRange(
    fromIndex: Int,
    toIndex: Int
): ByteArray
Common
JVM
JS
Native
1.0
fun ShortArray.copyOfRange(
    fromIndex: Int,
    toIndex: Int
): ShortArray
Common
JVM
JS
Native
1.0
fun IntArray.copyOfRange(
    fromIndex: Int,
    toIndex: Int
): IntArray
Common
JVM
JS
Native
1.0
fun LongArray.copyOfRange(
    fromIndex: Int,
    toIndex: Int
): LongArray
Common
JVM
JS
Native
1.0
fun FloatArray.copyOfRange(
    fromIndex: Int,
    toIndex: Int
): FloatArray
Common
JVM
JS
Native
1.0
fun DoubleArray.copyOfRange(
    fromIndex: Int,
    toIndex: Int
): DoubleArray
Common
JVM
JS
Native
1.0
fun BooleanArray.copyOfRange(
    fromIndex: Int,
    toIndex: Int
): BooleanArray
Common
JVM
JS
Native
1.0
fun CharArray.copyOfRange(
    fromIndex: Int,
    toIndex: Int
): CharArray
Common
JVM
JS
Native
1.0

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 UIntArray.count(predicate: (UInt) -> 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

Returns the number of entries matching the given predicate.

fun <K, V> Map<out K, V>.count(
    predicate: (Entry<K, V>) -> Boolean
): Int
Common
JVM
JS
Native
1.0

distinct

Returns a list containing only distinct elements from the given array.

fun <T> any_array<T>.distinct(): List<T>

Returns a list containing only distinct elements from the given collection.

fun <T> Iterable<T>.distinct(): List<T>
Common
JVM
JS
Native
1.0

distinctBy

Returns a list containing only elements from the given array having distinct keys returned by the given selector function.

fun <T, K> any_array<T>.distinctBy(
    selector: (T) -> K
): List<T>

Returns a list containing only elements from the given collection having distinct keys returned by the given selector function.

fun <T, K> Iterable<T>.distinctBy(
    selector: (T) -> K
): List<T>
Common
JVM
JS
Native
1.0

drop

Returns a list containing all elements except first n elements.

fun <T> Array<out T>.drop(n: Int): List<T>
fun ByteArray.drop(n: Int): List<Byte>
fun ShortArray.drop(n: Int): List<Short>
fun IntArray.drop(n: Int): List<Int>
fun LongArray.drop(n: Int): List<Long>
fun FloatArray.drop(n: Int): List<Float>
fun DoubleArray.drop(n: Int): List<Double>
fun BooleanArray.drop(n: Int): List<Boolean>
fun CharArray.drop(n: Int): List<Char>
fun <T> Iterable<T>.drop(n: Int): List<T>
fun UIntArray.drop(n: Int): List<UInt>
fun ULongArray.drop(n: Int): List<ULong>
fun UByteArray.drop(n: Int): List<UByte>
fun UShortArray.drop(n: Int): List<UShort>
Common
JVM
JS
Native
1.0

dropLast

Returns a list containing all elements except last n elements.

fun <T> Array<out T>.dropLast(n: Int): List<T>
fun ByteArray.dropLast(n: Int): List<Byte>
fun ShortArray.dropLast(n: Int): List<Short>
fun IntArray.dropLast(n: Int): List<Int>
fun LongArray.dropLast(n: Int): List<Long>
fun FloatArray.dropLast(n: Int): List<Float>
fun DoubleArray.dropLast(n: Int): List<Double>
fun BooleanArray.dropLast(n: Int): List<Boolean>
fun CharArray.dropLast(n: Int): List<Char>
fun <T> List<T>.dropLast(n: Int): List<T>
fun UIntArray.dropLast(n: Int): List<UInt>
fun ULongArray.dropLast(n: Int): List<ULong>
fun UByteArray.dropLast(n: Int): List<UByte>
fun UShortArray.dropLast(n: Int): List<UShort>
Common
JVM
JS
Native
1.0

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 ByteArray.dropLastWhile(
    predicate: (Byte) -> Boolean
): List<Byte>
fun ShortArray.dropLastWhile(
    predicate: (Short) -> Boolean
): List<Short>
fun IntArray.dropLastWhile(
    predicate: (Int) -> Boolean
): List<Int>
fun LongArray.dropLastWhile(
    predicate: (Long) -> Boolean
): List<Long>
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 CharArray.dropLastWhile(
    predicate: (Char) -> Boolean
): List<Char>
fun <T> List<T>.dropLastWhile(
    predicate: (T) -> Boolean
): List<T>
fun UIntArray.dropLastWhile(
    predicate: (UInt) -> Boolean
): List<UInt>
fun ULongArray.dropLastWhile(
    predicate: (ULong) -> Boolean
): List<ULong>
fun UByteArray.dropLastWhile(
    predicate: (UByte) -> Boolean
): List<UByte>
fun UShortArray.dropLastWhile(
    predicate: (UShort) -> Boolean
): List<UShort>
Common
JVM
JS
Native
1.0

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 ByteArray.dropWhile(
    predicate: (Byte) -> Boolean
): List<Byte>
fun ShortArray.dropWhile(
    predicate: (Short) -> Boolean
): List<Short>
fun IntArray.dropWhile(
    predicate: (Int) -> Boolean
): List<Int>
fun LongArray.dropWhile(
    predicate: (Long) -> Boolean
): List<Long>
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 CharArray.dropWhile(
    predicate: (Char) -> Boolean
): List<Char>
fun <T> Iterable<T>.dropWhile(
    predicate: (T) -> Boolean
): List<T>
fun UIntArray.dropWhile(
    predicate: (UInt) -> Boolean
): List<UInt>
fun ULongArray.dropWhile(
    predicate: (ULong) -> Boolean
): List<ULong>
fun UByteArray.dropWhile(
    predicate: (UByte) -> Boolean
): List<UByte>
fun UShortArray.dropWhile(
    predicate: (UShort) -> Boolean
): List<UShort>

eachCount

JS
1.1

Groups elements from the Grouping source by key and counts elements in each group.

fun <T, K> <ERROR CLASS><T, K>.eachCount(): Map<K, Int>
Common
JVM
Native
1.0

Groups elements from the Grouping source by key and counts elements in each group.

fun <T, K> Grouping<T, K>.eachCount(): Map<K, Int>
Common
JVM
JS
Native
1.1

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.

Common
JVM
JS
Native
1.0
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.

Common
JVM
JS
Native
1.0
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.

JS
1.3
fun <ERROR CLASS>.elementAt(index: Int): <ERROR CLASS>
Common
JVM
JS
Native
1.0
fun <T> Array<out T>.elementAt(index: Int): T
Common
JVM
JS
Native
1.0
fun ByteArray.elementAt(index: Int): Byte
Common
JVM
JS
Native
1.0
fun ShortArray.elementAt(index: Int): Short
Common
JVM
JS
Native
1.0
fun IntArray.elementAt(index: Int): Int
Common
JVM
JS
Native
1.0
fun LongArray.elementAt(index: Int): Long
Common
JVM
JS
Native
1.0
fun FloatArray.elementAt(index: Int): Float
Common
JVM
JS
Native
1.0
fun DoubleArray.elementAt(index: Int): Double
Common
JVM
JS
Native
1.0
fun BooleanArray.elementAt(index: Int): Boolean
Common
JVM
JS
Native
1.0
fun CharArray.elementAt(index: Int): Char
Common
JVM
Native
1.3
fun UIntArray.elementAt(index: Int): UInt
Common
JVM
Native
1.3
fun ULongArray.elementAt(index: Int): ULong
Common
JVM
Native
1.3
fun UByteArray.elementAt(index: Int): UByte
Common
JVM
Native
1.3
fun UShortArray.elementAt(index: Int): UShort
Common
JVM
JS
Native
1.0

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 UIntArray.elementAtOrElse(
    index: Int,
    defaultValue: (Int) -> UInt
): UInt
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
Common
JVM
JS
Native
1.0

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 UIntArray.elementAtOrNull(index: Int): UInt?
fun ULongArray.elementAtOrNull(index: Int): ULong?
fun UByteArray.elementAtOrNull(index: Int): UByte?
fun UShortArray.elementAtOrNull(index: Int): UShort?

Returns an element at the given index or null if the index is out of bounds of this collection.

fun <T> Iterable<T>.elementAtOrNull(index: Int): T?

Returns an element at the given index or null if the index is out of bounds of this list.

fun <T> List<T>.elementAtOrNull(index: Int): T?
Common
JVM
JS
Native
1.0

emptyList

Returns an empty read-only list. The returned list is serializable (JVM).

fun <T> emptyList(): List<T>
Common
JVM
JS
Native
1.0

emptyMap

Returns an empty read-only map of specified type.

fun <K, V> emptyMap(): Map<K, V>
Common
JVM
JS
Native
1.0

emptySet

Returns an empty read-only set. The returned set is serializable (JVM).

fun <T> emptySet(): Set<T>
Common
JVM
JS
Native
1.0

fill

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

fun UIntArray.fill(
    element: UInt,
    fromIndex: Int = 0,
    toIndex: Int = size)
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)
Common
JVM
JS
Native
1.0

filter

Returns a list containing only elements matching the given predicate.

fun <T> Array<out T>.filter(
    predicate: (T) -> Boolean
): List<T>
fun ByteArray.filter(
    predicate: (Byte) -> Boolean
): List<Byte>
fun ShortArray.filter(
    predicate: (Short) -> Boolean
): List<Short>
fun IntArray.filter(predicate: (Int) -> Boolean): List<Int>
fun LongArray.filter(
    predicate: (Long) -> Boolean
): List<Long>
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 CharArray.filter(
    predicate: (Char) -> Boolean
): List<Char>
fun <T> Iterable<T>.filter(
    predicate: (T) -> Boolean
): List<T>
fun UIntArray.filter(
    predicate: (UInt) -> Boolean
): List<UInt>
fun ULongArray.filter(
    predicate: (ULong) -> Boolean
): List<ULong>
fun UByteArray.filter(
    predicate: (UByte) -> Boolean
): List<UByte>
fun UShortArray.filter(
    predicate: (UShort) -> Boolean
): List<UShort>

Returns a new map containing all key-value pairs matching the given predicate.

fun <K, V> Map<out K, V>.filter(
    predicate: (Entry<K, V>) -> Boolean
): Map<K, V>
Common
JVM
JS
Native
1.0

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 ByteArray.filterIndexed(
    predicate: (index: Int, Byte) -> Boolean
): List<Byte>
fun ShortArray.filterIndexed(
    predicate: (index: Int, Short) -> Boolean
): List<Short>
fun IntArray.filterIndexed(
    predicate: (index: Int, Int) -> Boolean
): List<Int>
fun LongArray.filterIndexed(
    predicate: (index: Int, Long) -> Boolean
): List<Long>
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 CharArray.filterIndexed(
    predicate: (index: Int, Char) -> Boolean
): List<Char>
fun <T> Iterable<T>.filterIndexed(
    predicate: (index: Int, T) -> Boolean
): List<T>
fun UIntArray.filterIndexed(
    predicate: (index: Int, UInt) -> Boolean
): List<UInt>
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>
Common
JVM
JS
Native
1.0

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

Common
JVM
JS
Native
1.0

Returns a list containing all elements that are instances of specified type parameter R.

fun <R> Array<*>.filterIsInstance(): List<R>
fun <R> Iterable<*>.filterIsInstance(): List<R>
JVM
1.0

Returns a list containing all elements that are instances of specified class.

fun <R> Array<*>.filterIsInstance(klass: Class<R>): List<R>
fun <R> Iterable<*>.filterIsInstance(
    klass: Class<R>
): List<R>

filterIsInstanceTo

Common
JVM
JS
Native
1.0

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
JVM
1.0

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
Common
JVM
JS
Native
1.0

filterKeys

Returns a map containing all key-value pairs with keys matching the given predicate.

fun <K, V> Map<out K, V>.filterKeys(
    predicate: (K) -> Boolean
): Map<K, V>
Common
JVM
JS
Native
1.0

filterNot

Returns a list containing all elements not matching the given predicate.

fun <T> Array<out T>.filterNot(
    predicate: (T) -> Boolean
): List<T>
fun ByteArray.filterNot(
    predicate: (Byte) -> Boolean
): List<Byte>
fun ShortArray.filterNot(
    predicate: (Short) -> Boolean
): List<Short>
fun IntArray.filterNot(
    predicate: (Int) -> Boolean
): List<Int>
fun LongArray.filterNot(
    predicate: (Long) -> Boolean
): List<Long>
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 CharArray.filterNot(
    predicate: (Char) -> Boolean
): List<Char>
fun <T> Iterable<T>.filterNot(
    predicate: (T) -> Boolean
): List<T>
fun UIntArray.filterNot(
    predicate: (UInt) -> Boolean
): List<UInt>
fun ULongArray.filterNot(
    predicate: (ULong) -> Boolean
): List<ULong>
fun UByteArray.filterNot(
    predicate: (UByte) -> Boolean
): List<UByte>
fun UShortArray.filterNot(
    predicate: (UShort) -> Boolean
): List<UShort>

Returns a new map containing all key-value pairs not matching the given predicate.

fun <K, V> Map<out K, V>.filterNot(
    predicate: (Entry<K, V>) -> Boolean
): Map<K, V>
Common
JVM
JS
Native
1.0

filterNotNull

Returns a list containing all elements that are not null.

fun <T : Any> Array<out T?>.filterNotNull(): List<T>
fun <T : Any> Iterable<T?>.filterNotNull(): List<T>
Common
JVM
JS
Native
1.0

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
Common
JVM
JS
Native
1.0

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
Common
JVM
JS
Native
1.0

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
Common
JVM
JS
Native
1.0

filterValues

Returns a map containing all key-value pairs with values matching the given predicate.

fun <K, V> Map<out K, V>.filterValues(
    predicate: (V) -> Boolean
): Map<K, V>
Common
JVM
JS
Native
1.0

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 UIntArray.find(predicate: (UInt) -> Boolean): UInt?
fun ULongArray.find(predicate: (ULong) -> Boolean): ULong?
fun UByteArray.find(predicate: (UByte) -> Boolean): UByte?
fun UShortArray.find(predicate: (UShort) -> Boolean): UShort?
Common
JVM
JS
Native
1.0

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 UIntArray.findLast(predicate: (UInt) -> Boolean): UInt?
fun ULongArray.findLast(
    predicate: (ULong) -> Boolean
): ULong?
fun UByteArray.findLast(
    predicate: (UByte) -> Boolean
): UByte?
fun UShortArray.findLast(
    predicate: (UShort) -> Boolean
): UShort?
Common
JVM
JS
Native
1.0

first

Returns the 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 UIntArray.first(): UInt
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 UIntArray.first(predicate: (UInt) -> Boolean): UInt
fun ULongArray.first(predicate: (ULong) -> Boolean): ULong
fun UByteArray.first(predicate: (UByte) -> Boolean): UByte
fun UShortArray.first(predicate: (UShort) -> Boolean): UShort
Common
JVM
JS
Native
1.5

firstNotNullOf

Returns the first non-null value produced by transform function being applied to elements of this array in iteration order, or throws NoSuchElementException if no non-null value was produced.

fun <T, R : Any> Array<out T>.firstNotNullOf(
    transform: (T) -> R?
): R

Returns the first non-null value produced by transform function being applied to elements of this collection in iteration order, or throws NoSuchElementException if no non-null value was produced.

fun <T, R : Any> Iterable<T>.firstNotNullOf(
    transform: (T) -> R?
): R

Returns the first non-null value produced by transform function being applied to entries of this map in iteration order, or throws NoSuchElementException if no non-null value was produced.

fun <K, V, R : Any> Map<out K, V>.firstNotNullOf(
    transform: (Entry<K, V>) -> R?
): R
Common
JVM
JS
Native
1.5

firstNotNullOfOrNull

Returns the first non-null value produced by transform function being applied to elements of this array in iteration order, or null if no non-null value was produced.

fun <T, R : Any> Array<out T>.firstNotNullOfOrNull(
    transform: (T) -> R?
): R?

Returns the first non-null value produced by transform function being applied to elements of this collection in iteration order, or null if no non-null value was produced.

fun <T, R : Any> Iterable<T>.firstNotNullOfOrNull(
    transform: (T) -> R?
): R?

Returns the first non-null value produced by transform function being applied to entries of this map in iteration order, or null if no non-null value was produced.

fun <K, V, R : Any> Map<out K, V>.firstNotNullOfOrNull(
    transform: (Entry<K, V>) -> R?
): R?
Common
JVM
JS
Native
1.0

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 UIntArray.firstOrNull(): UInt?
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 UIntArray.firstOrNull(
    predicate: (UInt) -> Boolean
): UInt?
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?
Common
JVM
JS
Native
1.0

flatMap

Returns a single list of all elements yielded from results of transform function being invoked on each element of original array.

fun <T, R> Array<out T>.flatMap(
    transform: (T) -> Iterable<R>
): List<R>
fun <R> ByteArray.flatMap(
    transform: (Byte) -> Iterable<R>
): List<R>
fun <R> ShortArray.flatMap(
    transform: (Short) -> Iterable<R>
): List<R>
fun <R> IntArray.flatMap(
    transform: (Int) -> Iterable<R>
): List<R>
fun <R> LongArray.flatMap(
    transform: (Long) -> 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> CharArray.flatMap(
    transform: (Char) -> Iterable<R>
): List<R>
fun <T, R> Array<out T>.flatMap(
    transform: (T) -> Sequence<R>
): List<R>
fun <R> UIntArray.flatMap(
    transform: (UInt) -> 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.

fun <T, R> Iterable<T>.flatMap(
    transform: (T) -> Iterable<R>
): List<R>
fun <T, R> Iterable<T>.flatMap(
    transform: (T) -> Sequence<R>
): List<R>

Returns a single list of all elements yielded from results of transform function being invoked on each entry of original map.

fun <K, V, R> Map<out K, V>.flatMap(
    transform: (Entry<K, V>) -> Iterable<R>
): List<R>
fun <K, V, R> Map<out K, V>.flatMap(
    transform: (Entry<K, V>) -> Sequence<R>
): List<R>
Common
JVM
JS
Native
1.4

flatMapIndexed

Returns a single list of all elements yielded from results of transform function being invoked on each element and its index in the original array.

fun <T, R> Array<out T>.flatMapIndexed(
    transform: (index: Int, T) -> Iterable<R>
): List<R>
fun <R> ByteArray.flatMapIndexed(
    transform: (index: Int, Byte) -> Iterable<R>
): List<R>
fun <R> ShortArray.flatMapIndexed(
    transform: (index: Int, Short) -> Iterable<R>
): List<R>
fun <R> IntArray.flatMapIndexed(
    transform: (index: Int, Int) -> Iterable<R>
): List<R>
fun <R> LongArray.flatMapIndexed(
    transform: (index: Int, Long) -> Iterable<R>
): List<R>
fun <R> FloatArray.flatMapIndexed(
    transform: (index: Int, Float) -> Iterable<R>
): List<R>
fun <R> DoubleArray.flatMapIndexed(
    transform: (index: Int, Double) -> Iterable<R>
): List<R>
fun <R> BooleanArray.flatMapIndexed(
    transform: (index: Int, Boolean) -> Iterable<R>
): List<R>
fun <R> CharArray.flatMapIndexed(
    transform: (index: Int, Char) -> Iterable<R>
): List<R>
fun <T, R> Array<out T>.flatMapIndexed(
    transform: (index: Int, T) -> Sequence<R>
): List<R>
fun <R> UIntArray.flatMapIndexed(
    transform: (index: Int, UInt) -> Iterable<R>
): List<R>
fun <R> ULongArray.flatMapIndexed(
    transform: (index: Int, ULong) -> Iterable<R>
): List<R>
fun <R> UByteArray.flatMapIndexed(
    transform: (index: Int, UByte) -> Iterable<R>
): List<R>
fun <R> UShortArray.flatMapIndexed(
    transform: (index: Int, UShort) -> Iterable<R>
): List<R>

Returns a single list of all elements yielded from results of transform function being invoked on each element and its index in the original collection.

fun <T, R> Iterable<T>.flatMapIndexed(
    transform: (index: Int, T) -> Iterable<R>
): List<R>
fun <T, R> Iterable<T>.flatMapIndexed(
    transform: (index: Int, T) -> Sequence<R>
): List<R>
Common
JVM
JS
Native
1.4

flatMapIndexedTo

Appends all elements yielded from results of transform function being invoked on each element and its index in the original array, to the given destination.

fun <T, R, C : MutableCollection<in R>> Array<out T>.flatMapIndexedTo(
    destination: C,
    transform: (index: Int, T) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> ByteArray.flatMapIndexedTo(
    destination: C,
    transform: (index: Int, Byte) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> ShortArray.flatMapIndexedTo(
    destination: C,
    transform: (index: Int, Short) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> IntArray.flatMapIndexedTo(
    destination: C,
    transform: (index: Int, Int) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> LongArray.flatMapIndexedTo(
    destination: C,
    transform: (index: Int, Long) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> FloatArray.flatMapIndexedTo(
    destination: C,
    transform: (index: Int, Float) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> DoubleArray.flatMapIndexedTo(
    destination: C,
    transform: (index: Int, Double) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> BooleanArray.flatMapIndexedTo(
    destination: C,
    transform: (index: Int, Boolean) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> CharArray.flatMapIndexedTo(
    destination: C,
    transform: (index: Int, Char) -> Iterable<R>
): C
fun <T, R, C : MutableCollection<in R>> Array<out T>.flatMapIndexedTo(
    destination: C,
    transform: (index: Int, T) -> Sequence<R>
): C
fun <R, C : MutableCollection<in R>> UIntArray.flatMapIndexedTo(
    destination: C,
    transform: (index: Int, UInt) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> ULongArray.flatMapIndexedTo(
    destination: C,
    transform: (index: Int, ULong) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> UByteArray.flatMapIndexedTo(
    destination: C,
    transform: (index: Int, UByte) -> Iterable<R>
): C
fun <R, C : MutableCollection<in R>> UShortArray.flatMapIndexedTo(
    destination: C,
    transform: (index: Int, UShort) -> Iterable<R>
): C

Appends all elements yielded from results of transform function being invoked on each element and its index in the original collection, to the given destination.

fun <T, R, C : MutableCollection<in R>> Iterable<T>.flatMapIndexedTo(
    destination: C,
    transform: (index: Int, T) -> Iterable<R>
): C
fun <T, R, C : MutableCollection<in R>> Iterable<T>.flatMapIndexedTo(
    destination: C,
    transform: (index: Int, T) -> Sequence<R>
): C
Common
JVM
JS
Native
1.0

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 <T, R, C : MutableCollection<in R>> Array<out T>.flatMapTo(
    destination: C,
    transform: (T) -> Sequence<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