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
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
fun <T, R, C : MutableCollection<in R>> Iterable<T>.flatMapTo(
    destination: C,
    transform: (T) -> Sequence<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
fun <K, V, R, C : MutableCollection<in R>> Map<out K, V>.flatMapTo(
    destination: C,
    transform: (Entry<K, V>) -> Sequence<R>
): C
Common
JVM
JS
Native
1.0

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>

Returns a single list of all elements from all collections in the given collection.

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

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> UIntArray.fold(
    initial: R,
    operation: (acc: R, UInt) -> 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.

fun <T, K, R> Grouping<T, K>.fold(
    initialValueSelector: (key: K, element: T) -> R,
    operation: (key: K, accumulator: R, element: T) -> R
): Map<K, 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 the same initialValue for each group.

fun <T, K, R> Grouping<T, K>.fold(
    initialValue: R,
    operation: (accumulator: R, element: T) -> R
): Map<K, R>
Common
JVM
JS
Native
1.0

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> UIntArray.foldIndexed(
    initial: R,
    operation: (index: Int, acc: R, UInt) -> 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

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 collection.

fun <T, R> Iterable<T>.foldIndexed(
    initial: R,
    operation: (index: Int, acc: R, T) -> R
): R
Common
JVM
JS
Native
1.0

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> UIntArray.foldRight(
    initial: R,
    operation: (UInt, 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
Common
JVM
JS
Native
1.0

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> UIntArray.foldRightIndexed(
    initial: R,
    operation: (index: Int, UInt, 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

Accumulates value starting with initial value and applying operation from right to left to each element with its index in the original list and current accumulator value.

fun <T, R> List<T>.foldRightIndexed(
    initial: R,
    operation: (index: Int, T, acc: R) -> R
): R
Common
JVM
JS
Native
1.1

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

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 UIntArray.forEach(action: (UInt) -> 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.

fun <K, V> Map<out K, V>.forEach(
    action: (Entry<K, V>) -> Unit)

Performs the given operation on each element of this Iterator.

fun <T> Iterator<T>.forEach(operation: (T) -> Unit)
Common
JVM
JS
Native
1.0

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

get

Returns the value corresponding to the given key, or null if such a key is not present in the map.

operator fun <K, V> Map<out K, V>.get(key: K): V?
JVM
JRE8
1.2

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

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 UIntArray.getOrElse(
    index: Int,
    defaultValue: (Int) -> UInt
): UInt
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 if the value is present and not null. Otherwise, returns the result of the defaultValue function.

fun <K, V> Map<K, V>.getOrElse(
    key: K,
    defaultValue: () -> V
): V
Common
JVM
JS
Native
1.0

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

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

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

getOrPut

Returns the value for the given key if the value is present and not null. Otherwise, calls the defaultValue function, puts its result into the map under the given key and returns the call result.

fun <K, V> MutableMap<K, V>.getOrPut(
    key: K,
    defaultValue: () -> V
): V
Common
JVM
JS
Native
1.0

getValue

Returns the value of the property for the given object from this read-only map.

operator fun <V, V1 : V> Map<in String, V>.getValue(
    thisRef: Any?,
    property: KProperty<*>
): V1

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

Returns the value for the given key or throws an exception if there is no such key in the map.

fun <K, V> Map<K, V>.getValue(key: K): V
Common
JVM
JS
Native
1.0

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 <T, K> Array<out T>.groupBy(
    keySelector: (T) -> K
): Map<K, List<T>>
fun <K> ByteArray.groupBy(
    keySelector: (Byte) -> K
): Map<K, List<Byte>>
fun <K> ShortArray.groupBy(
    keySelector: (Short) -> K
): Map<K, List<Short>>
fun <K> IntArray.groupBy(
    keySelector: (Int) -> K
): Map<K, List<Int>>
fun <K> LongArray.groupBy(
    keySelector: (Long) -> K
): Map<K, List<Long>>
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> CharArray.groupBy(
    keySelector: (Char) -> K
): Map<K, List<Char>>
fun <K> UIntArray.groupBy(
    keySelector: (UInt) -> K
): Map<K, List<UInt>>
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 <T, K, V> Array<out T>.groupBy(
    keySelector: (T) -> K,
    valueTransform: (T) -> V
): Map<K, List<V>>
fun <K, V> ByteArray.groupBy(
    keySelector: (Byte) -> K,
    valueTransform: (Byte) -> V
): Map<K, List<V>>
fun <K, V> ShortArray.groupBy(
    keySelector: (Short) -> K,
    valueTransform: (Short) -> V
): Map<K, List<V>>
fun <K, V> IntArray.groupBy(
    keySelector: (Int) -> K,
    valueTransform: (Int) -> V
): Map<K, List<V>>
fun <K, V> LongArray.groupBy(
    keySelector: (Long) -> K,
    valueTransform: (Long) -> 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> CharArray.groupBy(
    keySelector: (Char) -> K,
    valueTransform: (Char) -> V
): Map<K, List<V>>
fun <K, V> UIntArray.groupBy(
    keySelector: (UInt) -> K,
    valueTransform: (UInt) -> 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.

fun <T, K> Iterable<T>.groupBy(
    keySelector: (T) -> K
): Map<K, List<T>>

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.

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

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

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.

fun <T, K> Iterable<T>.groupingBy(
    keySelector: (T) -> K
): Grouping<T, K>
Common
JVM
JS
Native
1.0

hashMapOf

Returns an empty new HashMap.

fun <K, V> hashMapOf(): HashMap<K, V>

Returns a new HashMap 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> hashMapOf(vararg pairs: Pair<K, V>): HashMap<K, V>
Common
JVM
JS
Native
1.0

hashSetOf

Returns an empty new HashSet.

fun <T> hashSetOf(): HashSet<T>

Returns a new HashSet with the given elements.

fun <T> hashSetOf(vararg elements: T): HashSet<T>
Common
JVM
JS
Native
1.3

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

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

Returns first index of element, or -1 if the collection does not contain element.

fun <T> Iterable<T>.indexOf(element: T): Int

Returns first index of element, or -1 if the list does not contain element.

fun <T> List<T>.indexOf(element: T): Int
Common
JVM
JS
Native
1.0

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

Returns index of the first element matching the given predicate, or -1 if the collection does not contain such element.

fun <T> Iterable<T>.indexOfFirst(
    predicate: (T) -> Boolean
): Int

Returns index of the first element matching the given predicate, or -1 if the list does not contain such element.

fun <T> List<T>.indexOfFirst(predicate: (T) -> Boolean): Int
Common
JVM
JS
Native
1.0

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

Returns index of the last element matching the given predicate, or -1 if the collection does not contain such element.

fun <T> Iterable<T>.indexOfLast(
    predicate: (T) -> Boolean
): Int

Returns index of the last element matching the given predicate, or -1 if the list does not contain such element.

fun <T> List<T>.indexOfLast(predicate: (T) -> Boolean): Int
Common
JVM
JS
Native
1.0

intersect

Returns a set containing all elements that are contained by both this array and the specified collection.

infix fun <T> any_array<T>.intersect(
    other: Iterable<T>
): Set<T>

Returns a set containing all elements that are contained by both this collection and the specified collection.

infix fun <T> Iterable<T>.intersect(
    other: Iterable<T>
): Set<T>
Common
JVM
JS
Native
1.0

isEmpty

Returns true if the array is empty.

fun <T> any_array<T>.isEmpty(): Boolean
Common
JVM
JS
Native
1.0

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

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

Iterable

Given an iterator function constructs an Iterable instance that returns values through the Iterator provided by that function.

fun <T> Iterable(iterator: () -> Iterator<T>): Iterable<T>
Common
JVM
JS
Native
1.0

iterator

Returns the given iterator itself. This allows to use an instance of iterator in a for loop.

operator fun <T> Iterator<T>.iterator(): Iterator<T>

Returns an Iterator over the entries in the Map.

operator fun <K, V> Map<out K, V>.iterator(): Iterator<Entry<K, V>>

Returns a MutableIterator over the mutable entries in the MutableMap.

operator fun <K, V> MutableMap<K, V>.iterator(): MutableIterator<MutableEntry<K, V>>
Common
JVM
JS
Native
1.0

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

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

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

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

Returns last index of element, or -1 if the collection does not contain element.

fun <T> Iterable<T>.lastIndexOf(element: T): Int

Returns last index of element, or -1 if the list does not contain element.

fun <T> List<T>.lastIndexOf(element: T): Int
Common
JVM
JS
Native
1.0

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

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

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>
JS
1.1

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: <ERROR CLASS><String, V>
): LinkedHashMap<String, V>
JS
1.1

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

List

Creates a new read-only list with the specified size, where each element is calculated by calling the specified init function.

fun <T> List(size: Int, init: (index: Int) -> T): List<T>
Common
JVM
JS
Native
1.0

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>

Returns a new read-only list containing only the specified object element.

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

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

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> ByteArray.map(transform: (Byte) -> R): List<R>
fun <R> ShortArray.map(transform: (Short) -> R): List<R>
fun <R> IntArray.map(transform: (Int) -> R): List<R>
fun <R> LongArray.map(transform: (Long) -> 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> CharArray.map(transform: (Char) -> R): List<R>
fun <R> UIntArray.map(transform: (UInt) -> 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.

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

Returns a list containing the results of applying the given transform function to each entry in the original map.

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

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> ByteArray.mapIndexed(
    transform: (index: Int, Byte) -> R
): List<R>
fun <R> ShortArray.mapIndexed(
    transform: (index: Int, Short) -> R
): List<R>
fun <R> IntArray.mapIndexed(
    transform: (index: Int, Int) -> R
): List<R>
fun <R> LongArray.mapIndexed(
    transform: (index: Int, Long) -> 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> CharArray.mapIndexed(
    transform: (index: Int, Char) -> R
): List<R>
fun <R> UIntArray.mapIndexed(
    transform: (index: Int, UInt) -> 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>

Returns a list containing the results of applying the given transform function to each element and its index in the original collection.

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

mapIndexedNotNull

Returns a list containing only the non-null results of applying the given transform function to each element and its index in the original array.

fun <T, R : Any> Array<out T>.mapIndexedNotNull(
    transform: (index: Int, T) -> R?
): List<R>

Returns a list containing only the non-null results of applying the given transform function to each element and its index in the original collection.

fun <T, R : Any> Iterable<T>.mapIndexedNotNull(
    transform: (index: Int, T) -> R?
): List<R>
Common
JVM
JS
Native
1.0

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

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

mapKeys

Returns a new 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> Map<out K, V>.mapKeys(
    transform: (Entry<K, V>) -> R
): Map<R, V>
Common
JVM
JS
Native
1.0

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

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.

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

Returns a list containing only the non-null results of applying the given transform function to each entry in the original map.

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

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.

Common
JVM
JS
Native
1.0
fun <K, V> mapOf(vararg pairs: Pair<K, V>): Map<K, V>

Returns an empty read-only map.

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

Returns a new read-only map, mapping only the specified key to the specified value.

JS
1.1
fun <K, V> mapOf(pair: <ERROR CLASS><K, V>): Map<K, V>
Common
JVM
Native
1.0
fun <K, V> mapOf(pair: Pair<K, V>): Map<K, V>
Common
JVM
JS
Native
1.0

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

mapValues

Returns a new 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> Map<out K, V>.mapValues(
    transform: (Entry<K, V>) -> R
): Map<K, R>
Common
JVM
JS
Native
1.0

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.

Common
JS
Native
1.7
fun Array<out Double>.max(): Double
JVM
1.1
fun Array<out Double>.max(): Double?
Common
JS
Native
1.7
fun Array<out Float>.max(): Float
JVM
1.1
fun Array<out Float>.max(): Float?
Common
JS
Native
1.7
fun <T : Comparable<T>> Array<out T>.max(): T
JVM
1.0
fun <T : Comparable<T>> Array<out T>.max(): T?
Common
JS
Native
1.7
fun ByteArray.max(): Byte
JVM
1.0
fun ByteArray.max(): Byte?
Common
JS
Native
1.7
fun ShortArray.max(): Short
JVM
1.0
fun ShortArray.max(): Short?
Common
JS
Native
1.7
fun IntArray.max(): Int
JVM
1.0
fun IntArray.max(): Int?
Common
JS
Native
1.7
fun LongArray.max(): Long
JVM
1.0
fun LongArray.max(): Long?
Common
JS
Native
1.7
fun FloatArray.max(): Float
JVM
1.0
fun FloatArray.max(): Float?
Common
JS
Native
1.7
fun DoubleArray.max(): Double
JVM
1.0
fun DoubleArray.max(): Double?
Common
JS
Native
1.7
fun CharArray.max(): Char
JVM
1.0
fun CharArray.max(): Char?
Common
JS
Native
1.7
fun Iterable<Double>.max(): Double
JVM
1.1
fun Iterable<Double>.max(): Double?
Common
JS
Native
1.7
fun Iterable<Float>.max(): Float
JVM
1.1
fun Iterable<Float>.max(): Float?
Common
JS
Native
1.7
fun <T : Comparable<T>> Iterable<T>.max(): T
JVM
1.0
fun <T : Comparable<T>> Iterable<T>.max(): T?
Common
JS
Native
1.7
fun UIntArray.max(): UInt
JVM
1.3
fun UIntArray.max(): UInt?
Common
JS
Native
1.7
fun ULongArray.max(): ULong
JVM
1.3
fun ULongArray.max(): ULong?
Common
JS
Native
1.7
fun UByteArray.max(): UByte
JVM
1.3
fun UByteArray.max(): UByte?
Common
JS
Native
1.7
fun UShortArray.max(): UShort
JVM
1.3
fun UShortArray.max(): UShort?

maxBy

Returns the first element yielding the largest value of the given function.

Common
JS
Native
1.7
fun <T, R : Comparable<R>> Array<out T>.maxBy(
    selector: (T) -> R
): T
JVM
1.0
fun <T, R : Comparable<R>> Array<out T>.maxBy(
    selector: (T) -> R
): T?
Common
JS
Native
1.7
fun <R : Comparable<R>> ByteArray.maxBy(
    selector: (Byte) -> R
): Byte
JVM
1.0
fun <R : Comparable<R>> ByteArray.maxBy(
    selector: (Byte) -> R
): Byte?
Common
JS
Native
1.7
fun <R : Comparable<R>> ShortArray.maxBy(
    selector: (Short) -> R
): Short
JVM
1.0
fun <R : Comparable<R>> ShortArray.maxBy(
    selector: (Short) -> R
): Short?
Common
JS
Native
1.7
fun <R : Comparable<R>> IntArray.maxBy(
    selector: (Int) -> R
): Int
JVM
1.0
fun <R : Comparable<R>> IntArray.maxBy(
    selector: (Int) -> R
): Int?
Common
JS
Native
1.7
fun <R : Comparable<R>> LongArray.maxBy(
    selector: (Long) -> R
): Long
JVM
1.0
fun <R : Comparable<R>> LongArray.maxBy(
    selector: (Long) -> R
): Long?
Common
JS
Native
1.7
fun <R : Comparable<R>> FloatArray.maxBy(
    selector: (Float) -> R
): Float
JVM
1.0
fun <R : Comparable<R>> FloatArray.maxBy(
    selector: (Float) -> R
): Float?
Common
JS
Native
1.7
fun <R : Comparable<R>> DoubleArray.maxBy(
    selector: (Double) -> R
): Double
JVM
1.0
fun <R : Comparable<R>> DoubleArray.maxBy(
    selector: (Double) -> R
): Double?
Common
JS
Native
1.7
fun <R : Comparable<R>> BooleanArray.maxBy(
    selector: (Boolean) -> R
): Boolean
JVM
1.0
fun <R : Comparable<R>> BooleanArray.maxBy(
    selector: (Boolean) -> R
): Boolean?
Common
JS
Native
1.7
fun <R : Comparable<R>> CharArray.maxBy(
    selector: (Char) -> R
): Char
JVM
1.0
fun <R : Comparable<R>> CharArray.maxBy(
    selector: (Char) -> R
): Char?
Common
JS
Native
1.7
fun <T, R : Comparable<R>> Iterable<T>.maxBy(
    selector: (T) -> R
): T
JVM
1.0
fun <T, R : Comparable<R>> Iterable<T>.maxBy(
    selector: (T) -> R
): T?
Common
JS
Native
1.7
fun <R : Comparable<R>> UIntArray.maxBy(
    selector: (UInt) -> R
): UInt
JVM
1.3
fun <R : Comparable<R>> UIntArray.maxBy(
    selector: (UInt) -> R
): UInt?
Common
JS
Native
1.7
fun <R : Comparable<R>> ULongArray.maxBy(
    selector: (ULong) -> R
): ULong
JVM
1.3
fun <R : Comparable<R>> ULongArray.maxBy(
    selector: (ULong) -> R
): ULong?
Common
JS
Native
1.7
fun <R : Comparable<R>> UByteArray.maxBy(
    selector: (UByte) -> R
): UByte
JVM
1.3
fun <R : Comparable<R>> UByteArray.maxBy(
    selector: (UByte) -> R
): UByte?
Common
JS
Native
1.7
fun <R : Comparable<R>> UShortArray.maxBy(
    selector: (UShort) -> R
): UShort
JVM
1.3
fun <R : Comparable<R>> UShortArray.maxBy(
    selector: (UShort) -> R
): UShort?

Returns the first entry yielding the largest value of the given function.

Common
JS
Native
1.7
fun <K, V, R : Comparable<R>> Map<out K, V>.maxBy(
    selector: (Entry<K, V>) -> R
): Entry<K, V>
JVM
1.0
fun <K, V, R : Comparable<R>> Map<out K, V>.maxBy(
    selector: (Entry<K, V>) -> R
): Entry<K, V>?
Common
JVM
JS
Native
1.4

maxByOrNull

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>.maxByOrNull(
    selector: (T) -> R
): T?
fun <R : Comparable<R>> ByteArray.maxByOrNull(
    selector: (Byte) -> R
): Byte?
fun <R : Comparable<R>> ShortArray.maxByOrNull(
    selector: (Short) -> R
): Short?
fun <R : Comparable<R>> IntArray.maxByOrNull(
    selector: (Int) -> R
): Int?
fun <R : Comparable<R>> LongArray.maxByOrNull(
    selector: (Long) -> R
): Long?
fun <R : Comparable<R>> FloatArray.maxByOrNull(
    selector: (Float) -> R
): Float?
fun <R : Comparable<R>> DoubleArray.maxByOrNull(
    selector: (Double) -> R
): Double?
fun <R : Comparable<R>> BooleanArray.maxByOrNull(
    selector: (Boolean) -> R
): Boolean?
fun <R : Comparable<R>> CharArray.maxByOrNull(
    selector: (Char) -> R
): Char?
fun <T, R : Comparable<R>> Iterable<T>.maxByOrNull(
    selector: (T) -> R
): T?
fun <R : Comparable<R>> UIntArray.maxByOrNull(
    selector: (UInt) -> R
): UInt?
fun <R : Comparable<R>> ULongArray.maxByOrNull(
    selector: (ULong) -> R
): ULong?
fun <R : Comparable<R>> UByteArray.maxByOrNull(
    selector: (UByte) -> R
): UByte?
fun <R : Comparable<R>> UShortArray.maxByOrNull(
    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>.maxByOrNull(
    selector: (Entry<K, V>) -> R
): Entry<K, V>?
Common
JVM
JS
Native
1.4

maxOf

Returns the largest value among all values produced by selector function applied to each element in the array.

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

Returns the largest value among all values produced by selector function applied to each element in the collection.

fun <T> Iterable<T>.maxOf(selector: (T) -> Double): Double
fun <T> Iterable<T>.maxOf(selector: (T) -> Float): Float
fun <T, R : Comparable<R>> Iterable<T>.maxOf(
    selector: (T) -> R
): R

Returns the largest value among all values produced by selector function applied to each entry in the map.

fun <K, V> Map<out K, V>.maxOf(
    selector: (Entry<K, V>) -> Double
): Double
fun <K, V> Map<out K, V>.maxOf(
    selector: (Entry<K, V>) -> Float
): Float
fun <K, V, R : Comparable<R>> Map<out K, V>.maxOf(
    selector: (Entry<K, V>) -> R
): R
Common
JVM
JS
Native
1.4

maxOfOrNull

Returns the largest value among all values produced by selector function applied to each element in the array or null if there are no elements.

fun <T> Array<out T>.maxOfOrNull(
    selector: (T) -> Double
): Double?
fun ByteArray.maxOfOrNull(
    selector: (Byte) -> Double
): Double?
fun ShortArray.maxOfOrNull(
    selector: (Short) -> Double
): Double?
fun IntArray.maxOfOrNull(selector: (Int) -> Double): Double?
fun LongArray.maxOfOrNull(
    selector: (Long) -> Double
): Double?
fun FloatArray.maxOfOrNull(
    selector: (Float) -> Double
): Double?
fun DoubleArray.maxOfOrNull(
    selector: (Double) -> Double
): Double?
fun BooleanArray.maxOfOrNull(
    selector: (Boolean) -> Double
): Double?
fun CharArray.maxOfOrNull(
    selector: (Char) -> Double
): Double?
fun <T> Array<out T>.maxOfOrNull(
    selector: (T) -> Float
): Float?
fun ByteArray.maxOfOrNull(selector: (Byte) -> Float): Float?
fun ShortArray.maxOfOrNull(
    selector: (Short) -> Float
): Float?
fun IntArray.maxOfOrNull(selector: (Int) -> Float): Float?
fun LongArray.maxOfOrNull(selector: (Long) -> Float): Float?
fun FloatArray.maxOfOrNull(
    selector: (Float) -> Float
): Float?
fun DoubleArray.maxOfOrNull(
    selector: (Double) -> Float
): Float?
fun BooleanArray.maxOfOrNull(
    selector: (Boolean) -> Float
): Float?
fun CharArray.maxOfOrNull(selector: (Char) -> Float): Float?
fun <T, R : Comparable<R>> Array<out T>.maxOfOrNull(
    selector: (T) -> R
): R?
fun <R : Comparable<R>> ByteArray.maxOfOrNull(
    selector: (Byte) -> R
): R?
fun <R : Comparable<R>> ShortArray.maxOfOrNull(
    selector: (Short) -> R
): R?
fun <R : Comparable<R>> IntArray.maxOfOrNull(
    selector: (Int) -> R
): R?
fun <R : Comparable<R>> LongArray.maxOfOrNull(
    selector: (Long) -> R
): R?
fun <R : Comparable<R>> FloatArray.maxOfOrNull(
    selector: (Float) -> R
): R?
fun <R : Comparable<R>> DoubleArray.maxOfOrNull(
    selector: (Double) -> R
): R?
fun <R : Comparable<R>> BooleanArray.maxOfOrNull(
    selector: (Boolean) -> R
): R?
fun <R : Comparable<R>> CharArray.maxOfOrNull(
    selector: (Char) -> R
): R?
fun UIntArray.maxOfOrNull(
    selector: (UInt) -> Double
): Double?
fun ULongArray.maxOfOrNull(
    selector: (ULong) -> Double
): Double?
fun UByteArray.maxOfOrNull(
    selector: (UByte) -> Double
): Double?
fun UShortArray.maxOfOrNull(
    selector: (UShort) -> Double
): Double?
fun UIntArray.maxOfOrNull(selector: (UInt) -> Float): Float?
fun ULongArray.maxOfOrNull(
    selector: (ULong) -> Float
): Float?
fun UByteArray.maxOfOrNull(
    selector: (UByte) -> Float
): Float?
fun UShortArray.maxOfOrNull(
    selector: (UShort) -> Float
): Float?
fun <R : Comparable<R>> UIntArray.maxOfOrNull(
    selector: (UInt) -> R
): R?
fun <R : Comparable<R>> ULongArray.maxOfOrNull(
    selector: (ULong) -> R
): R?
fun <R : Comparable<R>> UByteArray.maxOfOrNull(
    selector: (UByte) -> R
): R?
fun <R : Comparable<R>> UShortArray.maxOfOrNull(
    selector: (UShort) -> R
): R?

Returns the largest value among all values produced by selector function applied to each element in the collection or null if there are no elements.

fun <T> Iterable<T>.maxOfOrNull(
    selector: (T) -> Double
): Double?
fun <T> Iterable<T>.maxOfOrNull(
    selector: (T) -> Float
): Float?
fun <T, R : Comparable<R>> Iterable<T>.maxOfOrNull(
    selector: (T) -> R
): R?

Returns the largest value among all values produced by selector function applied to each entry in the map or null if there are no entries.

fun <K, V> Map<out K, V>.maxOfOrNull(
    selector: (Entry<K, V>) -> Double
): Double?
fun <K, V> Map<out K, V>.maxOfOrNull(
    selector: (Entry<K, V>) -> Float
): Float?
fun <K, V, R : Comparable<R>> Map<out K, V>.maxOfOrNull(
    selector: (Entry<K, V>) -> R
): R?
Common
JVM
JS
Native
1.4

maxOfWith

Returns the largest value according to the provided comparator among all values produced by selector function applied to each element in the array.

fun <T, R> Array<out T>.maxOfWith(
    comparator: Comparator<in R>,
    selector: (T) -> R
): R
fun <R> ByteArray.maxOfWith(
    comparator: Comparator<in R>,
    selector: (Byte) -> R
): R
fun <R> ShortArray.maxOfWith(
    comparator: Comparator<in R>,
    selector: (Short) -> R
): R
fun <R> IntArray.maxOfWith(
    comparator: Comparator<in R>,
    selector: (Int) -> R
): R
fun <R> LongArray.maxOfWith(
    comparator: Comparator<in R>,
    selector: (Long) -> R
): R
fun <R> FloatArray.maxOfWith(
    comparator: Comparator<in R>,
    selector: (Float) -> R
): R
fun <R> DoubleArray.maxOfWith(
    comparator: Comparator<in R>,
    selector: (Double) -> R
): R
fun <R> BooleanArray.maxOfWith(
    comparator: Comparator<in R>,
    selector: (Boolean) -> R
): R
fun <R> CharArray.maxOfWith(
    comparator: Comparator<in R>,
    selector: (Char) -> R
): R
fun <R> UIntArray.maxOfWith(
    comparator: Comparator<in R>,
    selector: (UInt) -> R
): R
fun <R> ULongArray.maxOfWith(
    comparator: Comparator<in R>,
    selector: (ULong) -> R
): R
fun <R> UByteArray.maxOfWith(
    comparator: Comparator<in R>,
    selector: (UByte) -> R
): R
fun <R> UShortArray.maxOfWith(
    comparator: Comparator<in R>,
    selector: (UShort) -> R
): R

Returns the largest value according to the provided comparator among all values produced by selector function applied to each element in the collection.

fun <T, R> Iterable<T>.maxOfWith(
    comparator: Comparator<in R>,
    selector: (T) -> R
): R

Returns the largest value according to the provided comparator among all values produced by selector function applied to each entry in the map.

fun <K, V, R> Map<out K, V>.maxOfWith(
    comparator: Comparator<in R>,
    selector: (Entry<K, V>) -> R
): R
Common
JVM
JS
Native
1.4

maxOfWithOrNull

Returns the largest value according to the provided comparator among all values produced by selector function applied to each element in the array or null if there are no elements.

fun <T, R> Array<out T>.maxOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (T) -> R
): R?
fun <R> ByteArray.maxOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (Byte) -> R
): R?
fun <R> ShortArray.maxOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (Short) -> R
): R?
fun <R> IntArray.maxOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (Int) -> R
): R?
fun <R> LongArray.maxOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (Long) -> R
): R?
fun <R> FloatArray.maxOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (Float) -> R
): R?
fun <R> DoubleArray.maxOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (Double) -> R
): R?
fun <R> BooleanArray.maxOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (Boolean) -> R
): R?
fun <R> CharArray.maxOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (Char) -> R
): R?
fun <R> UIntArray.maxOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (UInt) -> R
): R?
fun <R> ULongArray.maxOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (ULong) -> R
): R?
fun <R> UByteArray.maxOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (UByte) -> R
): R?
fun <R> UShortArray.maxOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (UShort) -> R
): R?

Returns the largest value according to the provided comparator among all values produced by selector function applied to each element in the collection or null if there are no elements.

fun <T, R> Iterable<T>.maxOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (T) -> R
): R?

