Package-level declarations

Types

Link copied to clipboard
class ArrayList<T>(initialCapacity: Int = 10) : MutableList<T>

A mutable ordered list backed by an array that grows as elements are added.

Link copied to clipboard
abstract class BooleanIterator : Iterator<Boolean>
Link copied to clipboard
abstract class ByteIterator : Iterator<Byte>
Link copied to clipboard
abstract class CharIterator : Iterator<Char>
Link copied to clipboard
interface Collection<out T> : Iterable<T>

A read-only view of a group of elements with size and membership queries.

Link copied to clipboard
abstract class DoubleIterator : Iterator<Double>
Link copied to clipboard
abstract class FloatIterator : Iterator<Float>
Link copied to clipboard
class HashMap<K, V>(initialCapacity: Int = 16) : MutableMap<K, V>

A mutable hash map associating each distinct key with one value.

Link copied to clipboard
class HashSet<T>(initialCapacity: Int = 16) : MutableSet<T>

A mutable hash set containing one element from each group of equal elements.

Link copied to clipboard
abstract class IntIterator : Iterator<Int>
Link copied to clipboard
interface Iterable<out T>

A source of elements that can be traversed with an Iterator.

Link copied to clipboard
interface Iterator<out T>

Visits elements of an Iterable one at a time.

Link copied to clipboard
interface List<out T> : Collection<T>

A read-only ordered collection with zero-based indexed access.

Link copied to clipboard
abstract class LongIterator : Iterator<Long>
Link copied to clipboard
interface Map<K, out V>

A read-only association from unique keys to values.

Link copied to clipboard

A collection that supports insertion, removal and clearing.

Link copied to clipboard
interface MutableIterable<out T> : Iterable<T>

An Iterable whose iterator supports element removal.

Link copied to clipboard
interface MutableIterator<out T> : Iterator<T>

An Iterator that can remove the most recently returned element.

Link copied to clipboard

A mutable ordered collection with indexed insertion, replacement and removal.

Link copied to clipboard
interface MutableMap<K, V> : Map<K, V>

A map supporting association replacement, removal and clearing.

Link copied to clipboard
interface MutableSet<T> : Set<T> , MutableCollection<T>

A set supporting insertion, removal and clearing without duplicate elements.

Link copied to clipboard
interface Set<out T> : Collection<T>

A read-only collection containing no duplicate elements under its equality rules.

Link copied to clipboard
abstract class ShortIterator : Iterator<Short>

Functions

Link copied to clipboard
inline fun <T> Iterable<T>.all(predicate: (T) -> Boolean): Boolean

Returns true when every element matches predicate.

Link copied to clipboard
inline fun <T> Iterable<T>.any(predicate: (T) -> Boolean): Boolean

Returns true when at least one element matches predicate.

Link copied to clipboard

Borrows this iterable as a lazy sequence without traversing or copying it. Each traversal requests a new source iterator; later mutations and invalidation follow the iterable's own contract. Wrappers and iterators use ordinary managed heap quotas.

Link copied to clipboard
operator fun <K, V> Map.Entry<K, V>.component1(): K

Returns this entry's key for destructuring.

Link copied to clipboard
operator fun <K, V> Map.Entry<K, V>.component2(): V

Returns this entry's current value for destructuring.

Link copied to clipboard
operator fun <T> Iterable<T>.contains(element: T): Boolean

Checks whether this iterable has an element equal to element.

operator fun <K, V> Map<K, V>.contains(key: K): Boolean

Checks key membership using key in map syntax.

Link copied to clipboard
external fun <T> Array<out T>.copyInto(destination: Array<T>, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): Array<T>
external fun BooleanArray.copyInto(destination: BooleanArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): BooleanArray
external fun ByteArray.copyInto(destination: ByteArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): ByteArray
external fun CharArray.copyInto(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): CharArray
external fun DoubleArray.copyInto(destination: DoubleArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): DoubleArray
external fun FloatArray.copyInto(destination: FloatArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): FloatArray
external fun IntArray.copyInto(destination: IntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): IntArray
external fun LongArray.copyInto(destination: LongArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): LongArray
external fun ShortArray.copyInto(destination: ShortArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): ShortArray
external fun UByteArray.copyInto(destination: UByteArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): UByteArray
external fun UIntArray.copyInto(destination: UIntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): UIntArray
external fun ULongArray.copyInto(destination: ULongArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): ULongArray
external fun UShortArray.copyInto(destination: UShortArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): UShortArray

Copies this range into destination, supporting overlapping ranges, and returns it.