Returns the largest value according to the provided comparator among all values produced by selector function applied to each entry in the map or null if there are no entries.

fun <K, V, R> Map<out K, V>.maxOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (Entry<K, V>) -> R
): R?
Common
JVM
JS
Native
1.4

maxOrNull

Returns the largest element or null if there are no elements.

fun Array<out Double>.maxOrNull(): Double?
fun Array<out Float>.maxOrNull(): Float?
fun <T : Comparable<T>> Array<out T>.maxOrNull(): T?
fun ByteArray.maxOrNull(): Byte?
fun ShortArray.maxOrNull(): Short?
fun IntArray.maxOrNull(): Int?
fun LongArray.maxOrNull(): Long?
fun FloatArray.maxOrNull(): Float?
fun DoubleArray.maxOrNull(): Double?
fun CharArray.maxOrNull(): Char?
fun Iterable<Double>.maxOrNull(): Double?
fun Iterable<Float>.maxOrNull(): Float?
fun <T : Comparable<T>> Iterable<T>.maxOrNull(): T?
fun UIntArray.maxOrNull(): UInt?
fun ULongArray.maxOrNull(): ULong?
fun UByteArray.maxOrNull(): UByte?
fun UShortArray.maxOrNull(): UShort?

maxWith

Common
JVM
JS
Native
1.7

Returns the first element having the largest value according to the provided comparator.

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

Returns the first entry having the largest value according to the provided comparator.

fun <K, V> Map<out K, V>.maxWith(
    comparator: Comparator<in Entry<K, V>>
): Entry<K, V>
JVM
1.0
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 <K, V> Map<out K, V>.maxWith(
    comparator: Comparator<in Entry<K, V>>
): Entry<K, V>?
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?
Common
JVM
JS
Native
1.4

maxWithOrNull

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>.maxWithOrNull(
    comparator: Comparator<in T>
): T?
fun ByteArray.maxWithOrNull(
    comparator: Comparator<in Byte>
): Byte?
fun ShortArray.maxWithOrNull(
    comparator: Comparator<in Short>
): Short?
fun IntArray.maxWithOrNull(
    comparator: Comparator<in Int>
): Int?
fun LongArray.maxWithOrNull(
    comparator: Comparator<in Long>
): Long?
fun FloatArray.maxWithOrNull(
    comparator: Comparator<in Float>
): Float?
fun DoubleArray.maxWithOrNull(
    comparator: Comparator<in Double>
): Double?
fun BooleanArray.maxWithOrNull(
    comparator: Comparator<in Boolean>
): Boolean?
fun CharArray.maxWithOrNull(
    comparator: Comparator<in Char>
): Char?
fun <T> Iterable<T>.maxWithOrNull(
    comparator: Comparator<in T>
): T?
fun UIntArray.maxWithOrNull(
    comparator: Comparator<in UInt>
): UInt?
fun ULongArray.maxWithOrNull(
    comparator: Comparator<in ULong>
): ULong?
fun UByteArray.maxWithOrNull(
    comparator: Comparator<in UByte>
): UByte?
fun UShortArray.maxWithOrNull(
    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>.maxWithOrNull(
    comparator: Comparator<in Entry<K, V>>
): Entry<K, V>?

min

Returns the smallest element.

Common
JS
Native
1.7
fun Array<out Double>.min(): Double
JVM
1.1
fun Array<out Double>.min(): Double?
Common
JS
Native
1.7
fun Array<out Float>.min(): Float
JVM
1.1
fun Array<out Float>.min(): Float?
Common
JS
Native
1.7
fun <T : Comparable<T>> Array<out T>.min(): T
JVM
1.0
fun <T : Comparable<T>> Array<out T>.min(): T?
Common
JS
Native
1.7
fun ByteArray.min(): Byte
JVM
1.0
fun ByteArray.min(): Byte?
Common
JS
Native
1.7
fun ShortArray.min(): Short
JVM
1.0
fun ShortArray.min(): Short?
Common
JS
Native
1.7
fun IntArray.min(): Int
JVM
1.0
fun IntArray.min(): Int?
Common
JS
Native
1.7
fun LongArray.min(): Long
JVM
1.0
fun LongArray.min(): Long?
Common
JS
Native
1.7
fun FloatArray.min(): Float
JVM
1.0
fun FloatArray.min(): Float?
Common
JS
Native
1.7
fun DoubleArray.min(): Double
JVM
1.0
fun DoubleArray.min(): Double?
Common
JS
Native
1.7
fun CharArray.min(): Char
JVM
1.0
fun CharArray.min(): Char?
Common
JS
Native
1.7
fun Iterable<Double>.min(): Double
JVM
1.1
fun Iterable<Double>.min(): Double?
Common
JS
Native
1.7
fun Iterable<Float>.min(): Float
JVM
1.1
fun Iterable<Float>.min(): Float?
Common
JS
Native
1.7
fun <T : Comparable<T>> Iterable<T>.min(): T
JVM
1.0
fun <T : Comparable<T>> Iterable<T>.min(): T?
Common
JS
Native
1.7
fun UIntArray.min(): UInt
JVM
1.3
fun UIntArray.min(): UInt?
Common
JS
Native
1.7
fun ULongArray.min(): ULong
JVM
1.3
fun ULongArray.min(): ULong?
Common
JS
Native
1.7
fun UByteArray.min(): UByte
JVM
1.3
fun UByteArray.min(): UByte?
Common
JS
Native
1.7
fun UShortArray.min(): UShort
JVM
1.3
fun UShortArray.min(): UShort?

minBy

Returns the first element yielding the smallest value of the given function.

Common
JS
Native
1.7
fun <T, R : Comparable<R>> Array<out T>.minBy(
    selector: (T) -> R
): T
JVM
1.0
fun <T, R : Comparable<R>> Array<out T>.minBy(
    selector: (T) -> R
): T?
Common
JS
Native
1.7
fun <R : Comparable<R>> ByteArray.minBy(
    selector: (Byte) -> R
): Byte
JVM
1.0
fun <R : Comparable<R>> ByteArray.minBy(
    selector: (Byte) -> R
): Byte?
Common
JS
Native
1.7
fun <R : Comparable<R>> ShortArray.minBy(
    selector: (Short) -> R
): Short
JVM
1.0
fun <R : Comparable<R>> ShortArray.minBy(
    selector: (Short) -> R
): Short?
Common
JS
Native
1.7
fun <R : Comparable<R>> IntArray.minBy(
    selector: (Int) -> R
): Int
JVM
1.0
fun <R : Comparable<R>> IntArray.minBy(
    selector: (Int) -> R
): Int?
Common
JS
Native
1.7
fun <R : Comparable<R>> LongArray.minBy(
    selector: (Long) -> R
): Long
JVM
1.0
fun <R : Comparable<R>> LongArray.minBy(
    selector: (Long) -> R
): Long?
Common
JS
Native
1.7
fun <R : Comparable<R>> FloatArray.minBy(
    selector: (Float) -> R
): Float
JVM
1.0
fun <R : Comparable<R>> FloatArray.minBy(
    selector: (Float) -> R
): Float?
Common
JS
Native
1.7
fun <R : Comparable<R>> DoubleArray.minBy(
    selector: (Double) -> R
): Double
JVM
1.0
fun <R : Comparable<R>> DoubleArray.minBy(
    selector: (Double) -> R
): Double?
Common
JS
Native
1.7
fun <R : Comparable<R>> BooleanArray.minBy(
    selector: (Boolean) -> R
): Boolean
JVM
1.0
fun <R : Comparable<R>> BooleanArray.minBy(
    selector: (Boolean) -> R
): Boolean?
Common
JS
Native
1.7
fun <R : Comparable<R>> CharArray.minBy(
    selector: (Char) -> R
): Char
JVM
1.0
fun <R : Comparable<R>> CharArray.minBy(
    selector: (Char) -> R
): Char?
Common
JS
Native
1.7
fun <T, R : Comparable<R>> Iterable<T>.minBy(
    selector: (T) -> R
): T
JVM
1.0
fun <T, R : Comparable<R>> Iterable<T>.minBy(
    selector: (T) -> R
): T?
Common
JS
Native
1.7
fun <R : Comparable<R>> UIntArray.minBy(
    selector: (UInt) -> R
): UInt
JVM
1.3
fun <R : Comparable<R>> UIntArray.minBy(
    selector: (UInt) -> R
): UInt?
Common
JS
Native
1.7
fun <R : Comparable<R>> ULongArray.minBy(
    selector: (ULong) -> R
): ULong
JVM
1.3
fun <R : Comparable<R>> ULongArray.minBy(
    selector: (ULong) -> R
): ULong?
Common
JS
Native
1.7
fun <R : Comparable<R>> UByteArray.minBy(
    selector: (UByte) -> R
): UByte
JVM
1.3
fun <R : Comparable<R>> UByteArray.minBy(
    selector: (UByte) -> R
): UByte?
Common
JS
Native
1.7
fun <R : Comparable<R>> UShortArray.minBy(
    selector: (UShort) -> R
): UShort
JVM
1.3
fun <R : Comparable<R>> UShortArray.minBy(
    selector: (UShort) -> R
): UShort?

Returns the first entry yielding the smallest value of the given function.

Common
JS
Native
1.7
fun <K, V, R : Comparable<R>> Map<out K, V>.minBy(
    selector: (Entry<K, V>) -> R
): Entry<K, V>
JVM
1.0
fun <K, V, R : Comparable<R>> Map<out K, V>.minBy(
    selector: (Entry<K, V>) -> R
): Entry<K, V>?
Common
JVM
JS
Native
1.4

minByOrNull

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>.minByOrNull(
    selector: (T) -> R
): T?
fun <R : Comparable<R>> ByteArray.minByOrNull(
    selector: (Byte) -> R
): Byte?
fun <R : Comparable<R>> ShortArray.minByOrNull(
    selector: (Short) -> R
): Short?
fun <R : Comparable<R>> IntArray.minByOrNull(
    selector: (Int) -> R
): Int?
fun <R : Comparable<R>> LongArray.minByOrNull(
    selector: (Long) -> R
): Long?
fun <R : Comparable<R>> FloatArray.minByOrNull(
    selector: (Float) -> R
): Float?
fun <R : Comparable<R>> DoubleArray.minByOrNull(
    selector: (Double) -> R
): Double?
fun <R : Comparable<R>> BooleanArray.minByOrNull(
    selector: (Boolean) -> R
): Boolean?
fun <R : Comparable<R>> CharArray.minByOrNull(
    selector: (Char) -> R
): Char?
fun <T, R : Comparable<R>> Iterable<T>.minByOrNull(
    selector: (T) -> R
): T?
fun <R : Comparable<R>> UIntArray.minByOrNull(
    selector: (UInt) -> R
): UInt?
fun <R : Comparable<R>> ULongArray.minByOrNull(
    selector: (ULong) -> R
): ULong?
fun <R : Comparable<R>> UByteArray.minByOrNull(
    selector: (UByte) -> R
): UByte?
fun <R : Comparable<R>> UShortArray.minByOrNull(
    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>.minByOrNull(
    selector: (Entry<K, V>) -> R
): Entry<K, V>?
Common
JVM
JS
Native
1.4

minOf

Returns the smallest value among all values produced by selector function applied to each element in the array.

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

Returns the smallest value among all values produced by selector function applied to each element in the collection.

fun <T> Iterable<T>.minOf(selector: (T) -> Double): Double
fun <T> Iterable<T>.minOf(selector: (T) -> Float): Float
fun <T, R : Comparable<R>> Iterable<T>.minOf(
    selector: (T) -> R
): R

Returns the smallest value among all values produced by selector function applied to each entry in the map.

fun <K, V> Map<out K, V>.minOf(
    selector: (Entry<K, V>) -> Double
): Double
fun <K, V> Map<out K, V>.minOf(
    selector: (Entry<K, V>) -> Float
): Float
fun <K, V, R : Comparable<R>> Map<out K, V>.minOf(
    selector: (Entry<K, V>) -> R
): R
Common
JVM
JS
Native
1.4

minOfOrNull

Returns the smallest value among all values produced by selector function applied to each element in the array or null if there are no elements.

fun <T> Array<out T>.minOfOrNull(
    selector: (T) -> Double
): Double?
fun ByteArray.minOfOrNull(
    selector: (Byte) -> Double
): Double?
fun ShortArray.minOfOrNull(
    selector: (Short) -> Double
): Double?
fun IntArray.minOfOrNull(selector: (Int) -> Double): Double?
fun LongArray.minOfOrNull(
    selector: (Long) -> Double
): Double?
fun FloatArray.minOfOrNull(
    selector: (Float) -> Double
): Double?
fun DoubleArray.minOfOrNull(
    selector: (Double) -> Double
): Double?
fun BooleanArray.minOfOrNull(
    selector: (Boolean) -> Double
): Double?
fun CharArray.minOfOrNull(
    selector: (Char) -> Double
): Double?
fun <T> Array<out T>.minOfOrNull(
    selector: (T) -> Float
): Float?
fun ByteArray.minOfOrNull(selector: (Byte) -> Float): Float?
fun ShortArray.minOfOrNull(
    selector: (Short) -> Float
): Float?
fun IntArray.minOfOrNull(selector: (Int) -> Float): Float?
fun LongArray.minOfOrNull(selector: (Long) -> Float): Float?
fun FloatArray.minOfOrNull(
    selector: (Float) -> Float
): Float?
fun DoubleArray.minOfOrNull(
    selector: (Double) -> Float
): Float?
fun BooleanArray.minOfOrNull(
    selector: (Boolean) -> Float
): Float?
fun CharArray.minOfOrNull(selector: (Char) -> Float): Float?
fun <T, R : Comparable<R>> Array<out T>.minOfOrNull(
    selector: (T) -> R
): R?
fun <R : Comparable<R>> ByteArray.minOfOrNull(
    selector: (Byte) -> R
): R?
fun <R : Comparable<R>> ShortArray.minOfOrNull(
    selector: (Short) -> R
): R?
fun <R : Comparable<R>> IntArray.minOfOrNull(
    selector: (Int) -> R
): R?
fun <R : Comparable<R>> LongArray.minOfOrNull(
    selector: (Long) -> R
): R?
fun <R : Comparable<R>> FloatArray.minOfOrNull(
    selector: (Float) -> R
): R?
fun <R : Comparable<R>> DoubleArray.minOfOrNull(
    selector: (Double) -> R
): R?
fun <R : Comparable<R>> BooleanArray.minOfOrNull(
    selector: (Boolean) -> R
): R?
fun <R : Comparable<R>> CharArray.minOfOrNull(
    selector: (Char) -> R
): R?
fun UIntArray.minOfOrNull(
    selector: (UInt) -> Double
): Double?
fun ULongArray.minOfOrNull(
    selector: (ULong) -> Double
): Double?
fun UByteArray.minOfOrNull(
    selector: (UByte) -> Double
): Double?
fun UShortArray.minOfOrNull(
    selector: (UShort) -> Double
): Double?
fun UIntArray.minOfOrNull(selector: (UInt) -> Float): Float?
fun ULongArray.minOfOrNull(
    selector: (ULong) -> Float
): Float?
fun UByteArray.minOfOrNull(
    selector: (UByte) -> Float
): Float?
fun UShortArray.minOfOrNull(
    selector: (UShort) -> Float
): Float?
fun <R : Comparable<R>> UIntArray.minOfOrNull(
    selector: (UInt) -> R
): R?
fun <R : Comparable<R>> ULongArray.minOfOrNull(
    selector: (ULong) -> R
): R?
fun <R : Comparable<R>> UByteArray.minOfOrNull(
    selector: (UByte) -> R
): R?
fun <R : Comparable<R>> UShortArray.minOfOrNull(
    selector: (UShort) -> R
): R?

Returns the smallest value among all values produced by selector function applied to each element in the collection or null if there are no elements.

fun <T> Iterable<T>.minOfOrNull(
    selector: (T) -> Double
): Double?
fun <T> Iterable<T>.minOfOrNull(
    selector: (T) -> Float
): Float?
fun <T, R : Comparable<R>> Iterable<T>.minOfOrNull(
    selector: (T) -> R
): R?

Returns the smallest value among all values produced by selector function applied to each entry in the map or null if there are no entries.

fun <K, V> Map<out K, V>.minOfOrNull(
    selector: (Entry<K, V>) -> Double
): Double?
fun <K, V> Map<out K, V>.minOfOrNull(
    selector: (Entry<K, V>) -> Float
): Float?
fun <K, V, R : Comparable<R>> Map<out K, V>.minOfOrNull(
    selector: (Entry<K, V>) -> R
): R?
Common
JVM
JS
Native
1.4

minOfWith

Returns the smallest value according to the provided comparator among all values produced by selector function applied to each element in the array.

fun <T, R> Array<out T>.minOfWith(
    comparator: Comparator<in R>,
    selector: (T) -> R
): R
fun <R> ByteArray.minOfWith(
    comparator: Comparator<in R>,
    selector: (Byte) -> R
): R
fun <R> ShortArray.minOfWith(
    comparator: Comparator<in R>,
    selector: (Short) -> R
): R
fun <R> IntArray.minOfWith(
    comparator: Comparator<in R>,
    selector: (Int) -> R
): R
fun <R> LongArray.minOfWith(
    comparator: Comparator<in R>,
    selector: (Long) -> R
): R
fun <R> FloatArray.minOfWith(
    comparator: Comparator<in R>,
    selector: (Float) -> R
): R
fun <R> DoubleArray.minOfWith(
    comparator: Comparator<in R>,
    selector: (Double) -> R
): R
fun <R> BooleanArray.minOfWith(
    comparator: Comparator<in R>,
    selector: (Boolean) -> R
): R
fun <R> CharArray.minOfWith(
    comparator: Comparator<in R>,
    selector: (Char) -> R
): R
fun <R> UIntArray.minOfWith(
    comparator: Comparator<in R>,
    selector: (UInt) -> R
): R
fun <R> ULongArray.minOfWith(
    comparator: Comparator<in R>,
    selector: (ULong) -> R
): R
fun <R> UByteArray.minOfWith(
    comparator: Comparator<in R>,
    selector: (UByte) -> R
): R
fun <R> UShortArray.minOfWith(
    comparator: Comparator<in R>,
    selector: (UShort) -> R
): R

Returns the smallest value according to the provided comparator among all values produced by selector function applied to each element in the collection.

fun <T, R> Iterable<T>.minOfWith(
    comparator: Comparator<in R>,
    selector: (T) -> R
): R

Returns the smallest value according to the provided comparator among all values produced by selector function applied to each entry in the map.

fun <K, V, R> Map<out K, V>.minOfWith(
    comparator: Comparator<in R>,
    selector: (Entry<K, V>) -> R
): R
Common
JVM
JS
Native
1.4

minOfWithOrNull

Returns the smallest value according to the provided comparator among all values produced by selector function applied to each element in the array or null if there are no elements.

fun <T, R> Array<out T>.minOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (T) -> R
): R?
fun <R> ByteArray.minOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (Byte) -> R
): R?
fun <R> ShortArray.minOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (Short) -> R
): R?
fun <R> IntArray.minOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (Int) -> R
): R?
fun <R> LongArray.minOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (Long) -> R
): R?
fun <R> FloatArray.minOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (Float) -> R
): R?
fun <R> DoubleArray.minOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (Double) -> R
): R?
fun <R> BooleanArray.minOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (Boolean) -> R
): R?
fun <R> CharArray.minOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (Char) -> R
): R?
fun <R> UIntArray.minOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (UInt) -> R
): R?
fun <R> ULongArray.minOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (ULong) -> R
): R?
fun <R> UByteArray.minOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (UByte) -> R
): R?
fun <R> UShortArray.minOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (UShort) -> R
): R?