Link copied to clipboard
external fun <T> Array<T>.copyOf(): Array<T>
external fun ByteArray.copyOf(): ByteArray
external fun CharArray.copyOf(): CharArray
external fun FloatArray.copyOf(): FloatArray
external fun IntArray.copyOf(): IntArray
external fun LongArray.copyOf(): LongArray
external fun ShortArray.copyOf(): ShortArray
external fun UByteArray.copyOf(): UByteArray
external fun UIntArray.copyOf(): UIntArray
external fun ULongArray.copyOf(): ULongArray

Returns a new array containing the same elements.

external fun <T> Array<T>.copyOf(newSize: Int): Array<T?>

Returns a resized copy, padding extra elements with null.

external fun BooleanArray.copyOf(newSize: Int): BooleanArray

Returns a resized copy, padding extra elements with false.

external fun ByteArray.copyOf(newSize: Int): ByteArray
external fun DoubleArray.copyOf(newSize: Int): DoubleArray
external fun FloatArray.copyOf(newSize: Int): FloatArray
external fun IntArray.copyOf(newSize: Int): IntArray
external fun LongArray.copyOf(newSize: Int): LongArray
external fun ShortArray.copyOf(newSize: Int): ShortArray
external fun UByteArray.copyOf(newSize: Int): UByteArray
external fun UIntArray.copyOf(newSize: Int): UIntArray
external fun ULongArray.copyOf(newSize: Int): ULongArray
external fun UShortArray.copyOf(newSize: Int): UShortArray

Returns a resized copy, padding extra elements with zero.

external fun CharArray.copyOf(newSize: Int): CharArray

Returns a resized copy, padding extra elements with zero characters.

Link copied to clipboard
external fun <T> Array<T>.copyOfRange(fromIndex: Int, toIndex: Int): Array<T>

Returns a new array containing elements from fromIndex up to, but excluding, toIndex.

Link copied to clipboard
external fun <T> emptyList(): List<T>

Creates a fresh empty ArrayList exposed through the read-only List interface.

Link copied to clipboard
fun <K, V> emptyMap(): Map<K, V>

Creates a fresh empty HashMap exposed through the read-only Map interface.

Link copied to clipboard
fun <T> emptySet(): Set<T>

Creates a fresh empty HashSet exposed through the read-only Set interface.

Link copied to clipboard
inline fun <T> Iterable<T>.filter(predicate: (T) -> Boolean): List<T>

Returns a list containing elements matching predicate, in their original iteration order.

Link copied to clipboard

Returns a list of non-null elements in their original iteration order.

Link copied to clipboard
inline fun <T, C : MutableCollection<in T>> Iterable<T>.filterTo(destination: C, predicate: (T) -> Boolean): C

Appends matching elements to destination in iteration order.

Link copied to clipboard
inline fun <T> Iterable<T>.find(predicate: (T) -> Boolean): T?

Returns the first matching element, or null when no element matches predicate.

Link copied to clipboard
fun <T> Iterable<T>.first(): T

Returns the first element, throwing NoSuchElementException when empty.

inline fun <T> Iterable<T>.first(predicate: (T) -> Boolean): T

Returns the first matching element, throwing NoSuchElementException when no element matches.

Link copied to clipboard
fun <T> Iterable<T>.firstOrNull(): T?

Returns the first element, or null when this iterable is empty.

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

Returns the first element, or null when this list is empty.

inline fun <T> Iterable<T>.firstOrNull(predicate: (T) -> Boolean): T?

Returns the first matching element, or null when no element matches predicate.

Link copied to clipboard
inline fun <T, R> Iterable<T>.fold(initial: R, operation: (R, T) -> R): R

Accumulates elements in iteration order.

Link copied to clipboard
inline fun <T> Iterable<T>.forEach(action: (T) -> Unit)

Calls action for each element in iteration order.

Link copied to clipboard
inline fun <T> Iterable<T>.forEachIndexed(action: (Int, T) -> Unit)

Calls action for each element and its zero-based index in iteration order.

Link copied to clipboard
fun <T> List<T>.getOrNull(index: Int): T?

Returns the element at index, or null when the index is outside this list.

Link copied to clipboard
inline fun <K, V> MutableMap<K, V>.getOrPut(key: K, defaultValue: () -> V): V

Returns a non-null value for key, or computes and stores a default value.

Link copied to clipboard
fun <T> Iterable<T>.indexOf(element: T): Int

Returns the index of the first equal element, or -1 when no element matches.

Link copied to clipboard

Checks whether this collection contains at least one element.

fun <K, V> Map<K, V>.isNotEmpty(): Boolean

Checks whether this map contains at least one association.