Returns the smallest value according to the provided comparator among all values produced by selector function applied to each element in the collection or null if there are no elements.

fun <T, R> Iterable<T>.minOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (T) -> R
): R?

Returns the smallest value according to the provided comparator among all values produced by selector function applied to each entry in the map or null if there are no entries.

fun <K, V, R> Map<out K, V>.minOfWithOrNull(
    comparator: Comparator<in R>,
    selector: (Entry<K, V>) -> R
): R?
Common
JVM
JS
Native
1.4

minOrNull

Returns the smallest element or null if there are no elements.

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

minus

Returns a list containing all elements of the original collection without the first occurrence of the given element.

operator fun <T> Iterable<T>.minus(element: T): List<T>

Returns a list containing all elements of the original collection except the elements contained in the given elements array.

operator fun <T> Iterable<T>.minus(
    elements: Array<out T>
): List<T>

Returns a list containing all elements of the original collection except the elements contained in the given elements collection.

operator fun <T> Iterable<T>.minus(
    elements: Iterable<T>
): List<T>

Returns a list containing all elements of the original collection except the elements contained in the given elements sequence.

operator fun <T> Iterable<T>.minus(
    elements: Sequence<T>
): List<T>

Returns a set containing all elements of the original set except the given element.

operator fun <T> Set<T>.minus(element: T): Set<T>

Returns a set containing all elements of the original set except the elements contained in the given elements array.

operator fun <T> Set<T>.minus(elements: Array<out T>): Set<T>

Returns a set containing all elements of the original set except the elements contained in the given elements collection.

operator fun <T> Set<T>.minus(elements: Iterable<T>): Set<T>

Returns a set containing all elements of the original set except the elements contained in the given elements sequence.

operator fun <T> Set<T>.minus(elements: Sequence<T>): Set<T>

Returns a map containing all entries of the original map except the entry with the given key.

operator fun <K, V> Map<out K, V>.minus(key: K): Map<K, V>

Returns a map containing all entries of the original map except those entries the keys of which are contained in the given keys collection.

operator fun <K, V> Map<out K, V>.minus(
    keys: Iterable<K>
): Map<K, V>

Returns a map containing all entries of the original map except those entries the keys of which are contained in the given keys array.

operator fun <K, V> Map<out K, V>.minus(
    keys: Array<out K>
): Map<K, V>

Returns a map containing all entries of the original map except those entries the keys of which are contained in the given keys sequence.

operator fun <K, V> Map<out K, V>.minus(
    keys: Sequence<K>
): Map<K, V>
Common
JVM
JS
Native
1.0

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

minusElement

Returns a list containing all elements of the original collection without the first occurrence of the given element.

fun <T> Iterable<T>.minusElement(element: T): List<T>

Returns a set containing all elements of the original set except the given element.

fun <T> Set<T>.minusElement(element: T): Set<T>

minWith

Common
JVM
JS
Native
1.7

Returns the first element having the smallest value according to the provided comparator.

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

Returns the first entry having the smallest value according to the provided comparator.

fun <K, V> Map<out K, V>.minWith(
    comparator: Comparator<in Entry<K, V>>
): Entry<K, V>
JVM
1.0
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 <K, V> Map<out K, V>.minWith(
    comparator: Comparator<in Entry<K, V>>
): Entry<K, V>?
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?
Common
JVM
JS
Native
1.4

minWithOrNull

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>.minWithOrNull(
    comparator: Comparator<in T>
): T?
fun ByteArray.minWithOrNull(
    comparator: Comparator<in Byte>
): Byte?
fun ShortArray.minWithOrNull(
    comparator: Comparator<in Short>
): Short?
fun IntArray.minWithOrNull(
    comparator: Comparator<in Int>
): Int?
fun LongArray.minWithOrNull(
    comparator: Comparator<in Long>
): Long?
fun FloatArray.minWithOrNull(
    comparator: Comparator<in Float>
): Float?
fun DoubleArray.minWithOrNull(
    comparator: Comparator<in Double>
): Double?
fun BooleanArray.minWithOrNull(
    comparator: Comparator<in Boolean>
): Boolean?
fun CharArray.minWithOrNull(
    comparator: Comparator<in Char>
): Char?
fun <T> Iterable<T>.minWithOrNull(
    comparator: Comparator<in T>
): T?
fun UIntArray.minWithOrNull(
    comparator: Comparator<in UInt>
): UInt?
fun ULongArray.minWithOrNull(
    comparator: Comparator<in ULong>
): ULong?
fun UByteArray.minWithOrNull(
    comparator: Comparator<in UByte>
): UByte?
fun UShortArray.minWithOrNull(
    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>.minWithOrNull(
    comparator: Comparator<in Entry<K, V>>
): Entry<K, V>?
Common
JVM
JS
Native
1.1

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

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

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

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

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

Returns true if no entries match the given predicate.

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

onEach

Performs the given action on each element and returns the array itself afterwards.

fun <T> Array<out T>.onEach(
    action: (T) -> Unit
): Array<out T>
fun ByteArray.onEach(action: (Byte) -> Unit): ByteArray
fun ShortArray.onEach(action: (Short) -> Unit): ShortArray
fun IntArray.onEach(action: (Int) -> Unit): IntArray
fun LongArray.onEach(action: (Long) -> Unit): LongArray
fun FloatArray.onEach(action: (Float) -> Unit): FloatArray
fun DoubleArray.onEach(action: (Double) -> Unit): DoubleArray
fun BooleanArray.onEach(
    action: (Boolean) -> Unit
): BooleanArray
fun CharArray.onEach(action: (Char) -> Unit): CharArray
fun UIntArray.onEach(action: (UInt) -> Unit): UIntArray
fun ULongArray.onEach(action: (ULong) -> Unit): ULongArray
fun UByteArray.onEach(action: (UByte) -> Unit): UByteArray
fun UShortArray.onEach(action: (UShort) -> Unit): UShortArray

Performs the given action on each element and returns the collection itself afterwards.

fun <T, C : Iterable<T>> C.onEach(action: (T) -> Unit): C

Performs the given action on each entry and returns the map itself afterwards.

fun <K, V, M : Map<out K, V>> M.onEach(
    action: (Entry<K, V>) -> Unit
): M
Common
JVM
JS
Native
1.4

onEachIndexed

Performs the given action on each element, providing sequential index with the element, and returns the array itself afterwards.

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

Performs the given action on each element, providing sequential index with the element, and returns the collection itself afterwards.

fun <T, C : Iterable<T>> C.onEachIndexed(
    action: (index: Int, T) -> Unit
): C

Performs the given action on each entry, providing sequential index with the entry, and returns the map itself afterwards.

fun <K, V, M : Map<out K, V>> M.onEachIndexed(
    action: (index: Int, Entry<K, V>) -> Unit
): M
Common
JVM
JS
Native
1.0

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.

fun <T> List<T>?.orEmpty(): List<T>

Returns the Map if its not null, or the empty Map otherwise.

fun <K, V> Map<K, V>?.orEmpty(): Map<K, V>

Returns this Set if it's not null and the empty set otherwise.

fun <T> Set<T>?.orEmpty(): Set<T>

Returns the array if it's not null, or an empty array otherwise.

fun <T> any_array<T>.orEmpty(): Array<out T>
Common
JVM
JS
Native
1.0

partition

Splits the original array into pair of lists, where first list contains elements for which predicate yielded true, while second list contains elements for which predicate yielded false.

fun <T> any_array<T>.partition(
    predicate: (T) -> Boolean
): Pair<List<T>, List<T>>

Splits the original collection into pair of lists, where first list contains elements for which predicate yielded true, while second list contains elements for which predicate yielded false.

fun <T> Iterable<T>.partition(
    predicate: (T) -> Boolean
): Pair<List<T>, List<T>>

plus

Returns a list containing all elements of the original collection and then the given element.

Common
JVM
JS
Native
1.0
operator fun <T> Iterable<T>.plus(element: T): List<T>
Common
JVM
JS
Native
1.0
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.

Common
JVM
JS
Native
1.0
operator fun <T> Iterable<T>.plus(
    elements: Array<out T>
): List<T>
Common
JVM
JS
Native
1.0
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.

Common
JVM
JS
Native
1.0
operator fun <T> Iterable<T>.plus(
    elements: Iterable<T>
): List<T>
Common
JVM
JS
Native
1.0
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.

Common
JVM
JS
Native
1.0
operator fun <T> Iterable<T>.plus(
    elements: Sequence<T>
): List<T>
Common
JVM
JS
Native
1.0
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.

Common
JVM
JS
Native
1.0
operator fun <T> Set<T>.plus(element: T): Set<T>

Returns a set containing all elements of the original set and the given elements array, which aren't already in this set.

Common
JVM
JS
Native
1.0
operator fun <T> Set<T>.plus(elements: Array<out T>): Set<T>

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.

Common
JVM
JS
Native
1.0
operator fun <T> Set<T>.plus(elements: Iterable<T>): Set<T>

Returns a set containing all elements of the original set and the given elements sequence, which aren't already in this set.

Common
JVM
JS
Native
1.0
operator fun <T> Set<T>.plus(elements: Sequence<T>): Set<T>

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

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

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

Common
JVM
JS
Native
1.3
operator fun UIntArray.plus(
    elements: Collection<UInt>
): UIntArray
Common
JVM
JS
Native
1.3
operator fun ULongArray.plus(
    elements: Collection<ULong>
): ULongArray
Common
JVM
JS
Native
1.3
operator fun UByteArray.plus(
    elements: Collection<UByte>
): UByteArray
Common
JVM
JS
Native
1.3
operator fun UShortArray.plus(
    elements: Collection<UShort>
): UShortArray
Common
JVM
Native
1.0
operator fun <T> Array<T>.plus(
    elements: Collection<T>
): Array<T>
JS
1.1
operator fun <T> Array<out T>.plus(
    elements: Collection<T>
): Array<T>
Common
JVM
JS
Native
1.0
operator fun ByteArray.plus(
    elements: Collection<Byte>
): ByteArray
Common
JVM
JS
Native
1.0
operator fun ShortArray.plus(
    elements: Collection<Short>
): ShortArray
Common
JVM
JS
Native
1.0
operator fun IntArray.plus(
    elements: Collection<Int>
): IntArray
Common
JVM
JS
Native
1.0
operator fun LongArray.plus(
    elements: Collection<Long>
): LongArray
Common
JVM
JS
Native
1.0
operator fun FloatArray.plus(
    elements: Collection<Float>
): FloatArray
Common
JVM
JS
Native
1.0
operator fun DoubleArray.plus(
    elements: Collection<Double>
): DoubleArray
Common
JVM
JS
Native
1.0
operator fun BooleanArray.plus(
    elements: Collection<Boolean>
): BooleanArray
Common
JVM
JS
Native
1.0
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.

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

Creates a new read-only map by replacing or adding an entry to this map from a given key-value pair.

Common
JVM
JS
Native
1.0
operator fun <K, V> Map<out K, V>.plus(
    pair: Pair<K, V>
): Map<K, V>

Creates a new read-only map by replacing or adding entries to this map from a given collection of key-value pairs.

Common
JVM
JS
Native
1.0
operator fun <K, V> Map<out K, V>.plus(
    pairs: Iterable<Pair<K, V>>
): Map<K, V>

Creates a new read-only map by replacing or adding entries to this map from a given array of key-value pairs.

Common
JVM
JS
Native
1.0
operator fun <K, V> Map<out K, V>.plus(
    pairs: Array<out Pair<K, V>>
): Map<K, V>

Creates a new read-only map by replacing or adding entries to this map from a given sequence of key-value pairs.

Common
JVM
JS
Native
1.0
operator fun <K, V> Map<out K, V>.plus(
    pairs: Sequence<Pair<K, V>>
): Map<K, V>

Creates a new read-only map by replacing or adding entries to this map from another map.

Common
JVM
JS
Native
1.0
operator fun <K, V> Map<out K, V>.plus(
    map: Map<out K, V>
): Map<K, V>
Common
JVM
JS
Native
1.0

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

plusElement

Returns a list containing all elements of the original collection and then the given element.

fun <T> Iterable<T>.plusElement(element: T): List<T>
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.

fun <T> Set<T>.plusElement(element: T): Set<T>

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

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

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 UIntArray.random(): UInt
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 ByteArray.random(random: Random): Byte
fun ShortArray.random(random: Random): Short
fun IntArray.random(random: Random): Int
fun LongArray.random(random: Random): Long
fun FloatArray.random(random: Random): Float
fun DoubleArray.random(random: Random): Double
fun BooleanArray.random(random: Random): Boolean
fun CharArray.random(random: Random): Char
fun UIntArray.random(random: Random): UInt
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
Common
JVM
JS
Native
1.4

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 UIntArray.randomOrNull(): UInt?
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 ByteArray.randomOrNull(random: Random): Byte?
fun ShortArray.randomOrNull(random: Random): Short?
fun IntArray.randomOrNull(random: Random): Int?
fun LongArray.randomOrNull(random: Random): Long?
fun FloatArray.randomOrNull(random: Random): Float?
fun DoubleArray.randomOrNull(random: Random): Double?
fun BooleanArray.randomOrNull(random: Random): Boolean?
fun CharArray.randomOrNull(random: Random): Char?
fun UIntArray.randomOrNull(random: Random): UInt?
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?
Common
JVM
JS
Native
1.0

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 UIntArray.reduce(
    operation: (acc: UInt, UInt) -> UInt
): UInt
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.

fun <S, T : S, K> Grouping<T, K>.reduce(
    operation: (key: K, accumulator: S, element: T) -> S
): Map<K, S>
Common
JVM
JS
Native
1.0

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 UIntArray.reduceIndexed(
    operation: (index: Int, acc: UInt, UInt) -> UInt
): UInt
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

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 collection.

fun <S, T : S> Iterable<T>.reduceIndexed(
    operation: (index: Int, acc: S, T) -> S
): S
Common
JVM
JS
Native
1.4

reduceIndexedOrNull

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>.reduceIndexedOrNull(
    operation: (index: Int, acc: S, T) -> S
): S?
fun ByteArray.reduceIndexedOrNull(
    operation: (index: Int, acc: Byte, Byte) -> Byte
): Byte?
fun ShortArray.reduceIndexedOrNull(
    operation: (index: Int, acc: Short, Short) -> Short
): Short?
fun IntArray.reduceIndexedOrNull(
    operation: (index: Int, acc: Int, Int) -> Int
): Int?
fun LongArray.reduceIndexedOrNull(
    operation: (index: Int, acc: Long, Long) -> Long
): Long?
fun FloatArray.reduceIndexedOrNull(
    operation: (index: Int, acc: Float, Float) -> Float
): Float?
fun DoubleArray.reduceIndexedOrNull(
    operation: (index: Int, acc: Double, Double) -> Double
): Double?
fun BooleanArray.reduceIndexedOrNull(
    operation: (index: Int, acc: Boolean, Boolean) -> Boolean
): Boolean?
fun CharArray.reduceIndexedOrNull(
    operation: (index: Int, acc: Char, Char) -> Char
): Char?
fun UIntArray.reduceIndexedOrNull(
    operation: (index: Int, acc: UInt, UInt) -> UInt
): UInt?
fun ULongArray.reduceIndexedOrNull(
    operation: (index: Int, acc: ULong, ULong) -> ULong
): ULong?
fun UByteArray.reduceIndexedOrNull(
    operation: (index: Int, acc: UByte, UByte) -> UByte
): UByte?
fun UShortArray.reduceIndexedOrNull(
    operation: (index: Int, acc: UShort, UShort) -> UShort
): UShort?

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 collection.

fun <S, T : S> Iterable<T>.reduceIndexedOrNull(
    operation: (index: Int, acc: S, T) -> S
): S?
Common
JVM
JS
Native
1.4

reduceOrNull

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>.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 <S, T : S> Iterable<T>.reduceOrNull(
    operation: (acc: S, T) -> S
): S?
fun UIntArray.reduceOrNull(
    operation: (acc: UInt, UInt) -> UInt
): UInt?
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?
Common
JVM
JS
Native
1.0

reduceRight

Accumulates value starting with the 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 UIntArray.reduceRight(
    operation: (UInt, acc: UInt) -> UInt
): UInt
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
Common
JVM
JS
Native
1.0

reduceRightIndexed

Accumulates value starting with the 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 UIntArray.reduceRightIndexed(
    operation: (index: Int, UInt, acc: UInt) -> UInt
): UInt
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

Accumulates value starting with the last element and applying operation from right to left to each element with its index in the original list and current accumulator value.

fun <S, T : S> List<T>.reduceRightIndexed(
    operation: (index: Int, T, acc: S) -> S
): S
Common
JVM
JS
Native
1.4

reduceRightIndexedOrNull

Accumulates value starting with the 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>.reduceRightIndexedOrNull(
    operation: (index: Int, T, acc: S) -> S
): S?
fun ByteArray.reduceRightIndexedOrNull(
    operation: (index: Int, Byte, acc: Byte) -> Byte
): Byte?
fun ShortArray.reduceRightIndexedOrNull(
    operation: (index: Int, Short, acc: Short) -> Short
): Short?
fun IntArray.reduceRightIndexedOrNull(
    operation: (index: Int, Int, acc: Int) -> Int
): Int?
fun LongArray.reduceRightIndexedOrNull(
    operation: (index: Int, Long, acc: Long) -> Long
): Long?
fun FloatArray.reduceRightIndexedOrNull(
    operation: (index: Int, Float, acc: Float) -> Float
): Float?
fun DoubleArray.reduceRightIndexedOrNull(
    operation: (index: Int, Double, acc: Double) -> Double
): Double?
fun BooleanArray.reduceRightIndexedOrNull(
    operation: (index: Int, Boolean, acc: Boolean) -> Boolean
): Boolean?
fun CharArray.reduceRightIndexedOrNull(
    operation: (index: Int, Char, acc: Char) -> Char
): Char?
fun UIntArray.reduceRightIndexedOrNull(
    operation: (index: Int, UInt, acc: UInt) -> UInt
): UInt?
fun ULongArray.reduceRightIndexedOrNull(
    operation: (index: Int, ULong, acc: ULong) -> ULong
): ULong?
fun UByteArray.reduceRightIndexedOrNull(
    operation: (index: Int, UByte, acc: UByte) -> UByte
): UByte?
fun UShortArray.reduceRightIndexedOrNull(
    operation: (index: Int, UShort, acc: UShort) -> UShort
): UShort?

Accumulates value starting with the last element and applying operation from right to left to each element with its index in the original list and current accumulator value.

fun <S, T : S> List<T>.reduceRightIndexedOrNull(
    operation: (index: Int, T, acc: S) -> S
): S?
Common
JVM
JS
Native
1.4

reduceRightOrNull

Accumulates value starting with the last element and applying operation from right to left to each element and current accumulator value.

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 <S, T : S> List<T>.reduceRightOrNull(
    operation: (T, acc: S) -> S
): S?
fun UIntArray.reduceRightOrNull(
    operation: (UInt, acc: UInt) -> UInt
): UInt?
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?
Common
JVM
JS
Native
1.1

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

Common
JVM
JS
Native
1.0

Removes the specified key and its corresponding value from this map.

fun <K, V> MutableMap<out K, V>.remove(key: K): V?
Common
JVM
JS
Native
1.0

Removes a single instance of the specified element from this collection, if it is present.

fun <T> MutableCollection<out T>.remove(element: T): Boolean
Common
JVM
JS
Native
1.0

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
JVM
JRE8
1.2

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

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

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

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

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

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?
Native
1.3

replaceAll

Replaces each element in the list with a result of a transformation specified.

fun <T> MutableList<T>.replaceAll(transformation: (T) -> T)
Common
JVM
JS
Native
1.0

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>
fun <T : Any> Iterable<T?>.requireNoNulls(): Iterable<T>
fun <T : Any> List<T?>.requireNoNulls(): List<T>
Common
JVM
JS
Native
1.0

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

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 of the array in the specified range in-place.

fun <T> Array<T>.reverse(fromIndex: Int, toIndex: Int)
fun ByteArray.reverse(fromIndex: Int, toIndex: Int)
fun ShortArray.reverse(fromIndex: Int, toIndex: Int)
fun IntArray.reverse(fromIndex: Int, toIndex: Int)
fun LongArray.reverse(fromIndex: Int, toIndex: Int)
fun FloatArray.reverse(fromIndex: Int, toIndex: Int)
fun DoubleArray.reverse(fromIndex: Int, toIndex: Int)
fun BooleanArray.reverse(fromIndex: Int, toIndex: Int)
fun CharArray.reverse(fromIndex: Int, toIndex: Int)
fun UIntArray.reverse(fromIndex: Int, toIndex: Int)
fun ULongArray.reverse(fromIndex: Int, toIndex: Int)
fun UByteArray.reverse(fromIndex: Int, toIndex: Int)
fun UShortArray.reverse(fromIndex: Int, toIndex: Int)

Reverses elements in the list in-place.

fun <T> MutableList<T>.reverse()
Common
JVM
JS
Native
1.0

reversed

Returns a list with elements in reversed order.

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

reversedArray

Returns an array with elements of this array in reversed order.

fun <T> Array<T>.reversedArray(): Array<T>
fun ByteArray.reversedArray(): ByteArray
fun ShortArray.reversedArray(): ShortArray
fun IntArray.reversedArray(): IntArray
fun LongArray.reversedArray(): LongArray
fun FloatArray.reversedArray(): FloatArray
fun DoubleArray.reversedArray(): DoubleArray
fun BooleanArray.reversedArray(): BooleanArray
fun CharArray.reversedArray(): CharArray
fun UIntArray.reversedArray(): UIntArray
fun ULongArray.reversedArray(): ULongArray
fun UByteArray.reversedArray(): UByteArray
fun UShortArray.reversedArray(): UShortArray
Common
JVM
JS
Native
1.4

runningFold

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>.runningFold(
    initial: R,
    operation: (acc: R, T) -> R
): List<R>
fun <R> ByteArray.runningFold(
    initial: R,
    operation: (acc: R, Byte) -> R
): List<R>
fun <R> ShortArray.runningFold(
    initial: R,
    operation: (acc: R, Short) -> R
): List<R>
fun <R> IntArray.runningFold(
    initial: R,
    operation: (acc: R, Int) -> R
): List<R>
fun <R> LongArray.runningFold(
    initial: R,
    operation: (acc: R, Long) -> R
): List<R>
fun <R> FloatArray.runningFold(
    initial: R,
    operation: (acc: R, Float) -> R
): List<R>
fun <R> DoubleArray.runningFold(
    initial: R,
    operation: (acc: R, Double) -> R
): List<R>
fun <R> BooleanArray.runningFold(
    initial: R,
    operation: (acc: R, Boolean) -> R
): List<R>
fun <R> CharArray.runningFold(
    initial: R,
    operation: (acc: R, Char) -> R
): List<R>
fun <T, R> Iterable<T>.runningFold(
    initial: R,
    operation: (acc: R, T) -> R
): List<R>
fun <R> UIntArray.runningFold(
    initial: R,
    operation: (acc: R, UInt) -> R
): List<R>
fun <R> ULongArray.runningFold(
    initial: R,
    operation: (acc: R, ULong) -> R
): List<R>
fun <R> UByteArray.runningFold(
    initial: R,
    operation: (acc: R, UByte) -> R
): List<R>
fun <R> UShortArray.runningFold(
    initial: R,
    operation: (acc: R, UShort) -> R
): List<R>
Common
JVM
JS
Native
1.4

runningFoldIndexed

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>.runningFoldIndexed(
    initial: R,
    operation: (index: Int, acc: R, T) -> R
): List<R>
fun <R> ByteArray.runningFoldIndexed(
    initial: R,
    operation: (index: Int, acc: R, Byte) -> R
): List<R>
fun <R> ShortArray.runningFoldIndexed(
    initial: R,
    operation: (index: Int, acc: R, Short) -> R
): List<R>
fun <R> IntArray.runningFoldIndexed(
    initial: R,
    operation: (index: Int, acc: R, Int) -> R
): List<R>
fun <R> LongArray.runningFoldIndexed(
    initial: R,
    operation: (index: Int, acc: R, Long) -> R
): List<R>
fun <R> FloatArray.runningFoldIndexed(
    initial: R,
    operation: (index: Int, acc: R, Float) -> R
): List<R>
fun <R> DoubleArray.runningFoldIndexed(
    initial: R,
    operation: (index: Int, acc: R, Double) -> R
): List<R>
fun <R> BooleanArray.runningFoldIndexed(
    initial: R,
    operation: (index: Int, acc: R, Boolean) -> R
): List<R>
fun <R> CharArray.runningFoldIndexed(
    initial: R,
    operation: (index: Int, acc: R, Char) -> R
): List<R>
fun <R> UIntArray.runningFoldIndexed(
    initial: R,
    operation: (index: Int, acc: R, UInt) -> R
): List<R>
fun <R> ULongArray.runningFoldIndexed(
    initial: R,
    operation: (index: Int, acc: R, ULong) -> R
): List<R>
fun <R> UByteArray.runningFoldIndexed(
    initial: R,
    operation: (index: Int, acc: R, UByte) -> R
): List<R>
fun <R> UShortArray.runningFoldIndexed(
    initial: R,
    operation: (index: Int, acc: R, UShort) -> R
): List<R>

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 initial value.

fun <T, R> Iterable<T>.runningFoldIndexed(
    initial: R,
    operation: (index: Int, acc: R, T) -> R
): List<R>
Common
JVM
JS
Native
1.4

runningReduce

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>.runningReduce(
    operation: (acc: S, T) -> S
): List<S>
fun ByteArray.runningReduce(
    operation: (acc: Byte, Byte) -> Byte
): List<Byte>
fun ShortArray.runningReduce(
    operation: (acc: Short, Short) -> Short
): List<Short>
fun IntArray.runningReduce(
    operation: (acc: Int, Int) -> Int
): List<Int>
fun LongArray.runningReduce(
    operation: (acc: Long, Long) -> Long
): List<Long>
fun FloatArray.runningReduce(
    operation: (acc: Float, Float) -> Float
): List<Float>
fun DoubleArray.runningReduce(
    operation: (acc: Double, Double) -> Double
): List<Double>
fun BooleanArray.runningReduce(
    operation: (acc: Boolean, Boolean) -> Boolean
): List<Boolean>
fun CharArray.runningReduce(
    operation: (acc: Char, Char) -> Char
): List<Char>
fun UIntArray.runningReduce(
    operation: (acc: UInt, UInt) -> UInt
): List<UInt>
fun ULongArray.runningReduce(
    operation: (acc: ULong, ULong) -> ULong
): List<ULong>
fun UByteArray.runningReduce(
    operation: (acc: UByte, UByte) -> UByte
): List<UByte>
fun UShortArray.runningReduce(
    operation: (acc: UShort, UShort) -> UShort
): List<UShort>

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 collection.

fun <S, T : S> Iterable<T>.runningReduce(
    operation: (acc: S, T) -> S
): List<S>
Common
JVM
JS
Native
1.4

runningReduceIndexed

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>.runningReduceIndexed(
    operation: (index: Int, acc: S, T) -> S
): List<S>
fun ByteArray.runningReduceIndexed(
    operation: (index: Int, acc: Byte, Byte) -> Byte
): List<Byte>
fun ShortArray.runningReduceIndexed(
    operation: (index: Int, acc: Short, Short) -> Short
): List<Short>
fun IntArray.runningReduceIndexed(
    operation: (index: Int, acc: Int, Int) -> Int
): List<Int>
fun LongArray.runningReduceIndexed(
    operation: (index: Int, acc: Long, Long) -> Long
): List<Long>
fun FloatArray.runningReduceIndexed(
    operation: (index: Int, acc: Float, Float) -> Float
): List<Float>
fun DoubleArray.runningReduceIndexed(
    operation: (index: Int, acc: Double, Double) -> Double
): List<Double>
fun BooleanArray.runningReduceIndexed(
    operation: (index: Int, acc: Boolean, Boolean) -> Boolean
): List<Boolean>
fun CharArray.runningReduceIndexed(
    operation: (index: Int, acc: Char, Char) -> Char
): List<Char>
fun UIntArray.runningReduceIndexed(
    operation: (index: Int, acc: UInt, UInt) -> UInt
): List<UInt>
fun ULongArray.runningReduceIndexed(
    operation: (index: Int, acc: ULong, ULong) -> ULong
): List<ULong>
fun UByteArray.runningReduceIndexed(
    operation: (index: Int, acc: UByte, UByte) -> UByte
): List<UByte>
fun UShortArray.runningReduceIndexed(
    operation: (index: Int, acc: UShort, UShort) -> UShort
): List<UShort>

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.

fun <S, T : S> Iterable<T>.runningReduceIndexed(
    operation: (index: Int, acc: S, T) -> S
): List<S>
Common
JVM
JS
Native
1.4

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> ByteArray.scan(
    initial: R,
    operation: (acc: R, Byte) -> R
): List<R>
fun <R> ShortArray.scan(
    initial: R,
    operation: (acc: R, Short) -> R
): List<R>
fun <R> IntArray.scan(
    initial: R,
    operation: (acc: R, Int) -> R
): List<R>
fun <R> LongArray.scan(
    initial: R,
    operation: (acc: R, Long) -> 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> CharArray.scan(
    initial: R,
    operation: (acc: R, Char) -> R
): List<R>
fun <T, R> Iterable<T>.scan(
    initial: R,
    operation: (acc: R, T) -> R
): List<R>
fun <R> UIntArray.scan(
    initial: R,
    operation: (acc: R, UInt) -> 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>
Common
JVM
JS
Native
1.4

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> ByteArray.scanIndexed(
    initial: R,
    operation: (index: Int, acc: R, Byte) -> R
): List<R>
fun <R> ShortArray.scanIndexed(
    initial: R,
    operation: (index: Int, acc: R, Short) -> R
): List<R>
fun <R> IntArray.scanIndexed(
    initial: R,
    operation: (index: Int, acc: R, Int) -> R
): List<R>
fun <R> LongArray.scanIndexed(
    initial: R,
    operation: (index: Int, acc: R, Long) -> 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> CharArray.scanIndexed(
    initial: R,
    operation: (index: Int, acc: R, Char) -> R
): List<R>
fun <R> UIntArray.scanIndexed(
    initial: R,
    operation: (index: Int, acc: R, UInt) -> 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>

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 initial value.

fun <T, R> Iterable<T>.scanIndexed(
    initial: R,
    operation: (index: Int, acc: R, T) -> R
): List<R>
Common
JVM
JS
Native
1.0

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

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>

Returns a new read-only set containing only the specified object element.

fun <T> setOf(element: T): Set<T>
Common
JVM
JS
Native
1.4

setOfNotNull

Returns a new read-only set either with single given element, if it is not null, or empty set if the element is null. The returned set is serializable (JVM).

fun <T : Any> setOfNotNull(element: T?): Set<T>

Returns a new read-only set only with those given elements, that are not null. Elements of the set are iterated in the order they were specified. The returned set is serializable (JVM).

fun <T : Any> setOfNotNull(vararg elements: T?): Set<T>
Common
JVM
JS
Native
1.0

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

Common
JVM
JS
Native
1.4

Randomly shuffles elements in this array in-place.

fun <T> Array<T>.shuffle()
fun ByteArray.shuffle()
fun ShortArray.shuffle()
fun IntArray.shuffle()
fun LongArray.shuffle()
fun FloatArray.shuffle()
fun DoubleArray.shuffle()
fun BooleanArray.shuffle()
fun CharArray.shuffle()
fun UIntArray.shuffle()
fun ULongArray.shuffle()
fun UByteArray.shuffle()
fun UShortArray.shuffle()
Common
JVM
JS
Native
1.4

Randomly shuffles elements in this array in-place using the specified random instance as the source of randomness.

fun <T> Array<T>.shuffle(random: Random)
fun ByteArray.shuffle(random: Random)
fun ShortArray.shuffle(random: Random)
fun IntArray.shuffle(random: Random)
fun LongArray.shuffle(random: Random)
fun FloatArray.shuffle(random: Random)
fun DoubleArray.shuffle(random: Random)
fun BooleanArray.shuffle(random: Random)
fun CharArray.shuffle(random: Random)
fun UIntArray.shuffle(random: Random)
fun ULongArray.shuffle(random: Random)
fun UByteArray.shuffle(random: Random)
fun UShortArray.shuffle(random: Random)
Common
JVM
JS
Native
1.3

Randomly shuffles elements in this list in-place using the specified random instance as the source of randomness.

fun <T> MutableList<T>.shuffle(random: Random)
JVM
1.2

Randomly shuffles elements in this mutable list using the specified random instance as the source of randomness.

fun <T> MutableList<T>.shuffle(random: Random)
Common
JVM
JS
Native
1.2

Randomly shuffles elements in this 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.

Common
JVM
JS
Native
1.3
fun <T> Iterable<T>.shuffled(random: Random): List<T>
JVM
1.2
fun <T> Iterable<T>.shuffled(random: Random): List<T>

Returns a new list with the elements of this collection randomly shuffled.

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

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

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

slice

Returns a list containing elements at indices in the specified indices range.

fun <T> Array<out T>.slice(indices: IntRange): List<T>
fun ByteArray.slice(indices: IntRange): List<Byte>
fun ShortArray.slice(indices: IntRange): List<Short>
fun IntArray.slice(indices: IntRange): List<Int>
fun LongArray.slice(indices: IntRange): List<Long>
fun FloatArray.slice(indices: IntRange): List<Float>
fun DoubleArray.slice(indices: IntRange): List<Double>
fun BooleanArray.slice(indices: IntRange): List<Boolean>
fun CharArray.slice(indices: IntRange): List<Char>
fun <T> List<T>.slice(indices: IntRange): List<T>
fun UIntArray.slice(indices: IntRange): List<UInt>
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 <T> Array<out T>.slice(indices: Iterable<Int>): List<T>
fun ByteArray.slice(indices: Iterable<Int>): List<Byte>
fun ShortArray.slice(indices: Iterable<Int>): List<Short>
fun IntArray.slice(indices: Iterable<Int>): List<Int>
fun LongArray.slice(indices: Iterable<Int>): List<Long>
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 CharArray.slice(indices: Iterable<Int>): List<Char>
fun <T> List<T>.slice(indices: Iterable<Int>): List<T>
fun UIntArray.slice(indices: Iterable<Int>): List<UInt>
fun ULongArray.slice(indices: Iterable<Int>): List<ULong>
fun UByteArray.slice(indices: Iterable<Int>): List<UByte>
fun UShortArray.slice(indices: Iterable<Int>): List<UShort>
Common
JVM
JS
Native
1.0

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 ByteArray.sliceArray(indices: IntRange): ByteArray
fun ShortArray.sliceArray(indices: IntRange): ShortArray
fun IntArray.sliceArray(indices: IntRange): IntArray
fun LongArray.sliceArray(indices: IntRange): LongArray
fun FloatArray.sliceArray(indices: IntRange): FloatArray
fun DoubleArray.sliceArray(indices: IntRange): DoubleArray
fun BooleanArray.sliceArray(indices: IntRange): BooleanArray
fun CharArray.sliceArray(indices: IntRange): CharArray
fun UIntArray.sliceArray(indices: IntRange): UIntArray
fun ULongArray.sliceArray(indices: IntRange): ULongArray
fun UByteArray.sliceArray(indices: IntRange): UByteArray
fun UShortArray.sliceArray(indices: IntRange): UShortArray

sort

Common
JVM
JS
Native
1.0

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

Sorts a range in the array in-place.

fun UIntArray.sort(fromIndex: Int = 0, toIndex: Int = size)
fun ULongArray.sort(fromIndex: Int = 0, toIndex: Int = size)
fun UByteArray.sort(fromIndex: Int = 0, toIndex: Int = size)
fun UShortArray.sort(fromIndex: Int = 0, toIndex: Int = size)
fun <T : Comparable<T>> Array<out T>.sort(
    fromIndex: Int = 0,
    toIndex: Int = size)
fun ByteArray.sort(fromIndex: Int = 0, toIndex: Int = size)
fun ShortArray.sort(fromIndex: Int = 0, toIndex: Int = size)
fun IntArray.sort(fromIndex: Int = 0, toIndex: Int = size)
fun LongArray.sort(fromIndex: Int = 0, toIndex: Int = size)
fun FloatArray.sort(fromIndex: Int = 0, toIndex: Int = size)
fun DoubleArray.sort(fromIndex: Int = 0, toIndex: Int = size)
fun CharArray.sort(fromIndex: Int = 0, toIndex: Int = size)
JVM
1.0
fun <T> MutableList<T>.sort(comparator: Comparator<in T>)
fun <T> MutableList<T>.sort(comparison: (T, T) -> Int)
JS
1.1

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

Sorts the array in-place according to the natural order of its elements.

fun <T : Comparable<T>> any_array<T>.sort()
Common
JVM
JS
Native
1.0

Sorts elements in the list in-place according to their natural sort order.

fun <T : Comparable<T>> MutableList<T>.sort()
Common
JVM
JS
Native
1.0

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

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

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 of the array in the specified range in-place. The elements are sorted descending according to their natural sort order.

fun <T : Comparable<T>> Array<out T>.sortDescending(
    fromIndex: Int,
    toIndex: Int)
fun ByteArray.sortDescending(fromIndex: Int, toIndex: Int)
fun ShortArray.sortDescending(fromIndex: Int, toIndex: Int)
fun IntArray.sortDescending(fromIndex: Int, toIndex: Int)
fun LongArray.sortDescending(fromIndex: Int, toIndex: Int)
fun FloatArray.sortDescending(fromIndex: Int, toIndex: Int)
fun DoubleArray.sortDescending(fromIndex: Int, toIndex: Int)
fun CharArray.sortDescending(fromIndex: Int, toIndex: Int)
fun UIntArray.sortDescending(fromIndex: Int, toIndex: Int)
fun ULongArray.sortDescending(fromIndex: Int, toIndex: Int)
fun UByteArray.sortDescending(fromIndex: Int, toIndex: Int)
fun UShortArray.sortDescending(fromIndex: Int, toIndex: Int)

Sorts elements in the list in-place descending according to their natural sort order.

fun <T : Comparable<T>> MutableList<T>.sortDescending()
Common
JVM
JS
Native
1.0

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 ByteArray.sorted(): List<Byte>
fun ShortArray.sorted(): List<Short>
fun IntArray.sorted(): List<Int>
fun LongArray.sorted(): List<Long>
fun FloatArray.sorted(): List<Float>
fun DoubleArray.sorted(): List<Double>
fun CharArray.sorted(): List<Char>
fun <T : Comparable<T>> Iterable<T>.sorted(): List<T>
fun UIntArray.sorted(): List<UInt>
fun ULongArray.sorted(): List<ULong>
fun UByteArray.sorted(): List<UByte>
fun UShortArray.sorted(): List<UShort>
Common
JVM
JS
Native
1.0

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 ByteArray.sortedArray(): ByteArray
fun ShortArray.sortedArray(): ShortArray
fun IntArray.sortedArray(): IntArray
fun LongArray.sortedArray(): LongArray
fun FloatArray.sortedArray(): FloatArray
fun DoubleArray.sortedArray(): DoubleArray
fun CharArray.sortedArray(): CharArray
fun UIntArray.sortedArray(): UIntArray
fun ULongArray.sortedArray(): ULongArray
fun UByteArray.sortedArray(): UByteArray
fun UShortArray.sortedArray(): UShortArray
Common
JVM
JS
Native
1.0

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 ByteArray.sortedArrayDescending(): ByteArray
fun ShortArray.sortedArrayDescending(): ShortArray
fun IntArray.sortedArrayDescending(): IntArray
fun LongArray.sortedArrayDescending(): LongArray
fun FloatArray.sortedArrayDescending(): FloatArray
fun DoubleArray.sortedArrayDescending(): DoubleArray
fun CharArray.sortedArrayDescending(): CharArray
fun UIntArray.sortedArrayDescending(): UIntArray
fun ULongArray.sortedArrayDescending(): ULongArray
fun UByteArray.sortedArrayDescending(): UByteArray
fun UShortArray.sortedArrayDescending(): UShortArray
Common
JVM
JS
Native
1.0

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

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

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

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 ByteArray.sortedDescending(): List<Byte>
fun ShortArray.sortedDescending(): List<Short>
fun IntArray.sortedDescending(): List<Int>
fun LongArray.sortedDescending(): List<Long>
fun FloatArray.sortedDescending(): List<Float>
fun DoubleArray.sortedDescending(): List<Double>
fun CharArray.sortedDescending(): List<Char>
fun <T : Comparable<T>> Iterable<T>.sortedDescending(): List<T>
fun UIntArray.sortedDescending(): List<UInt>
fun ULongArray.sortedDescending(): List<ULong>
fun UByteArray.sortedDescending(): List<UByte>
fun UShortArray.sortedDescending(): List<UShort>
JVM
1.0

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>
fun <K, V> sortedMapOf(
    comparator: Comparator<in K>,
    vararg pairs: Pair<K, V>
): SortedMap<K, V>
JVM
1.0

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

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.

Common
JVM
JS
Native
1.0
fun <T> any_array<T>.sortWith(comparator: Comparator<in T>)

Sorts a range in the array in-place with the given comparator.

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

JVM
1.0
fun <T> MutableList<T>.sortWith(comparator: Comparator<in T>)
Common
JS
Native
1.0
fun <T> MutableList<T>.sortWith(comparator: Comparator<in T>)
JS
1.1

stringMapOf

Constructs the specialized implementation of HashMap with String keys, which stores the keys as properties of JS object without hashing them.

fun <V> stringMapOf(
    vararg pairs: <ERROR CLASS><String, V>
): HashMap<String, V>
JS
1.1

stringSetOf

Creates a new instance of the specialized implementation of HashSet with the specified String elements, which elements the keys as properties of JS object without hashing them.

fun stringSetOf(vararg elements: String): HashSet<String>
Common
JVM
JS
Native
1.0

subtract

Returns a set containing all elements that are contained by this array and not contained by the specified collection.

infix fun <T> any_array<T>.subtract(
    other: Iterable<T>
): Set<T>

Returns a set containing all elements that are contained by this collection and not contained by the specified collection.

infix fun <T> Iterable<T>.subtract(
    other: Iterable<T>
): Set<T>
Common
JVM
JS
Native
1.0

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 Array<out UInt>.sum(): UInt
fun Array<out ULong>.sum(): ULong
fun Array<out UByte>.sum(): UInt
fun Array<out UShort>.sum(): UInt
fun UIntArray.sum(): UInt
fun ULongArray.sum(): ULong
fun UByteArray.sum(): UInt
fun UShortArray.sum(): UInt

Returns the sum of all elements in the collection.

fun Iterable<Byte>.sum(): Int
fun Iterable<Short>.sum(): Int
fun Iterable<Int>.sum(): Int
fun Iterable<Long>.sum(): Long
fun Iterable<Float>.sum(): Float
fun Iterable<Double>.sum(): Double
fun Iterable<UInt>.sum(): UInt
fun Iterable<ULong>.sum(): ULong
fun Iterable<UByte>.sum(): UInt
fun Iterable<UShort>.sum(): UInt
Common
JVM
JS
Native
1.0

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

Returns the sum of all values produced by selector function applied to each element in the collection.

fun <T> Iterable<T>.sumBy(selector: (T) -> Int): Int
Common
JVM
JS
Native
1.0

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 UIntArray.sumByDouble(selector: (UInt) -> Double): Double
fun ULongArray.sumByDouble(
    selector: (ULong) -> Double
): Double
fun UByteArray.sumByDouble(
    selector: (UByte) -> Double
): Double
fun UShortArray.sumByDouble(
    selector: (UShort) -> Double
): Double

Returns the sum of all values produced by selector function applied to each element in the collection.

fun <T> Iterable<T>.sumByDouble(
    selector: (T) -> Double
): Double

sumOf

Returns the sum of all values produced by selector function applied to each element in the array.

Common
JVM
JS
Native
1.4
fun <T> Array<out T>.sumOf(selector: (T) -> Double): Double
Common
JVM
JS
Native
1.4
fun ByteArray.sumOf(selector: (Byte) -> Double): Double
Common
JVM
JS
Native
1.4
fun ShortArray.sumOf(selector: (Short) -> Double): Double
Common
JVM
JS
Native
1.4
fun IntArray.sumOf(selector: (Int) -> Double): Double
Common
JVM
JS
Native
1.4
fun LongArray.sumOf(selector: (Long) -> Double): Double
Common
JVM
JS
Native
1.4
fun FloatArray.sumOf(selector: (Float) -> Double): Double
Common
JVM
JS
Native
1.4
fun DoubleArray.sumOf(selector: (Double) -> Double): Double
Common
JVM
JS
Native
1.4
fun BooleanArray.sumOf(selector: (Boolean) -> Double): Double
Common
JVM
JS
Native
1.4
fun CharArray.sumOf(selector: (Char) -> Double): Double
Common
JVM
JS
Native
1.4
fun <T> Array<out T>.sumOf(selector: (T) -> Int): Int
Common
JVM
JS
Native
1.4
fun ByteArray.sumOf(selector: (Byte) -> Int): Int
Common
JVM
JS
Native
1.4
fun ShortArray.sumOf(selector: (Short) -> Int): Int
Common
JVM
JS
Native
1.4
fun IntArray.sumOf(selector: (Int) -> Int): Int
Common
JVM
JS
Native
1.4
fun LongArray.sumOf(selector: (Long) -> Int): Int
Common
JVM
JS
Native
1.4
fun FloatArray.sumOf(selector: (Float) -> Int): Int
Common
JVM
JS
Native
1.4
fun DoubleArray.sumOf(selector: (Double) -> Int): Int
Common
JVM
JS
Native
1.4
fun BooleanArray.sumOf(selector: (Boolean) -> Int): Int
Common
JVM
JS
Native
1.4
fun CharArray.sumOf(selector: (Char) -> Int): Int
Common
JVM
JS
Native
1.4
fun <T> Array<out T>.sumOf(selector: (T) -> Long): Long
Common
JVM
JS
Native
1.4
fun ByteArray.sumOf(selector: (Byte) -> Long): Long
Common
JVM
JS
Native
1.4
fun ShortArray.sumOf(selector: (Short) -> Long): Long
Common
JVM
JS
Native
1.4
fun IntArray.sumOf(selector: (Int) -> Long): Long
Common
JVM
JS
Native
1.4
fun LongArray.sumOf(selector: (Long) -> Long): Long
Common
JVM
JS
Native
1.4
fun FloatArray.sumOf(selector: (Float) -> Long): Long
Common
JVM
JS
Native
1.4
fun DoubleArray.sumOf(selector: (Double) -> Long): Long
Common
JVM
JS
Native
1.4
fun BooleanArray.sumOf(selector: (Boolean) -> Long): Long
Common
JVM
JS
Native
1.4
fun CharArray.sumOf(selector: (Char) -> Long): Long
Common
JVM
JS
Native
1.5
fun <T> Array<out T>.sumOf(selector: (T) -> UInt): UInt
Common
JVM
JS
Native
1.5
fun ByteArray.sumOf(selector: (Byte) -> UInt): UInt
Common
JVM
JS
Native
1.5
fun ShortArray.sumOf(selector: (Short) -> UInt): UInt
Common
JVM
JS
Native
1.5
fun IntArray.sumOf(selector: (Int) -> UInt): UInt
Common
JVM
JS
Native
1.5
fun LongArray.sumOf(selector: (Long) -> UInt): UInt
Common
JVM
JS
Native
1.5
fun FloatArray.sumOf(selector: (Float) -> UInt): UInt
Common
JVM
JS
Native
1.5
fun DoubleArray.sumOf(selector: (Double) -> UInt): UInt
Common
JVM
JS
Native
1.5
fun BooleanArray.sumOf(selector: (Boolean) -> UInt): UInt
Common
JVM
JS
Native
1.5
fun CharArray.sumOf(selector: (Char) -> UInt): UInt
Common
JVM
JS
Native
1.5
fun <T> Array<out T>.sumOf(selector: (T) -> ULong): ULong
Common
JVM
JS
Native
1.5
fun ByteArray.sumOf(selector: (Byte) -> ULong): ULong
Common
JVM
JS
Native
1.5
fun ShortArray.sumOf(selector: (Short) -> ULong): ULong
Common
JVM
JS
Native
1.5
fun IntArray.sumOf(selector: (Int) -> ULong): ULong
Common
JVM
JS
Native
1.5
fun LongArray.sumOf(selector: (Long) -> ULong): ULong
Common
JVM
JS
Native
1.5
fun FloatArray.sumOf(selector: (Float) -> ULong): ULong
Common
JVM
JS
Native
1.5
fun DoubleArray.sumOf(selector: (Double) -> ULong): ULong
Common
JVM
JS
Native
1.5
fun BooleanArray.sumOf(selector: (Boolean) -> ULong): ULong
Common
JVM
JS
Native
1.5
fun CharArray.sumOf(selector: (Char) -> ULong): ULong
Common
JVM
JS
Native
1.4
fun UIntArray.sumOf(selector: (UInt) -> Double): Double
Common
JVM
JS
Native
1.4
fun ULongArray.sumOf(selector: (ULong) -> Double): Double
Common
JVM
JS
Native
1.4
fun UByteArray.sumOf(selector: (UByte) -> Double): Double
Common
JVM
JS
Native
1.4
fun UShortArray.sumOf(selector: (UShort) -> Double): Double
Common
JVM
JS
Native
1.4
fun UIntArray.sumOf(selector: (UInt) -> Int): Int
Common
JVM
JS
Native
1.4
fun ULongArray.sumOf(selector: (ULong) -> Int): Int
Common
JVM
JS
Native
1.4
fun UByteArray.sumOf(selector: (UByte) -> Int): Int
Common
JVM
JS
Native
1.4
fun UShortArray.sumOf(selector: (UShort) -> Int): Int
Common
JVM
JS
Native
1.4
fun UIntArray.sumOf(selector: (UInt) -> Long): Long
Common
JVM
JS
Native
1.4
fun ULongArray.sumOf(selector: (ULong) -> Long): Long
Common
JVM
JS
Native
1.4
fun UByteArray.sumOf(selector: (UByte) -> Long): Long
Common
JVM
JS
Native
1.4
fun UShortArray.sumOf(selector: (UShort) -> Long): Long
Common
JVM
JS
Native
1.5
fun UIntArray.sumOf(selector: (UInt) -> UInt): UInt
Common
JVM
JS
Native
1.5
fun ULongArray.sumOf(selector: (ULong) -> UInt): UInt
Common
JVM
JS
Native
1.5
fun UByteArray.sumOf(selector: (UByte) -> UInt): UInt
Common
JVM
JS
Native
1.5
fun UShortArray.sumOf(selector: (UShort) -> UInt): UInt
Common
JVM
JS
Native
1.5
fun UIntArray.sumOf(selector: (UInt) -> ULong): ULong
Common
JVM
JS
Native
1.5
fun ULongArray.sumOf(selector: (ULong) -> ULong): ULong
Common
JVM
JS
Native
1.5
fun UByteArray.sumOf(selector: (UByte) -> ULong): ULong
Common
JVM
JS
Native
1.5
fun UShortArray.sumOf(selector: (UShort) -> ULong): ULong
JVM
1.4
fun <T> Array<out T>.sumOf(
    selector: (T) -> BigDecimal
): BigDecimal
JVM
1.4
fun ByteArray.sumOf(
    selector: (Byte) -> BigDecimal
): BigDecimal
JVM
1.4
fun ShortArray.sumOf(
    selector: (Short) -> BigDecimal
): BigDecimal
JVM
1.4
fun IntArray.sumOf(selector: (Int) -> BigDecimal): BigDecimal
JVM
1.4
fun LongArray.sumOf(
    selector: (Long) -> BigDecimal
): BigDecimal
JVM
1.4
fun FloatArray.sumOf(
    selector: (Float) -> BigDecimal
): BigDecimal
JVM
1.4
fun DoubleArray.sumOf(
    selector: (Double) -> BigDecimal
): BigDecimal
JVM
1.4
fun BooleanArray.sumOf(
    selector: (Boolean) -> BigDecimal
): BigDecimal
JVM
1.4
fun CharArray.sumOf(
    selector: (Char) -> BigDecimal
): BigDecimal
JVM
1.4
fun <T> Array<out T>.sumOf(
    selector: (T) -> BigInteger
): BigInteger
JVM
1.4
fun ByteArray.sumOf(
    selector: (Byte) -> BigInteger
): BigInteger
JVM
1.4
fun ShortArray.sumOf(
    selector: (Short) -> BigInteger
): BigInteger
JVM
1.4
fun IntArray.sumOf(selector: (Int) -> BigInteger): BigInteger
JVM
1.4
fun LongArray.sumOf(
    selector: (Long) -> BigInteger
): BigInteger
JVM
1.4
fun FloatArray.sumOf(
    selector: (Float) -> BigInteger
): BigInteger
JVM
1.4
fun DoubleArray.sumOf(
    selector: (Double) -> BigInteger
): BigInteger
JVM
1.4
fun BooleanArray.sumOf(
    selector: (Boolean) -> BigInteger
): BigInteger
JVM
1.4
fun CharArray.sumOf(
    selector: (Char) -> BigInteger
): BigInteger
JVM
1.4
fun UIntArray.sumOf(
    selector: (UInt) -> BigDecimal
): BigDecimal
JVM
1.4
fun ULongArray.sumOf(
    selector: (ULong) -> BigDecimal
): BigDecimal
JVM
1.4
fun UByteArray.sumOf(
    selector: (UByte) -> BigDecimal
): BigDecimal
JVM
1.4
fun UShortArray.sumOf(
    selector: (UShort) -> BigDecimal
): BigDecimal
JVM
1.4
fun UIntArray.sumOf(
    selector: (UInt) -> BigInteger
): BigInteger
JVM
1.4
fun ULongArray.sumOf(
    selector: (ULong) -> BigInteger
): BigInteger
JVM
1.4
fun UByteArray.sumOf(
    selector: (UByte) -> BigInteger
): BigInteger
JVM
1.4
fun UShortArray.sumOf(
    selector: (UShort) -> BigInteger
): BigInteger

Returns the sum of all values produced by selector function applied to each element in the collection.

Common
JVM
JS
Native
1.4
fun <T> Iterable<T>.sumOf(selector: (T) -> Double): Double
Common
JVM
JS
Native
1.4
fun <T> Iterable<T>.sumOf(selector: (T) -> Int): Int
Common
JVM
JS
Native
1.4
fun <T> Iterable<T>.sumOf(selector: (T) -> Long): Long
Common
JVM
JS
Native
1.5
fun <T> Iterable<T>.sumOf(selector: (T) -> UInt): UInt
Common
JVM
JS
Native
1.5
fun <T> Iterable<T>.sumOf(selector: (T) -> ULong): ULong
JVM
1.4
fun <T> Iterable<T>.sumOf(
    selector: (T) -> BigDecimal
): BigDecimal
JVM
1.4
fun <T> Iterable<T>.sumOf(
    selector: (T) -> BigInteger
): BigInteger
Common
JVM
JS
Native
1.0

take

Returns a list containing first n elements.

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

takeLast

Returns a list containing last n elements.

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

takeLastWhile

Returns a list containing last elements satisfying the given predicate.

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

takeWhile

Returns a list containing first elements satisfying the given predicate.

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

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

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

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

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

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

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

toHashSet

Returns a new HashSet of all elements.

fun <T> Array<out T>.toHashSet(): HashSet<T>
fun ByteArray.toHashSet(): HashSet<Byte>
fun ShortArray.toHashSet(): HashSet<Short>
fun IntArray.toHashSet(): HashSet<Int>
fun LongArray.toHashSet(): HashSet<Long>
fun FloatArray.toHashSet(): HashSet<Float>
fun DoubleArray.toHashSet(): HashSet<Double>
fun BooleanArray.toHashSet(): HashSet<Boolean>
fun CharArray.toHashSet(): HashSet<Char>
fun <T> Iterable<T>.toHashSet(): HashSet<T>
Common
JVM
JS
Native
1.0

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

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

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

toList

Returns a List containing all elements.

fun <T> Array<out T>.toList(): List<T>
fun ByteArray.toList(): List<Byte>
fun ShortArray.toList(): List<Short>
fun IntArray.toList(): List<Int>
fun LongArray.toList(): List<Long>
fun FloatArray.toList(): List<Float>
fun DoubleArray.toList(): List<Double>
fun BooleanArray.toList(): List<Boolean>
fun CharArray.toList(): List<Char>
fun <T> Iterable<T>.toList(): List<T>

Returns a List containing all key-value pairs.

fun <K, V> Map<out K, V>.toList(): List<Pair<K, V>>
Common
JVM
JS
Native
1.0

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

toMap

Returns a new map containing all key-value pairs from the given collection of pairs.

fun <K, V> Iterable<Pair<K, V>>.toMap(): Map<K, V>

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.

fun <K, V> Array<out Pair<K, V>>.toMap(): Map<K, V>

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.

fun <K, V> Sequence<Pair<K, V>>.toMap(): Map<K, V>

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.

fun <K, V> Map<out K, V>.toMap(): Map<K, V>

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

toMutableList

Returns a new MutableList filled with all elements of this array.

fun <T> any_array<T>.toMutableList(): MutableList<T>

Returns a new MutableList filled with all elements of this collection.

fun <T> Iterable<T>.toMutableList(): MutableList<T>
fun <T> Collection<T>.toMutableList(): MutableList<T>
Common
JVM
JS
Native
1.1

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

toMutableSet

Returns a new MutableSet containing all distinct elements from the given array.

fun <T> any_array<T>.toMutableSet(): MutableSet<T>

Returns a new MutableSet containing all distinct elements from the given collection.

fun <T> Iterable<T>.toMutableSet(): MutableSet<T>
Common
JVM
JS
Native
1.0

toPair

Converts entry to Pair with key being first component and value being second.

fun <K, V> Entry<K, V>.toPair(): Pair<K, V>
JVM
1.0

toProperties

Converts this Map to a Properties object.

fun Map<String, String>.toProperties(): Properties
Common
JVM
JS
Native
1.0

toSet

Returns a Set of all elements.

fun <T> Array<out T>.toSet(): Set<T>
fun ByteArray.toSet(): Set<Byte>
fun ShortArray.toSet(): Set<Short>
fun IntArray.toSet(): Set<Int>
fun LongArray.toSet(): Set<Long>
fun FloatArray.toSet(): Set<Float>
fun DoubleArray.toSet(): Set<Double>
fun BooleanArray.toSet(): Set<Boolean>
fun CharArray.toSet(): Set<Char>
fun <T> Iterable<T>.toSet(): Set<T>
Common
JVM
JS
Native
1.0

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

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

toSortedSet

Returns a new SortedSet of all elements.

fun <T : Comparable<T>> Array<out T>.toSortedSet(): SortedSet<T>
fun ByteArray.toSortedSet(): SortedSet<Byte>
fun ShortArray.toSortedSet(): SortedSet<Short>
fun IntArray.toSortedSet(): SortedSet<Int>
fun LongArray.toSortedSet(): SortedSet<Long>
fun FloatArray.toSortedSet(): SortedSet<Float>
fun DoubleArray.toSortedSet(): SortedSet<Double>
fun BooleanArray.toSortedSet(): SortedSet<Boolean>
fun CharArray.toSortedSet(): SortedSet<Char>
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>
JVM
1.0

toString

Converts the contents of this byte array to a string using the specified charset.

fun ByteArray.toString(charset: Charset): String
Common
JVM
JS
Native
1.0

toTypedArray

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

fun UIntArray.toTypedArray(): Array<UInt>
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 the elements of this collection.

fun <T> Collection<T>.toTypedArray(): Array<T>
Common
JVM
JS
Native
1.3

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

toUIntArray

Returns an array of UInt containing all of the elements of this generic array.

fun Array<out UInt>.toUIntArray(): UIntArray

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.

fun IntArray.toUIntArray(): UIntArray

Returns an array of UInt containing all of the elements of this collection.

fun Collection<UInt>.toUIntArray(): UIntArray
Common
JVM
JS
Native
1.3

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

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

union

Returns a set containing all distinct elements from both collections.

infix fun <T> Array<out T>.union(other: Iterable<T>): Set<T>
infix fun ByteArray.union(other: Iterable<Byte>): Set<Byte>
infix fun ShortArray.union(
    other: Iterable<Short>
): Set<Short>
infix fun IntArray.union(other: Iterable<Int>): Set<Int>
infix fun LongArray.union(other: Iterable<Long>): Set<Long>
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>
infix fun CharArray.union(other: Iterable<Char>): Set<Char>
infix fun <T> Iterable<T>.union(other: Iterable<T>): Set<T>
Common
JVM
JS
Native
1.0

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.

fun <T, R> Array<out Pair<T, R>>.unzip(): Pair<List<T>, List<R>>

Returns a pair of lists, where first list is built from the first values of each pair from this collection, second list is built from the second values of each pair from this collection.

fun <T, R> Iterable<Pair<T, R>>.unzip(): Pair<List<T>, List<R>>
Common
JVM
JS
Native
1.2

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.

fun <T> Iterable<T>.windowed(
    size: Int,
    step: Int = 1,
    partialWindows: Boolean = false
): List<List<T>>

Returns a list of results of applying the given transform function to an each list representing a view over the window of the given size sliding along this collection with the given step.

fun <T, R> Iterable<T>.windowed(
    size: Int,
    step: Int = 1,
    partialWindows: Boolean = false,
    transform: (List<T>) -> R
): List<R>
Common
JVM
JS
Native
1.0

withDefault

Returns a wrapper of this read-only map, having the implicit default value provided with the specified function defaultValue.

fun <K, V> Map<K, V>.withDefault(
    defaultValue: (key: K) -> V
): Map<K, V>

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

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

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

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 <T, R> Array<out T>.zip(
    other: Array<out R>
): List<Pair<T, R>>
infix fun <R> ByteArray.zip(
    other: Array<out R>
): List<Pair<Byte, R>>
infix fun <R> ShortArray.zip(
    other: Array<out R>
): List<Pair<Short, R>>
infix fun <R> IntArray.zip(
    other: Array<out R>
): List<Pair<Int, R>>
infix fun <R> LongArray.zip(
    other: Array<out R>
): List<Pair<Long, 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 <R> CharArray.zip(
    other: Array<out R>
): List<Pair<Char, R>>
infix fun ByteArray.zip(
    other: ByteArray
): List<Pair<Byte, Byte>>
infix fun ShortArray.zip(
    other: ShortArray
): List<Pair<Short, Short>>
infix fun IntArray.zip(other: IntArray): List<Pair<Int, Int>>
infix fun LongArray.zip(
    other: LongArray
): List<Pair<Long, Long>>
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 CharArray.zip(
    other: CharArray
): List<Pair<Char, Char>>
infix fun <R> UIntArray.zip(
    other: Array<out R>
): List<Pair<UInt, R>>
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 UIntArray.zip(
    other: UIntArray
): List<Pair<UInt, UInt>>
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> ByteArray.zip(
    other: Array<out R>,
    transform: (a: Byte, 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> IntArray.zip(
    other: Array<out R>,
    transform: (a: Int, b: R) -> V
): List<V>
fun <R, V> LongArray.zip(
    other: Array<out R>,
    transform: (a: Long, 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> CharArray.zip(
    other: Array<out R>,
    transform: (a: Char, b: R) -> V
): List<V>
fun <R, V> UIntArray.zip(
    other: Array<out R>,
    transform: (a: UInt, 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 <T, R> Array<out T>.zip(
    other: Iterable<R>
): List<Pair<T, R>>
infix fun <R> ByteArray.zip(
    other: Iterable<R>
): List<Pair<Byte, R>>
infix fun <R> ShortArray.zip(
    other: Iterable<R>
): List<Pair<Short, R>>
infix fun <R> IntArray.zip(
    other: Iterable<R>
): List<Pair<Int, R>>
infix fun <R> LongArray.zip(
    other: Iterable<R>
): List<Pair<Long, 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> CharArray.zip(
    other: Iterable<R>
): List<Pair<Char, R>>
infix fun <R> UIntArray.zip(
    other: Iterable<R>
): List<Pair<UInt, 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 <T, R, V> Array<out T>.zip(
    other: Iterable<R>,
    transform: (a: T, b: R) -> V
): List<V>
fun <R, V> ByteArray.zip(
    other: Iterable<R>,
    transform: (a: Byte, b: R) -> V
): List<V>
fun <R, V> ShortArray.zip(
    other: Iterable<R>,
    transform: (a: Short, b: R) -> V
): List<V>
fun <R, V> IntArray.zip(
    other: Iterable<R>,
    transform: (a: Int, b: R) -> V
): List<V>
fun <R, V> LongArray.zip(
    other: Iterable<R>,
    transform: (a: Long, 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> CharArray.zip(
    other: Iterable<R>,
    transform: (a: Char, b: R) -> V
): List<V>
fun <R, V> UIntArray.zip(
    other: Iterable<R>,
    transform: (a: UInt, 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> ByteArray.zip(
    other: ByteArray,
    transform: (a: Byte, b: Byte) -> V
): List<V>
fun <V> ShortArray.zip(
    other: ShortArray,
    transform: (a: Short, b: Short) -> V
): List<V>
fun <V> IntArray.zip(
    other: IntArray,
    transform: (a: Int, b: Int) -> V
): List<V>
fun <V> LongArray.zip(
    other: LongArray,
    transform: (a: Long, b: Long) -> 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> CharArray.zip(
    other: CharArray,
    transform: (a: Char, b: Char) -> V
): List<V>
fun <V> UIntArray.zip(
    other: UIntArray,
    transform: (a: UInt, b: UInt) -> 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.

infix fun <T, R> Iterable<T>.zip(
    other: Array<out R>
): List<Pair<T, R>>

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.

fun <T, R, V> Iterable<T>.zip(
    other: Array<out R>,
    transform: (a: T, b: R) -> V
): List<V>

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.

infix fun <T, R> Iterable<T>.zip(
    other: Iterable<R>
): List<Pair<T, R>>

Returns a list of values built from the elements of this collection 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 <T, R, V> Iterable<T>.zip(
    other: Iterable<R>,
    transform: (a: T, b: R) -> V
): List<V>
Common
JVM
JS
Native
1.2

zipWithNext

Returns a list of pairs of each two adjacent elements in this collection.

fun <T> Iterable<T>.zipWithNext(): List<Pair<T, T>>

Returns a list containing the results of applying the given transform function to an each pair of two adjacent elements in this collection.

fun <T, R> Iterable<T>.zipWithNext(
    transform: (a: T, b: T) -> R
): List<R>