Link copied to clipboard
operator fun <K, V> Map<K, V>.iterator(): Iterator<Map.Entry<K, V>>

Returns an iterator over this map's entries, enabling for ((key, value) in map).

Link copied to clipboard
fun <T> Iterable<T>.lastIndexOf(element: T): Int

Returns the index of the last equal element, or -1 when no element matches.

Link copied to clipboard
fun <T> Iterable<T>.lastOrNull(): T?

Returns the last element, or null when this iterable is empty.

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

Returns the last element, or null when this list is empty.

inline fun <T> Iterable<T>.lastOrNull(predicate: (T) -> Boolean): T?

Returns the last matching element after traversing this iterable in iteration order.

inline fun <T> List<T>.lastOrNull(predicate: (T) -> Boolean): T?

Returns the last element satisfying predicate, or null when no element matches.

Link copied to clipboard
external fun <T> listOf(vararg elements: T): List<T>

Creates a new list containing elements in argument order, including duplicates and nulls.

Link copied to clipboard
inline fun <T, R> Collection<T>.map(transform: (T) -> R): List<R>
inline fun <T, R> Iterable<T>.map(transform: (T) -> R): List<R>

Returns a list containing transform applied once to each element in iteration order.

Link copied to clipboard
inline fun <T, R : Any> Iterable<T>.mapNotNull(transform: (T) -> R?): List<R>

Applies transform once per element in iteration order and retains only non-null results.

Link copied to clipboard
inline fun <T, R : Any, C : MutableCollection<in R>> Iterable<T>.mapNotNullTo(destination: C, transform: (T) -> R?): C

Appends non-null transformed elements to destination in iteration order.

Link copied to clipboard
external fun <K, V> mapOf(vararg pairs: Pair<K, V>): Map<K, V>

Creates a fresh read-only map containing the supplied key-value pairs.

Link copied to clipboard
inline fun <T, R, C : MutableCollection<in R>> Iterable<T>.mapTo(destination: C, transform: (T) -> R): C

Appends transformed elements to destination in iteration order.

Link copied to clipboard
external fun <K, V> mutableMapOf(vararg pairs: Pair<K, V>): MutableMap<K, V>

Creates a fresh mutable HashMap containing the supplied key-value pairs.

Link copied to clipboard
external fun <T> mutableSetOf(vararg elements: T): MutableSet<T>

Creates a fresh mutable HashSet containing the distinct supplied elements.

Link copied to clipboard
inline fun <T> Iterable<T>.none(predicate: (T) -> Boolean): Boolean

Returns true when no element matches predicate.

Link copied to clipboard
operator fun <K, V> MutableMap<K, V>.set(key: K, value: V)

Associates key with value using indexed assignment, discarding the previous value.

Link copied to clipboard
external fun <T> setOf(vararg elements: T): Set<T>

Creates a fresh read-only set containing the distinct supplied elements.

Link copied to clipboard

Numeric accumulation traverses once in iteration order without an intermediate collection. Empty iterables return positive numeric zero. Integer arithmetic wraps at the result width; Float/Double addition retains ordinary rounding, infinities and NaN. Byte/Short widen to Int; UByte/UShort widen to UInt. Iterator failures propagate unchanged.

Link copied to clipboard
inline fun <T> Iterable<T>.sumOf(selector: (T) -> Double): Double

Sums selector once per element in iteration order, returning Double zero when empty. No collection is allocated; selector/iterator exceptions and inline non-local returns propagate. Addition retains ordinary Double rounding, infinities and NaN.

inline fun <T> Iterable<T>.sumOf(selector: (T) -> Int): Int

Sums selector once per element in iteration order, returning Int zero when empty. No collection is allocated; selector/iterator exceptions and inline non-local returns propagate. Addition uses ordinary wrapping Int arithmetic.

inline fun <T> Iterable<T>.sumOf(selector: (T) -> Long): Long

Sums selector once per element in iteration order, returning Long zero when empty. No collection is allocated; selector/iterator exceptions and inline non-local returns propagate. Addition uses ordinary wrapping Long arithmetic.

inline fun <T> Iterable<T>.sumOf(selector: (T) -> UInt): UInt

Sums selector once per element in iteration order, returning UInt zero when empty. No collection is allocated; selector/iterator exceptions and inline non-local returns propagate. Addition uses ordinary wrapping UInt arithmetic.

inline fun <T> Iterable<T>.sumOf(selector: (T) -> ULong): ULong

Sums selector once per element in iteration order, returning ULong zero when empty. No collection is allocated; selector/iterator exceptions and inline non-local returns propagate. Addition uses ordinary wrapping ULong arithmetic.