Package-level declarations

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

Types

Link copied to clipboard
abstract class AbstractIterator<T> : Iterator<T>

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.

Since Kotlin 1.0
Link copied to clipboard
expect abstract class AbstractMutableList<E> : MutableList<E>

Provides a skeletal implementation of the MutableList interface.

Since Kotlin 1.0
Link copied to clipboard
abstract class BooleanIterator : Iterator<Boolean>

An iterator over a sequence of values of type Boolean.

Since Kotlin 1.0
Link copied to clipboard
abstract class ByteIterator : Iterator<Byte>

An iterator over a sequence of values of type Byte.

Since Kotlin 1.0
Link copied to clipboard
abstract class CharIterator : Iterator<Char>

An iterator over a sequence of values of type Char.

Since Kotlin 1.0
Link copied to clipboard
interface Collection<out E> : Iterable<E>

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.

Since Kotlin 1.0
Link copied to clipboard
abstract class DoubleIterator : Iterator<Double>

An iterator over a sequence of values of type Double.

Since Kotlin 1.0
Link copied to clipboard
abstract class FloatIterator : Iterator<Float>

An iterator over a sequence of values of type Float.

Since Kotlin 1.0
Link copied to clipboard
data class IndexedValue<out T>(val index: Int, val value: T)

Data class representing a value from a collection or sequence, along with its index in that collection or sequence.

Since Kotlin 1.0
Link copied to clipboard
abstract class IntIterator : Iterator<Int>

An iterator over a sequence of values of type Int.

Since Kotlin 1.0
Link copied to clipboard
interface Iterable<out T>

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

Since Kotlin 1.0
Link copied to clipboard
interface Iterator<out T>

An iterator over a collection or another entity that can be represented as a sequence of elements. Allows to sequentially access the elements.

Since Kotlin 1.0
Link copied to clipboard
interface List<out E> : Collection<E>

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.

Since Kotlin 1.0
Link copied to clipboard
interface ListIterator<out T> : Iterator<T>

An iterator over a collection that supports indexed access.

Since Kotlin 1.0
Link copied to clipboard
abstract class LongIterator : Iterator<Long>

An iterator over a sequence of values of type Long.

Since Kotlin 1.0
Link copied to clipboard
interface Map<K, out V>

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.

Since Kotlin 1.0
Link copied to clipboard

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

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

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.

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

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

Since Kotlin 1.0
Link copied to clipboard

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

Since Kotlin 1.0
Link copied to clipboard

An iterator over a mutable collection that supports indexed access. Provides the ability to add, modify and remove elements while iterating.

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

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.

Since Kotlin 1.0
Link copied to clipboard
interface MutableSet<E> : Set<E> , MutableCollection<E>

A generic unordered collection of elements that does not support duplicate elements, and supports adding and removing elements.

Since Kotlin 1.0
Link copied to clipboard
interface Set<out E> : Collection<E>

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.

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

An iterator over a sequence of values of type Short.

Since Kotlin 1.0

Properties

Link copied to clipboard
val <T> Array<out T>.indices: IntRange

Returns the range of valid indices for the array.

Since Kotlin 1.0

Returns an IntRange of the valid indices for this collection.

Since Kotlin 1.0
Link copied to clipboard
val <T> Array<out T>.lastIndex: Int

Returns the last valid index for the array.

Since Kotlin 1.0
val <T> List<T>.lastIndex: Int

Returns the index of the last item in the list or -1 if the list is empty.

Since Kotlin 1.0

Functions

Link copied to clipboard
fun <T> MutableCollection<in T>.addAll(elements: Array<out T>): Boolean

Adds all elements of the given elements array to this MutableCollection.

Since Kotlin 1.0
fun <T> MutableCollection<in T>.addAll(elements: Iterable<T>): Boolean

Adds all elements of the given elements collection to this MutableCollection.

Since Kotlin 1.0
fun <T> MutableCollection<in T>.addAll(elements: Sequence<T>): Boolean

Adds all elements of the given elements sequence to this MutableCollection.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Array<out T>.all(predicate: (T) -> Boolean): Boolean
inline fun BooleanArray.all(predicate: (Boolean) -> Boolean): Boolean
inline fun ByteArray.all(predicate: (Byte) -> Boolean): Boolean
inline fun CharArray.all(predicate: (Char) -> Boolean): Boolean
inline fun DoubleArray.all(predicate: (Double) -> Boolean): Boolean
inline fun FloatArray.all(predicate: (Float) -> Boolean): Boolean
inline fun IntArray.all(predicate: (Int) -> Boolean): Boolean
inline fun LongArray.all(predicate: (Long) -> Boolean): Boolean
inline fun ShortArray.all(predicate: (Short) -> Boolean): Boolean
inline fun <T> Iterable<T>.all(predicate: (T) -> Boolean): Boolean

Returns true if all elements match the given predicate.

Since Kotlin 1.0
inline fun <K, V> Map<out K, V>.all(predicate: (Map.Entry<K, V>) -> Boolean): Boolean

Returns true if all entries match the given predicate.

Since Kotlin 1.0
Link copied to clipboard
fun <T> Array<out T>.any(): Boolean

Returns true if array has at least one element.

Since Kotlin 1.0
fun <T> Iterable<T>.any(): Boolean

Returns true if collection has at least one element.

Since Kotlin 1.0
fun <K, V> Map<out K, V>.any(): Boolean

Returns true if map has at least one entry.

Since Kotlin 1.0
inline fun <T> Array<out T>.any(predicate: (T) -> Boolean): Boolean
inline fun BooleanArray.any(predicate: (Boolean) -> Boolean): Boolean
inline fun ByteArray.any(predicate: (Byte) -> Boolean): Boolean
inline fun CharArray.any(predicate: (Char) -> Boolean): Boolean
inline fun DoubleArray.any(predicate: (Double) -> Boolean): Boolean
inline fun FloatArray.any(predicate: (Float) -> Boolean): Boolean
inline fun IntArray.any(predicate: (Int) -> Boolean): Boolean
inline fun LongArray.any(predicate: (Long) -> Boolean): Boolean
inline fun ShortArray.any(predicate: (Short) -> Boolean): Boolean
inline fun <T> Iterable<T>.any(predicate: (T) -> Boolean): Boolean

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

Since Kotlin 1.0
inline fun <K, V> Map<out K, V>.any(predicate: (Map.Entry<K, V>) -> Boolean): Boolean

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

Since Kotlin 1.0
Link copied to clipboard
fun <T> arrayListOf(vararg elements: T): ArrayList<T>

Returns a new ArrayList with the given elements.

Since Kotlin 1.0
Link copied to clipboard
fun <T> Array<out T>.asIterable(): Iterable<T>

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

Since Kotlin 1.0
inline fun <T> Iterable<T>.asIterable(): Iterable<T>

Returns this collection as an Iterable.

Since Kotlin 1.0
inline fun <K, V> Map<out K, V>.asIterable(): Iterable<Map.Entry<K, V>>

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

Since Kotlin 1.0
Link copied to clipboard
expect fun <T> Array<out T>.asList(): List<T>
actual fun <T> Array<out T>.asList(): List<T>
expect fun ByteArray.asList(): List<Byte>
actual fun ByteArray.asList(): List<Byte>
expect fun CharArray.asList(): List<Char>
actual fun CharArray.asList(): List<Char>
expect fun DoubleArray.asList(): List<Double>
actual fun DoubleArray.asList(): List<Double>
expect fun FloatArray.asList(): List<Float>
actual fun FloatArray.asList(): List<Float>
expect fun IntArray.asList(): List<Int>
actual fun IntArray.asList(): List<Int>
expect fun LongArray.asList(): List<Long>
actual fun LongArray.asList(): List<Long>
expect fun ShortArray.asList(): List<Short>
actual fun ShortArray.asList(): List<Short>

Returns a List that wraps the original array.

Since Kotlin 1.0
Link copied to clipboard
fun <T> List<T>.asReversed(): List<T>

Returns a reversed read-only view of the original List. All changes made in the original list will be reflected in the reversed one.

Since Kotlin 1.0
@JvmName(name = "asReversedMutable")
fun <T> MutableList<T>.asReversed(): MutableList<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.

Since Kotlin 1.0
Link copied to clipboard
fun <T> Array<out T>.asSequence(): Sequence<T>

Creates a Sequence instance that wraps the original array returning its elements when being iterated.

Since Kotlin 1.0

Creates a Sequence instance that wraps the original collection returning its elements when being iterated.

Since Kotlin 1.0
fun <K, V> Map<out K, V>.asSequence(): Sequence<Map.Entry<K, V>>

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <T, K, V> Array<out T>.associate(transform: (T) -> Pair<K, V>): Map<K, V>
inline fun <K, V> BooleanArray.associate(transform: (Boolean) -> Pair<K, V>): Map<K, V>
inline fun <K, V> ByteArray.associate(transform: (Byte) -> Pair<K, V>): Map<K, V>
inline fun <K, V> CharArray.associate(transform: (Char) -> Pair<K, V>): Map<K, V>
inline fun <K, V> DoubleArray.associate(transform: (Double) -> Pair<K, V>): Map<K, V>
inline fun <K, V> FloatArray.associate(transform: (Float) -> Pair<K, V>): Map<K, V>
inline fun <K, V> IntArray.associate(transform: (Int) -> Pair<K, V>): Map<K, V>
inline fun <K, V> LongArray.associate(transform: (Long) -> Pair<K, V>): Map<K, V>
inline fun <K, V> ShortArray.associate(transform: (Short) -> Pair<K, V>): Map<K, V>

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

Since Kotlin 1.0
inline fun <T, K, V> Iterable<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.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T, K> Array<out T>.associateBy(keySelector: (T) -> K): Map<K, T>
inline fun <K> BooleanArray.associateBy(keySelector: (Boolean) -> K): Map<K, Boolean>
inline fun <K> ByteArray.associateBy(keySelector: (Byte) -> K): Map<K, Byte>
inline fun <K> CharArray.associateBy(keySelector: (Char) -> K): Map<K, Char>
inline fun <K> DoubleArray.associateBy(keySelector: (Double) -> K): Map<K, Double>
inline fun <K> FloatArray.associateBy(keySelector: (Float) -> K): Map<K, Float>
inline fun <K> IntArray.associateBy(keySelector: (Int) -> K): Map<K, Int>
inline fun <K> LongArray.associateBy(keySelector: (Long) -> K): Map<K, Long>
inline fun <K> ShortArray.associateBy(keySelector: (Short) -> K): Map<K, Short>

Returns a Map containing the elements from the given array indexed by the key returned from keySelector function applied to each element.

Since Kotlin 1.0
inline fun <T, K> Iterable<T>.associateBy(keySelector: (T) -> K): Map<K, T>

Returns a Map containing the elements from the given collection indexed by the key returned from keySelector function applied to each element.

Since Kotlin 1.0
inline fun <T, K, V> Array<out T>.associateBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map<K, V>
inline fun <K, V> BooleanArray.associateBy(keySelector: (Boolean) -> K, valueTransform: (Boolean) -> V): Map<K, V>
inline fun <K, V> ByteArray.associateBy(keySelector: (Byte) -> K, valueTransform: (Byte) -> V): Map<K, V>
inline fun <K, V> CharArray.associateBy(keySelector: (Char) -> K, valueTransform: (Char) -> V): Map<K, V>
inline fun <K, V> DoubleArray.associateBy(keySelector: (Double) -> K, valueTransform: (Double) -> V): Map<K, V>
inline fun <K, V> FloatArray.associateBy(keySelector: (Float) -> K, valueTransform: (Float) -> V): Map<K, V>
inline fun <K, V> IntArray.associateBy(keySelector: (Int) -> K, valueTransform: (Int) -> V): Map<K, V>
inline fun <K, V> LongArray.associateBy(keySelector: (Long) -> K, valueTransform: (Long) -> V): Map<K, V>
inline fun <K, V> ShortArray.associateBy(keySelector: (Short) -> K, valueTransform: (Short) -> V): Map<K, V>

Returns a Map containing the values provided by valueTransform and indexed by keySelector functions applied to elements of the given array.

Since Kotlin 1.0
inline fun <T, K, V> Iterable<T>.associateBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map<K, V>

Returns a Map containing the values provided by valueTransform and indexed by keySelector functions applied to elements of the given collection.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T, K, M : MutableMap<in K, in T>> Array<out T>.associateByTo(destination: M, keySelector: (T) -> K): M
inline fun <K, M : MutableMap<in K, in Boolean>> BooleanArray.associateByTo(destination: M, keySelector: (Boolean) -> K): M
inline fun <K, M : MutableMap<in K, in Byte>> ByteArray.associateByTo(destination: M, keySelector: (Byte) -> K): M
inline fun <K, M : MutableMap<in K, in Char>> CharArray.associateByTo(destination: M, keySelector: (Char) -> K): M
inline fun <K, M : MutableMap<in K, in Double>> DoubleArray.associateByTo(destination: M, keySelector: (Double) -> K): M
inline fun <K, M : MutableMap<in K, in Float>> FloatArray.associateByTo(destination: M, keySelector: (Float) -> K): M
inline fun <K, M : MutableMap<in K, in Int>> IntArray.associateByTo(destination: M, keySelector: (Int) -> K): M
inline fun <K, M : MutableMap<in K, in Long>> LongArray.associateByTo(destination: M, keySelector: (Long) -> K): M
inline fun <K, M : MutableMap<in K, in Short>> ShortArray.associateByTo(destination: M, keySelector: (Short) -> K): 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 array and value is the element itself.

Since Kotlin 1.0
inline 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 applied to each element of the given collection and value is the element itself.

Since Kotlin 1.0
inline fun <T, K, V, M : MutableMap<in K, in V>> Array<out T>.associateByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): M
inline fun <K, V, M : MutableMap<in K, in V>> BooleanArray.associateByTo(destination: M, keySelector: (Boolean) -> K, valueTransform: (Boolean) -> V): M
inline fun <K, V, M : MutableMap<in K, in V>> ByteArray.associateByTo(destination: M, keySelector: (Byte) -> K, valueTransform: (Byte) -> V): M
inline fun <K, V, M : MutableMap<in K, in V>> CharArray.associateByTo(destination: M, keySelector: (Char) -> K, valueTransform: (Char) -> V): M
inline fun <K, V, M : MutableMap<in K, in V>> DoubleArray.associateByTo(destination: M, keySelector: (Double) -> K, valueTransform: (Double) -> V): M
inline fun <K, V, M : MutableMap<in K, in V>> FloatArray.associateByTo(destination: M, keySelector: (Float) -> K, valueTransform: (Float) -> V): M
inline fun <K, V, M : MutableMap<in K, in V>> IntArray.associateByTo(destination: M, keySelector: (Int) -> K, valueTransform: (Int) -> V): M
inline fun <K, V, M : MutableMap<in K, in V>> LongArray.associateByTo(destination: M, keySelector: (Long) -> K, valueTransform: (Long) -> V): M
inline fun <K, V, M : MutableMap<in K, in V>> ShortArray.associateByTo(destination: M, keySelector: (Short) -> K, valueTransform: (Short) -> V): 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.

Since Kotlin 1.0
inline fun <T, K, V, M : MutableMap<in K, in V>> Iterable<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 and and value is provided by the valueTransform function applied to elements of the given collection.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T, K, V, M : MutableMap<in K, in V>> Array<out T>.associateTo(destination: M, transform: (T) -> Pair<K, V>): M
inline fun <K, V, M : MutableMap<in K, in V>> BooleanArray.associateTo(destination: M, transform: (Boolean) -> Pair<K, V>): M
inline fun <K, V, M : MutableMap<in K, in V>> ByteArray.associateTo(destination: M, transform: (Byte) -> Pair<K, V>): M
inline fun <K, V, M : MutableMap<in K, in V>> CharArray.associateTo(destination: M, transform: (Char) -> Pair<K, V>): M
inline fun <K, V, M : MutableMap<in K, in V>> DoubleArray.associateTo(destination: M, transform: (Double) -> Pair<K, V>): M
inline fun <K, V, M : MutableMap<in K, in V>> FloatArray.associateTo(destination: M, transform: (Float) -> Pair<K, V>): M
inline fun <K, V, M : MutableMap<in K, in V>> IntArray.associateTo(destination: M, transform: (Int) -> Pair<K, V>): M
inline fun <K, V, M : MutableMap<in K, in V>> LongArray.associateTo(destination: M, transform: (Long) -> Pair<K, V>): M
inline fun <K, V, M : MutableMap<in K, in V>> ShortArray.associateTo(destination: M, transform: (Short) -> 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 array.

Since Kotlin 1.0
inline fun <T, K, V, M : MutableMap<in K, in V>> Iterable<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.

Since Kotlin 1.0
Link copied to clipboard
@JvmName(name = "averageOfByte")
fun ByteArray.average(): Double
@JvmName(name = "averageOfDouble")
fun DoubleArray.average(): Double
@JvmName(name = "averageOfFloat")
fun FloatArray.average(): Double
@JvmName(name = "averageOfInt")
fun IntArray.average(): Double
@JvmName(name = "averageOfLong")
fun LongArray.average(): Double
@JvmName(name = "averageOfShort")
fun ShortArray.average(): Double

Returns an average value of elements in the array.

Since Kotlin 1.0
@JvmName(name = "averageOfByte")
fun Iterable<Byte>.average(): Double
@JvmName(name = "averageOfDouble")
fun Iterable<Double>.average(): Double
@JvmName(name = "averageOfFloat")
fun Iterable<Float>.average(): Double
@JvmName(name = "averageOfInt")
fun Iterable<Int>.average(): Double
@JvmName(name = "averageOfLong")
fun Iterable<Long>.average(): Double
@JvmName(name = "averageOfShort")
fun Iterable<Short>.average(): Double

Returns an average value of elements in the collection.

Since Kotlin 1.0
Link copied to clipboard
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 CharArray.binarySearch(element: Char, fromIndex: Int = 0, toIndex: Int = size): Int
fun DoubleArray.binarySearch(element: Double, fromIndex: Int = 0, toIndex: Int = size): Int
fun FloatArray.binarySearch(element: Float, 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 ShortArray.binarySearch(element: Short, fromIndex: Int = 0, toIndex: Int = size): Int

Searches the array or the range of the array for the provided element using the binary search algorithm. The array is expected to be sorted, otherwise the result is undefined.

Since Kotlin 1.0
fun <T> List<T>.binarySearch(fromIndex: Int = 0, toIndex: Int = size, comparison: (T) -> Int): Int

Searches this list or its range for an element for which the given comparison function returns zero using the binary search algorithm.

Since Kotlin 1.0
fun <T : Comparable<T>> List<T?>.binarySearch(element: T?, fromIndex: Int = 0, toIndex: Int = size): Int

Searches this list or its range for the provided element using the binary search algorithm. The list is expected to be sorted into ascending order according to the Comparable natural ordering of its elements, otherwise the result is undefined.

Since Kotlin 1.0
fun <T> Array<out T>.binarySearch(element: T, comparator: Comparator<in T>, fromIndex: Int = 0, toIndex: Int = size): Int

Searches the array or the range of the array for the provided element using the binary search algorithm. The array is expected to be sorted according to the specified comparator, otherwise the result is undefined.

Since Kotlin 1.0
fun <T> List<T>.binarySearch(element: T, comparator: Comparator<in T>, fromIndex: Int = 0, toIndex: Int = size): Int

Searches this list or its range for 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.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T, K : Comparable<K>> List<T>.binarySearchBy(key: K?, fromIndex: Int = 0, toIndex: Int = size, crossinline selector: (T) -> K?): Int

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.

Since Kotlin 1.0
Link copied to clipboard
inline operator fun <T> Array<out T>.component1(): T
inline operator fun BooleanArray.component1(): Boolean
inline operator fun ByteArray.component1(): Byte
inline operator fun CharArray.component1(): Char
inline operator fun DoubleArray.component1(): Double
inline operator fun FloatArray.component1(): Float
inline operator fun IntArray.component1(): Int
inline operator fun LongArray.component1(): Long
inline operator fun ShortArray.component1(): Short

Returns 1st element from the array.

Since Kotlin 1.0
inline operator fun <T> List<T>.component1(): T

Returns 1st element from the list.

Since Kotlin 1.0
inline operator fun <K, V> Map.Entry<K, V>.component1(): K

Returns the key component of the map entry.

Since Kotlin 1.0
Link copied to clipboard
inline operator fun <T> Array<out T>.component2(): T
inline operator fun BooleanArray.component2(): Boolean
inline operator fun ByteArray.component2(): Byte
inline operator fun CharArray.component2(): Char
inline operator fun DoubleArray.component2(): Double
inline operator fun FloatArray.component2(): Float
inline operator fun IntArray.component2(): Int
inline operator fun LongArray.component2(): Long
inline operator fun ShortArray.component2(): Short

Returns 2nd element from the array.

Since Kotlin 1.0
inline operator fun <T> List<T>.component2(): T

Returns 2nd element from the list.

Since Kotlin 1.0
inline operator fun <K, V> Map.Entry<K, V>.component2(): V

Returns the value component of the map entry.

Since Kotlin 1.0
Link copied to clipboard
inline operator fun <T> Array<out T>.component3(): T
inline operator fun BooleanArray.component3(): Boolean
inline operator fun ByteArray.component3(): Byte
inline operator fun CharArray.component3(): Char
inline operator fun DoubleArray.component3(): Double
inline operator fun FloatArray.component3(): Float
inline operator fun IntArray.component3(): Int
inline operator fun LongArray.component3(): Long
inline operator fun ShortArray.component3(): Short

Returns 3rd element from the array.

Since Kotlin 1.0
inline operator fun <T> List<T>.component3(): T

Returns 3rd element from the list.

Since Kotlin 1.0
Link copied to clipboard
inline operator fun <T> Array<out T>.component4(): T
inline operator fun BooleanArray.component4(): Boolean
inline operator fun ByteArray.component4(): Byte
inline operator fun CharArray.component4(): Char
inline operator fun DoubleArray.component4(): Double
inline operator fun FloatArray.component4(): Float
inline operator fun IntArray.component4(): Int
inline operator fun LongArray.component4(): Long
inline operator fun ShortArray.component4(): Short

Returns 4th element from the array.

Since Kotlin 1.0
inline operator fun <T> List<T>.component4(): T

Returns 4th element from the list.

Since Kotlin 1.0
Link copied to clipboard
inline operator fun <T> Array<out T>.component5(): T
inline operator fun BooleanArray.component5(): Boolean
inline operator fun ByteArray.component5(): Byte
inline operator fun CharArray.component5(): Char
inline operator fun DoubleArray.component5(): Double
inline operator fun FloatArray.component5(): Float
inline operator fun IntArray.component5(): Int
inline operator fun LongArray.component5(): Long
inline operator fun ShortArray.component5(): Short

Returns 5th element from the array.

Since Kotlin 1.0
inline operator fun <T> List<T>.component5(): T

Returns 5th element from the list.

Since Kotlin 1.0
Link copied to clipboard
operator fun <T> Array<out T>.contains(element: T): Boolean
operator fun BooleanArray.contains(element: Boolean): Boolean
operator fun ByteArray.contains(element: Byte): Boolean
operator fun CharArray.contains(element: Char): Boolean
operator fun DoubleArray.contains(element: Double): Boolean
operator fun FloatArray.contains(element: Float): Boolean
operator fun IntArray.contains(element: Int): Boolean
operator fun LongArray.contains(element: Long): Boolean
operator fun ShortArray.contains(element: Short): Boolean

Returns true if element is found in the array.

Since Kotlin 1.0
operator fun <T> Iterable<T>.contains(element: T): Boolean

Returns true if element is found in the collection.

Since Kotlin 1.0
inline operator fun <K, V> Map<out K, V>.contains(key: K): Boolean

Checks if the map contains the given key.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Collection<T>.containsAll(elements: Collection<T>): Boolean

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <K> Map<out K, *>.containsKey(key: K): Boolean

Returns true if the map contains the specified key.

Since Kotlin 1.0
Link copied to clipboard
inline fun <K, V> Map<K, V>.containsValue(value: V): Boolean

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

Since Kotlin 1.0
Link copied to clipboard
expect fun <T> Array<T>.copyOf(): Array<T>
actual inline fun <T> Array<T>.copyOf(): Array<T>
actual inline fun BooleanArray.copyOf(): BooleanArray
expect fun ByteArray.copyOf(): ByteArray
actual inline fun ByteArray.copyOf(): ByteArray
expect fun CharArray.copyOf(): CharArray
actual inline fun CharArray.copyOf(): CharArray
actual inline fun DoubleArray.copyOf(): DoubleArray
actual inline fun FloatArray.copyOf(): FloatArray
expect fun IntArray.copyOf(): IntArray
actual inline fun IntArray.copyOf(): IntArray
expect fun LongArray.copyOf(): LongArray
actual inline fun LongArray.copyOf(): LongArray
actual inline fun ShortArray.copyOf(): ShortArray

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

Since Kotlin 1.0
expect fun <T> Array<T>.copyOf(newSize: Int): Array<T?>
actual inline fun <T> Array<T>.copyOf(newSize: Int): Array<T?>

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.

Since Kotlin 1.0
expect fun BooleanArray.copyOf(newSize: Int): BooleanArray
actual inline 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 false values if necessary.

Since Kotlin 1.0
expect fun ByteArray.copyOf(newSize: Int): ByteArray
actual inline fun ByteArray.copyOf(newSize: Int): ByteArray
expect fun DoubleArray.copyOf(newSize: Int): DoubleArray
actual inline fun DoubleArray.copyOf(newSize: Int): DoubleArray
expect fun FloatArray.copyOf(newSize: Int): FloatArray
actual inline fun FloatArray.copyOf(newSize: Int): FloatArray
expect fun IntArray.copyOf(newSize: Int): IntArray
actual inline fun IntArray.copyOf(newSize: Int): IntArray
expect fun LongArray.copyOf(newSize: Int): LongArray
actual inline fun LongArray.copyOf(newSize: Int): LongArray
expect fun ShortArray.copyOf(newSize: Int): ShortArray
actual inline fun ShortArray.copyOf(newSize: Int): ShortArray

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.

Since Kotlin 1.0
expect fun CharArray.copyOf(newSize: Int): CharArray
actual inline 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 char (\u0000) values if necessary.

Since Kotlin 1.0
Link copied to clipboard
expect fun <T> Array<T>.copyOfRange(fromIndex: Int, toIndex: Int): Array<T>
@JvmName(name = "copyOfRangeInline")
actual inline fun <T> Array<T>.copyOfRange(fromIndex: Int, toIndex: Int): Array<T>
expect fun BooleanArray.copyOfRange(fromIndex: Int, toIndex: Int): BooleanArray
@JvmName(name = "copyOfRangeInline")
actual inline fun BooleanArray.copyOfRange(fromIndex: Int, toIndex: Int): BooleanArray
expect fun ByteArray.copyOfRange(fromIndex: Int, toIndex: Int): ByteArray
@JvmName(name = "copyOfRangeInline")
actual inline fun ByteArray.copyOfRange(fromIndex: Int, toIndex: Int): ByteArray
expect fun CharArray.copyOfRange(fromIndex: Int, toIndex: Int): CharArray
@JvmName(name = "copyOfRangeInline")
actual inline fun CharArray.copyOfRange(fromIndex: Int, toIndex: Int): CharArray
expect fun DoubleArray.copyOfRange(fromIndex: Int, toIndex: Int): DoubleArray
@JvmName(name = "copyOfRangeInline")
actual inline fun DoubleArray.copyOfRange(fromIndex: Int, toIndex: Int): DoubleArray
expect fun FloatArray.copyOfRange(fromIndex: Int, toIndex: Int): FloatArray
@JvmName(name = "copyOfRangeInline")
actual inline fun FloatArray.copyOfRange(fromIndex: Int, toIndex: Int): FloatArray
expect fun IntArray.copyOfRange(fromIndex: Int, toIndex: Int): IntArray
@JvmName(name = "copyOfRangeInline")
actual inline fun IntArray.copyOfRange(fromIndex: Int, toIndex: Int): IntArray
expect fun LongArray.copyOfRange(fromIndex: Int, toIndex: Int): LongArray
@JvmName(name = "copyOfRangeInline")
actual inline fun LongArray.copyOfRange(fromIndex: Int, toIndex: Int): LongArray
expect fun ShortArray.copyOfRange(fromIndex: Int, toIndex: Int): ShortArray
@JvmName(name = "copyOfRangeInline")
actual inline fun ShortArray.copyOfRange(fromIndex: Int, toIndex: Int): ShortArray

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Array<out T>.count(): Int
inline fun BooleanArray.count(): Int
inline fun ByteArray.count(): Int
inline fun CharArray.count(): Int
inline fun DoubleArray.count(): Int
inline fun FloatArray.count(): Int
inline fun IntArray.count(): Int
inline fun LongArray.count(): Int
inline fun ShortArray.count(): Int

Returns the number of elements in this array.

Since Kotlin 1.0
inline fun <T> Collection<T>.count(): Int
fun <T> Iterable<T>.count(): Int

Returns the number of elements in this collection.

Since Kotlin 1.0
inline fun <K, V> Map<out K, V>.count(): Int

Returns the number of entries in this map.

Since Kotlin 1.0
inline fun <T> Array<out T>.count(predicate: (T) -> Boolean): Int
inline fun BooleanArray.count(predicate: (Boolean) -> Boolean): Int
inline fun ByteArray.count(predicate: (Byte) -> Boolean): Int
inline fun CharArray.count(predicate: (Char) -> Boolean): Int
inline fun DoubleArray.count(predicate: (Double) -> Boolean): Int
inline fun FloatArray.count(predicate: (Float) -> Boolean): Int
inline fun IntArray.count(predicate: (Int) -> Boolean): Int
inline fun LongArray.count(predicate: (Long) -> Boolean): Int
inline fun ShortArray.count(predicate: (Short) -> Boolean): Int
inline fun <T> Iterable<T>.count(predicate: (T) -> Boolean): Int

Returns the number of elements matching the given predicate.

Since Kotlin 1.0
inline fun <K, V> Map<out K, V>.count(predicate: (Map.Entry<K, V>) -> Boolean): Int

Returns the number of entries matching the given predicate.

Since Kotlin 1.0
Link copied to clipboard
fun <T> Array<out T>.distinct(): List<T>

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

Since Kotlin 1.0
fun <T> Iterable<T>.distinct(): List<T>

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <T, K> Array<out T>.distinctBy(selector: (T) -> K): List<T>
inline fun <K> BooleanArray.distinctBy(selector: (Boolean) -> K): List<Boolean>
inline fun <K> ByteArray.distinctBy(selector: (Byte) -> K): List<Byte>
inline fun <K> CharArray.distinctBy(selector: (Char) -> K): List<Char>
inline fun <K> DoubleArray.distinctBy(selector: (Double) -> K): List<Double>
inline fun <K> FloatArray.distinctBy(selector: (Float) -> K): List<Float>
inline fun <K> IntArray.distinctBy(selector: (Int) -> K): List<Int>
inline fun <K> LongArray.distinctBy(selector: (Long) -> K): List<Long>
inline fun <K> ShortArray.distinctBy(selector: (Short) -> K): List<Short>

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

Since Kotlin 1.0
inline fun <T, K> Iterable<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.

Since Kotlin 1.0
Link copied to clipboard
fun <T> Array<out T>.drop(n: Int): List<T>
fun <T> Iterable<T>.drop(n: Int): List<T>

Returns a list containing all elements except first n elements.

Since Kotlin 1.0
Link copied to clipboard
fun <T> Array<out T>.dropLast(n: Int): List<T>
fun <T> List<T>.dropLast(n: Int): List<T>

Returns a list containing all elements except last n elements.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Array<out T>.dropLastWhile(predicate: (T) -> Boolean): List<T>
inline fun BooleanArray.dropLastWhile(predicate: (Boolean) -> Boolean): List<Boolean>
inline fun ByteArray.dropLastWhile(predicate: (Byte) -> Boolean): List<Byte>
inline fun CharArray.dropLastWhile(predicate: (Char) -> Boolean): List<Char>
inline fun DoubleArray.dropLastWhile(predicate: (Double) -> Boolean): List<Double>
inline fun FloatArray.dropLastWhile(predicate: (Float) -> Boolean): List<Float>
inline fun IntArray.dropLastWhile(predicate: (Int) -> Boolean): List<Int>
inline fun LongArray.dropLastWhile(predicate: (Long) -> Boolean): List<Long>
inline fun ShortArray.dropLastWhile(predicate: (Short) -> Boolean): List<Short>
inline fun <T> List<T>.dropLastWhile(predicate: (T) -> Boolean): List<T>

Returns a list containing all elements except last elements that satisfy the given predicate.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Array<out T>.dropWhile(predicate: (T) -> Boolean): List<T>
inline fun BooleanArray.dropWhile(predicate: (Boolean) -> Boolean): List<Boolean>
inline fun ByteArray.dropWhile(predicate: (Byte) -> Boolean): List<Byte>
inline fun CharArray.dropWhile(predicate: (Char) -> Boolean): List<Char>
inline fun DoubleArray.dropWhile(predicate: (Double) -> Boolean): List<Double>
inline fun FloatArray.dropWhile(predicate: (Float) -> Boolean): List<Float>
inline fun IntArray.dropWhile(predicate: (Int) -> Boolean): List<Int>
inline fun LongArray.dropWhile(predicate: (Long) -> Boolean): List<Long>
inline fun ShortArray.dropWhile(predicate: (Short) -> Boolean): List<Short>
inline fun <T> Iterable<T>.dropWhile(predicate: (T) -> Boolean): List<T>

Returns a list containing all elements except first elements that satisfy the given predicate.

Since Kotlin 1.0
Link copied to clipboard
expect fun <T, K> Grouping<T, K>.eachCount(): Map<K, Int>
Since Kotlin 1.0
Link copied to clipboard
expect fun <T> Array<out T>.elementAt(index: Int): T
actual inline fun <T> Array<out T>.elementAt(index: Int): T
expect fun BooleanArray.elementAt(index: Int): Boolean
actual inline fun BooleanArray.elementAt(index: Int): Boolean
expect fun ByteArray.elementAt(index: Int): Byte
actual inline fun ByteArray.elementAt(index: Int): Byte
expect fun CharArray.elementAt(index: Int): Char
actual inline fun CharArray.elementAt(index: Int): Char
expect fun DoubleArray.elementAt(index: Int): Double
actual inline fun DoubleArray.elementAt(index: Int): Double
expect fun FloatArray.elementAt(index: Int): Float
actual inline fun FloatArray.elementAt(index: Int): Float
expect fun IntArray.elementAt(index: Int): Int
actual inline fun IntArray.elementAt(index: Int): Int
expect fun LongArray.elementAt(index: Int): Long
actual inline fun LongArray.elementAt(index: Int): Long
expect fun ShortArray.elementAt(index: Int): Short
actual inline fun ShortArray.elementAt(index: Int): Short

Returns an element at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this array.

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

Since Kotlin 1.0
inline 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 list.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Array<out T>.elementAtOrElse(index: Int, defaultValue: (Int) -> T): T
inline fun BooleanArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Boolean): Boolean
inline fun ByteArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Byte): Byte
inline fun CharArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Char): Char
inline fun DoubleArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Double): Double
inline fun FloatArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Float): Float
inline fun IntArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Int): Int
inline fun LongArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Long): Long
inline fun ShortArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Short): Short

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.

Since Kotlin 1.0
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 collection.

Since Kotlin 1.0
inline fun <T> List<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.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Array<out T>.elementAtOrNull(index: Int): T?
inline fun ByteArray.elementAtOrNull(index: Int): Byte?
inline fun CharArray.elementAtOrNull(index: Int): Char?
inline fun DoubleArray.elementAtOrNull(index: Int): Double?
inline fun FloatArray.elementAtOrNull(index: Int): Float?
inline fun IntArray.elementAtOrNull(index: Int): Int?
inline fun LongArray.elementAtOrNull(index: Int): Long?
inline fun ShortArray.elementAtOrNull(index: Int): Short?

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

Since Kotlin 1.0
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 collection.

Since Kotlin 1.0
inline fun <T> List<T>.elementAtOrNull(index: Int): T?

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

Since Kotlin 1.0
Link copied to clipboard
fun <T> emptyList(): List<T>

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

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

Returns an empty read-only map of specified type.

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

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

Since Kotlin 1.0
Link copied to clipboard
actual fun <T> Array<T>.fill(element: T, fromIndex: Int = 0, toIndex: Int = size)
actual fun BooleanArray.fill(element: Boolean, fromIndex: Int = 0, toIndex: Int = size)
actual fun ByteArray.fill(element: Byte, fromIndex: Int = 0, toIndex: Int = size)
actual fun CharArray.fill(element: Char, fromIndex: Int = 0, toIndex: Int = size)
actual fun DoubleArray.fill(element: Double, fromIndex: Int = 0, toIndex: Int = size)
actual fun FloatArray.fill(element: Float, fromIndex: Int = 0, toIndex: Int = size)
actual fun IntArray.fill(element: Int, fromIndex: Int = 0, toIndex: Int = size)
actual fun LongArray.fill(element: Long, fromIndex: Int = 0, toIndex: Int = size)
actual fun ShortArray.fill(element: Short, fromIndex: Int = 0, toIndex: Int = size)

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Array<out T>.filter(predicate: (T) -> Boolean): List<T>
inline fun BooleanArray.filter(predicate: (Boolean) -> Boolean): List<Boolean>
inline fun ByteArray.filter(predicate: (Byte) -> Boolean): List<Byte>
inline fun CharArray.filter(predicate: (Char) -> Boolean): List<Char>
inline fun DoubleArray.filter(predicate: (Double) -> Boolean): List<Double>
inline fun FloatArray.filter(predicate: (Float) -> Boolean): List<Float>
inline fun IntArray.filter(predicate: (Int) -> Boolean): List<Int>
inline fun LongArray.filter(predicate: (Long) -> Boolean): List<Long>
inline fun ShortArray.filter(predicate: (Short) -> Boolean): List<Short>
inline fun <T> Iterable<T>.filter(predicate: (T) -> Boolean): List<T>

Returns a list containing only elements matching the given predicate.

Since Kotlin 1.0
inline fun <K, V> Map<out K, V>.filter(predicate: (Map.Entry<K, V>) -> Boolean): Map<K, V>

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Array<out T>.filterIndexed(predicate: (index: Int, T) -> Boolean): List<T>
inline fun BooleanArray.filterIndexed(predicate: (index: Int, Boolean) -> Boolean): List<Boolean>
inline fun ByteArray.filterIndexed(predicate: (index: Int, Byte) -> Boolean): List<Byte>
inline fun CharArray.filterIndexed(predicate: (index: Int, Char) -> Boolean): List<Char>
inline fun DoubleArray.filterIndexed(predicate: (index: Int, Double) -> Boolean): List<Double>
inline fun FloatArray.filterIndexed(predicate: (index: Int, Float) -> Boolean): List<Float>
inline fun IntArray.filterIndexed(predicate: (index: Int, Int) -> Boolean): List<Int>
inline fun LongArray.filterIndexed(predicate: (index: Int, Long) -> Boolean): List<Long>
inline fun ShortArray.filterIndexed(predicate: (index: Int, Short) -> Boolean): List<Short>
inline fun <T> Iterable<T>.filterIndexed(predicate: (index: Int, T) -> Boolean): List<T>

Returns a list containing only elements matching the given predicate.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T, C : MutableCollection<in T>> Array<out T>.filterIndexedTo(destination: C, predicate: (index: Int, T) -> Boolean): C
inline fun <C : MutableCollection<in Boolean>> BooleanArray.filterIndexedTo(destination: C, predicate: (index: Int, Boolean) -> Boolean): C
inline fun <C : MutableCollection<in Byte>> ByteArray.filterIndexedTo(destination: C, predicate: (index: Int, Byte) -> Boolean): C
inline fun <C : MutableCollection<in Char>> CharArray.filterIndexedTo(destination: C, predicate: (index: Int, Char) -> Boolean): C
inline fun <C : MutableCollection<in Double>> DoubleArray.filterIndexedTo(destination: C, predicate: (index: Int, Double) -> Boolean): C
inline fun <C : MutableCollection<in Float>> FloatArray.filterIndexedTo(destination: C, predicate: (index: Int, Float) -> Boolean): C
inline fun <C : MutableCollection<in Int>> IntArray.filterIndexedTo(destination: C, predicate: (index: Int, Int) -> Boolean): C
inline fun <C : MutableCollection<in Long>> LongArray.filterIndexedTo(destination: C, predicate: (index: Int, Long) -> Boolean): C
inline fun <C : MutableCollection<in Short>> ShortArray.filterIndexedTo(destination: C, predicate: (index: Int, Short) -> Boolean): C
inline fun <T, C : MutableCollection<in T>> Iterable<T>.filterIndexedTo(destination: C, predicate: (index: Int, T) -> Boolean): C

Appends all elements matching the given predicate to the given destination.

Since Kotlin 1.0
Link copied to clipboard
inline fun <R> Array<*>.filterIsInstance(): List<R>
inline fun <R> Iterable<*>.filterIsInstance(): List<R>

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

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

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <R, C : MutableCollection<in R>> Array<*>.filterIsInstanceTo(destination: C): C
inline fun <R, C : MutableCollection<in R>> Iterable<*>.filterIsInstanceTo(destination: C): C

Appends all elements that are instances of specified type parameter R to the given destination.

Since Kotlin 1.0
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

Appends all elements that are instances of specified class to the given destination.

Since Kotlin 1.0
Link copied to clipboard
inline fun <K, V> Map<out K, V>.filterKeys(predicate: (K) -> Boolean): Map<K, V>

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Array<out T>.filterNot(predicate: (T) -> Boolean): List<T>
inline fun BooleanArray.filterNot(predicate: (Boolean) -> Boolean): List<Boolean>
inline fun ByteArray.filterNot(predicate: (Byte) -> Boolean): List<Byte>
inline fun CharArray.filterNot(predicate: (Char) -> Boolean): List<Char>
inline fun DoubleArray.filterNot(predicate: (Double) -> Boolean): List<Double>
inline fun FloatArray.filterNot(predicate: (Float) -> Boolean): List<Float>
inline fun IntArray.filterNot(predicate: (Int) -> Boolean): List<Int>
inline fun LongArray.filterNot(predicate: (Long) -> Boolean): List<Long>
inline fun ShortArray.filterNot(predicate: (Short) -> Boolean): List<Short>
inline fun <T> Iterable<T>.filterNot(predicate: (T) -> Boolean): List<T>

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

Since Kotlin 1.0
inline fun <K, V> Map<out K, V>.filterNot(predicate: (Map.Entry<K, V>) -> Boolean): Map<K, V>

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

Since Kotlin 1.0
Link copied to clipboard
fun <T : Any> Array<out T?>.filterNotNull(): List<T>

Returns a list containing all elements that are not null.

Since Kotlin 1.0
Link copied to clipboard
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

Appends all elements that are not null to the given destination.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T, C : MutableCollection<in T>> Array<out T>.filterNotTo(destination: C, predicate: (T) -> Boolean): C
inline fun <C : MutableCollection<in Boolean>> BooleanArray.filterNotTo(destination: C, predicate: (Boolean) -> Boolean): C
inline fun <C : MutableCollection<in Byte>> ByteArray.filterNotTo(destination: C, predicate: (Byte) -> Boolean): C
inline fun <C : MutableCollection<in Char>> CharArray.filterNotTo(destination: C, predicate: (Char) -> Boolean): C
inline fun <C : MutableCollection<in Double>> DoubleArray.filterNotTo(destination: C, predicate: (Double) -> Boolean): C
inline fun <C : MutableCollection<in Float>> FloatArray.filterNotTo(destination: C, predicate: (Float) -> Boolean): C
inline fun <C : MutableCollection<in Int>> IntArray.filterNotTo(destination: C, predicate: (Int) -> Boolean): C
inline fun <C : MutableCollection<in Long>> LongArray.filterNotTo(destination: C, predicate: (Long) -> Boolean): C
inline fun <C : MutableCollection<in Short>> ShortArray.filterNotTo(destination: C, predicate: (Short) -> Boolean): C
inline fun <T, C : MutableCollection<in T>> Iterable<T>.filterNotTo(destination: C, predicate: (T) -> Boolean): C

Appends all elements not matching the given predicate to the given destination.

Since Kotlin 1.0
inline fun <K, V, M : MutableMap<in K, in V>> Map<out K, V>.filterNotTo(destination: M, predicate: (Map.Entry<K, V>) -> Boolean): M

Appends all entries not matching the given predicate into the given destination.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T, C : MutableCollection<in T>> Array<out T>.filterTo(destination: C, predicate: (T) -> Boolean): C
inline fun <C : MutableCollection<in Boolean>> BooleanArray.filterTo(destination: C, predicate: (Boolean) -> Boolean): C
inline fun <C : MutableCollection<in Byte>> ByteArray.filterTo(destination: C, predicate: (Byte) -> Boolean): C
inline fun <C : MutableCollection<in Char>> CharArray.filterTo(destination: C, predicate: (Char) -> Boolean): C
inline fun <C : MutableCollection<in Double>> DoubleArray.filterTo(destination: C, predicate: (Double) -> Boolean): C
inline fun <C : MutableCollection<in Float>> FloatArray.filterTo(destination: C, predicate: (Float) -> Boolean): C
inline fun <C : MutableCollection<in Int>> IntArray.filterTo(destination: C, predicate: (Int) -> Boolean): C
inline fun <C : MutableCollection<in Long>> LongArray.filterTo(destination: C, predicate: (Long) -> Boolean): C
inline fun <C : MutableCollection<in Short>> ShortArray.filterTo(destination: C, predicate: (Short) -> Boolean): C
inline fun <T, C : MutableCollection<in T>> Iterable<T>.filterTo(destination: C, predicate: (T) -> Boolean): C

Appends all elements matching the given predicate to the given destination.

Since Kotlin 1.0
inline fun <K, V, M : MutableMap<in K, in V>> Map<out K, V>.filterTo(destination: M, predicate: (Map.Entry<K, V>) -> Boolean): M

Appends all entries matching the given predicate into the mutable map given as destination parameter.

Since Kotlin 1.0
Link copied to clipboard
inline fun <K, V> Map<out K, V>.filterValues(predicate: (V) -> Boolean): Map<K, V>

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Array<out T>.find(predicate: (T) -> Boolean): T?
inline fun BooleanArray.find(predicate: (Boolean) -> Boolean): Boolean?
inline fun ByteArray.find(predicate: (Byte) -> Boolean): Byte?
inline fun CharArray.find(predicate: (Char) -> Boolean): Char?
inline fun DoubleArray.find(predicate: (Double) -> Boolean): Double?
inline fun FloatArray.find(predicate: (Float) -> Boolean): Float?
inline fun IntArray.find(predicate: (Int) -> Boolean): Int?
inline fun LongArray.find(predicate: (Long) -> Boolean): Long?
inline fun ShortArray.find(predicate: (Short) -> Boolean): Short?
inline fun <T> Iterable<T>.find(predicate: (T) -> Boolean): T?

Returns the first element matching the given predicate, or null if no such element was found.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Array<out T>.findLast(predicate: (T) -> Boolean): T?
inline fun BooleanArray.findLast(predicate: (Boolean) -> Boolean): Boolean?
inline fun ByteArray.findLast(predicate: (Byte) -> Boolean): Byte?
inline fun CharArray.findLast(predicate: (Char) -> Boolean): Char?
inline fun DoubleArray.findLast(predicate: (Double) -> Boolean): Double?
inline fun FloatArray.findLast(predicate: (Float) -> Boolean): Float?
inline fun IntArray.findLast(predicate: (Int) -> Boolean): Int?
inline fun LongArray.findLast(predicate: (Long) -> Boolean): Long?
inline fun ShortArray.findLast(predicate: (Short) -> Boolean): Short?
inline fun <T> Iterable<T>.findLast(predicate: (T) -> Boolean): T?
inline fun <T> List<T>.findLast(predicate: (T) -> Boolean): T?

Returns the last element matching the given predicate, or null if no such element was found.

Since Kotlin 1.0
Link copied to clipboard
fun <T> Array<out T>.first(): T
fun <T> Iterable<T>.first(): T
fun <T> List<T>.first(): T

Returns first element.

Since Kotlin 1.0
inline fun <T> Array<out T>.first(predicate: (T) -> Boolean): T
inline fun BooleanArray.first(predicate: (Boolean) -> Boolean): Boolean
inline fun ByteArray.first(predicate: (Byte) -> Boolean): Byte
inline fun CharArray.first(predicate: (Char) -> Boolean): Char
inline fun DoubleArray.first(predicate: (Double) -> Boolean): Double
inline fun FloatArray.first(predicate: (Float) -> Boolean): Float
inline fun IntArray.first(predicate: (Int) -> Boolean): Int
inline fun LongArray.first(predicate: (Long) -> Boolean): Long
inline fun ShortArray.first(predicate: (Short) -> Boolean): Short
inline fun <T> Iterable<T>.first(predicate: (T) -> Boolean): T

Returns the first element matching the given predicate.

Since Kotlin 1.0
Link copied to clipboard
fun <T> Array<out T>.firstOrNull(): T?

Returns the first element, or null if the array is empty.

Since Kotlin 1.0
fun <T> Iterable<T>.firstOrNull(): T?

Returns the first element, or null if the collection is empty.

Since Kotlin 1.0
fun <T> List<T>.firstOrNull(): T?

Returns the first element, or null if the list is empty.

Since Kotlin 1.0
inline fun <T> Array<out T>.firstOrNull(predicate: (T) -> Boolean): T?
inline fun BooleanArray.firstOrNull(predicate: (Boolean) -> Boolean): Boolean?
inline fun ByteArray.firstOrNull(predicate: (Byte) -> Boolean): Byte?
inline fun CharArray.firstOrNull(predicate: (Char) -> Boolean): Char?
inline fun DoubleArray.firstOrNull(predicate: (Double) -> Boolean): Double?
inline fun FloatArray.firstOrNull(predicate: (Float) -> Boolean): Float?
inline fun IntArray.firstOrNull(predicate: (Int) -> Boolean): Int?
inline fun LongArray.firstOrNull(predicate: (Long) -> Boolean): Long?
inline fun ShortArray.firstOrNull(predicate: (Short) -> Boolean): Short?
inline fun <T> Iterable<T>.firstOrNull(predicate: (T) -> Boolean): T?

Returns the first element matching the given predicate, or null if element was not found.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T, R> Array<out T>.flatMap(transform: (T) -> Iterable<R>): List<R>
inline fun <R> BooleanArray.flatMap(transform: (Boolean) -> Iterable<R>): List<R>
inline fun <R> ByteArray.flatMap(transform: (Byte) -> Iterable<R>): List<R>
inline fun <R> CharArray.flatMap(transform: (Char) -> Iterable<R>): List<R>
inline fun <R> DoubleArray.flatMap(transform: (Double) -> Iterable<R>): List<R>
inline fun <R> FloatArray.flatMap(transform: (Float) -> Iterable<R>): List<R>
inline fun <R> IntArray.flatMap(transform: (Int) -> Iterable<R>): List<R>
inline fun <R> LongArray.flatMap(transform: (Long) -> Iterable<R>): List<R>
inline fun <R> ShortArray.flatMap(transform: (Short) -> Iterable<R>): List<R>

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

Since Kotlin 1.0
inline fun <T, R> Iterable<T>.flatMap(transform: (T) -> 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.

Since Kotlin 1.0
inline fun <K, V, R> Map<out K, V>.flatMap(transform: (Map.Entry<K, V>) -> Iterable<R>): List<R>

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <T, R, C : MutableCollection<in R>> Array<out T>.flatMapTo(destination: C, transform: (T) -> Iterable<R>): C
inline fun <R, C : MutableCollection<in R>> BooleanArray.flatMapTo(destination: C, transform: (Boolean) -> Iterable<R>): C
inline fun <R, C : MutableCollection<in R>> ByteArray.flatMapTo(destination: C, transform: (Byte) -> Iterable<R>): C
inline fun <R, C : MutableCollection<in R>> CharArray.flatMapTo(destination: C, transform: (Char) -> Iterable<R>): C
inline fun <R, C : MutableCollection<in R>> DoubleArray.flatMapTo(destination: C, transform: (Double) -> Iterable<R>): C
inline fun <R, C : MutableCollection<in R>> FloatArray.flatMapTo(destination: C, transform: (Float) -> Iterable<R>): C
inline fun <R, C : MutableCollection<in R>> IntArray.flatMapTo(destination: C, transform: (Int) -> Iterable<R>): C
inline fun <R, C : MutableCollection<in R>> LongArray.flatMapTo(destination: C, transform: (Long) -> Iterable<R>): C
inline fun <R, C : MutableCollection<in R>> ShortArray.flatMapTo(destination: C, transform: (Short) -> Iterable<R>): C

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

Since Kotlin 1.0
inline fun <T, R, C : MutableCollection<in R>> Iterable<T>.flatMapTo(destination: C, transform: (T) -> Iterable<R>): C

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

Since Kotlin 1.0
inline fun <K, V, R, C : MutableCollection<in R>> Map<out K, V>.flatMapTo(destination: C, transform: (Map.Entry<K, V>) -> Iterable<R>): C

Appends all elements yielded from results of transform function being invoked on each entry of original map, to the given destination.

Since Kotlin 1.0
Link copied to clipboard
fun <T> Array<out Array<out T>>.flatten(): List<T>

Returns a single list of all elements from all arrays in the given array.

Since Kotlin 1.0

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <T, R> Array<out T>.fold(initial: R, operation: (acc: R, T) -> R): R
inline fun <R> BooleanArray.fold(initial: R, operation: (acc: R, Boolean) -> R): R
inline fun <R> ByteArray.fold(initial: R, operation: (acc: R, Byte) -> R): R
inline fun <R> CharArray.fold(initial: R, operation: (acc: R, Char) -> R): R
inline fun <R> DoubleArray.fold(initial: R, operation: (acc: R, Double) -> R): R
inline fun <R> FloatArray.fold(initial: R, operation: (acc: R, Float) -> R): R
inline fun <R> IntArray.fold(initial: R, operation: (acc: R, Int) -> R): R
inline fun <R> LongArray.fold(initial: R, operation: (acc: R, Long) -> R): R
inline fun <R> ShortArray.fold(initial: R, operation: (acc: R, Short) -> R): R
inline fun <T, R> Iterable<T>.fold(initial: R, operation: (acc: R, T) -> R): R

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <T, R> Array<out T>.foldIndexed(initial: R, operation: (index: Int, acc: R, T) -> R): R
inline fun <R> BooleanArray.foldIndexed(initial: R, operation: (index: Int, acc: R, Boolean) -> R): R
inline fun <R> ByteArray.foldIndexed(initial: R, operation: (index: Int, acc: R, Byte) -> R): R
inline fun <R> CharArray.foldIndexed(initial: R, operation: (index: Int, acc: R, Char) -> R): R
inline fun <R> DoubleArray.foldIndexed(initial: R, operation: (index: Int, acc: R, Double) -> R): R
inline fun <R> FloatArray.foldIndexed(initial: R, operation: (index: Int, acc: R, Float) -> R): R
inline fun <R> IntArray.foldIndexed(initial: R, operation: (index: Int, acc: R, Int) -> R): R
inline fun <R> LongArray.foldIndexed(initial: R, operation: (index: Int, acc: R, Long) -> R): R
inline fun <R> ShortArray.foldIndexed(initial: R, operation: (index: Int, acc: R, Short) -> 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 array.

Since Kotlin 1.0
inline fun <T, R> Iterable<T>.foldIndexed(initial: R, operation: (index: Int, acc: R, T) -> 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.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T, R> Array<out T>.foldRight(initial: R, operation: (T, acc: R) -> R): R
inline fun <R> BooleanArray.foldRight(initial: R, operation: (Boolean, acc: R) -> R): R
inline fun <R> ByteArray.foldRight(initial: R, operation: (Byte, acc: R) -> R): R
inline fun <R> CharArray.foldRight(initial: R, operation: (Char, acc: R) -> R): R
inline fun <R> DoubleArray.foldRight(initial: R, operation: (Double, acc: R) -> R): R
inline fun <R> FloatArray.foldRight(initial: R, operation: (Float, acc: R) -> R): R
inline fun <R> IntArray.foldRight(initial: R, operation: (Int, acc: R) -> R): R
inline fun <R> LongArray.foldRight(initial: R, operation: (Long, acc: R) -> R): R
inline fun <R> ShortArray.foldRight(initial: R, operation: (Short, acc: R) -> R): R
inline fun <T, R> List<T>.foldRight(initial: R, operation: (T, acc: R) -> R): R

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <T, R> Array<out T>.foldRightIndexed(initial: R, operation: (index: Int, T, acc: R) -> R): R
inline fun <R> BooleanArray.foldRightIndexed(initial: R, operation: (index: Int, Boolean, acc: R) -> R): R
inline fun <R> ByteArray.foldRightIndexed(initial: R, operation: (index: Int, Byte, acc: R) -> R): R
inline fun <R> CharArray.foldRightIndexed(initial: R, operation: (index: Int, Char, acc: R) -> R): R
inline fun <R> DoubleArray.foldRightIndexed(initial: R, operation: (index: Int, Double, acc: R) -> R): R
inline fun <R> FloatArray.foldRightIndexed(initial: R, operation: (index: Int, Float, acc: R) -> R): R
inline fun <R> IntArray.foldRightIndexed(initial: R, operation: (index: Int, Int, acc: R) -> R): R
inline fun <R> LongArray.foldRightIndexed(initial: R, operation: (index: Int, Long, acc: R) -> R): R
inline fun <R> ShortArray.foldRightIndexed(initial: R, operation: (index: Int, Short, 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 array and current accumulator value.

Since Kotlin 1.0
inline fun <T, R> List<T>.foldRightIndexed(initial: R, operation: (index: Int, T, 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.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Array<out T>.forEach(action: (T) -> Unit)
inline fun BooleanArray.forEach(action: (Boolean) -> Unit)
inline fun ByteArray.forEach(action: (Byte) -> Unit)
inline fun CharArray.forEach(action: (Char) -> Unit)
inline fun DoubleArray.forEach(action: (Double) -> Unit)
inline fun FloatArray.forEach(action: (Float) -> Unit)
inline fun IntArray.forEach(action: (Int) -> Unit)
inline fun LongArray.forEach(action: (Long) -> Unit)
inline fun ShortArray.forEach(action: (Short) -> Unit)
inline fun <T> Iterable<T>.forEach(action: (T) -> Unit)

Performs the given action on each element.

Since Kotlin 1.0
inline fun <T> Iterator<T>.forEach(operation: (T) -> Unit)

Performs the given operation on each element of this Iterator.

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

Performs the given action on each entry.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Array<out T>.forEachIndexed(action: (index: Int, T) -> Unit)
inline fun BooleanArray.forEachIndexed(action: (index: Int, Boolean) -> Unit)
inline fun ByteArray.forEachIndexed(action: (index: Int, Byte) -> Unit)
inline fun CharArray.forEachIndexed(action: (index: Int, Char) -> Unit)
inline fun DoubleArray.forEachIndexed(action: (index: Int, Double) -> Unit)
inline fun FloatArray.forEachIndexed(action: (index: Int, Float) -> Unit)
inline fun IntArray.forEachIndexed(action: (index: Int, Int) -> Unit)
inline fun LongArray.forEachIndexed(action: (index: Int, Long) -> Unit)
inline fun ShortArray.forEachIndexed(action: (index: Int, Short) -> Unit)
inline fun <T> Iterable<T>.forEachIndexed(action: (index: Int, T) -> Unit)

Performs the given action on each element, providing sequential index with the element.

Since Kotlin 1.0
Link copied to clipboard
inline operator fun <K, V> Map<out K, V>.get(key: K): V?

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Array<out T>.getOrElse(index: Int, defaultValue: (Int) -> T): T
inline fun BooleanArray.getOrElse(index: Int, defaultValue: (Int) -> Boolean): Boolean
inline fun ByteArray.getOrElse(index: Int, defaultValue: (Int) -> Byte): Byte
inline fun CharArray.getOrElse(index: Int, defaultValue: (Int) -> Char): Char
inline fun DoubleArray.getOrElse(index: Int, defaultValue: (Int) -> Double): Double
inline fun FloatArray.getOrElse(index: Int, defaultValue: (Int) -> Float): Float
inline fun IntArray.getOrElse(index: Int, defaultValue: (Int) -> Int): Int
inline fun LongArray.getOrElse(index: Int, defaultValue: (Int) -> Long): Long
inline fun ShortArray.getOrElse(index: Int, defaultValue: (Int) -> Short): Short

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.

Since Kotlin 1.0
inline fun <T> List<T>.getOrElse(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.

Since Kotlin 1.0
inline fun <K, V> Map<K, V>.getOrElse(key: K, defaultValue: () -> V): V

Returns the value for the given key, or the result of the defaultValue function if there was no entry for the given key.

Since Kotlin 1.0
Link copied to clipboard
fun <T> Array<out T>.getOrNull(index: Int): T?
fun ByteArray.getOrNull(index: Int): Byte?
fun CharArray.getOrNull(index: Int): Char?
fun IntArray.getOrNull(index: Int): Int?
fun LongArray.getOrNull(index: Int): Long?

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

Since Kotlin 1.0
fun <T> List<T>.getOrNull(index: Int): T?

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <K, V> ConcurrentMap<K, V>.getOrPut(key: K, defaultValue: () -> V): V

Concurrent getOrPut, that is safe for concurrent maps.

Since Kotlin 1.0
inline fun <K, V> MutableMap<K, V>.getOrPut(key: K, defaultValue: () -> V): V

Returns the value for the given key. If the key is not found in the map, calls the defaultValue function, puts its result into the map under the given key and returns it.

Since Kotlin 1.0
Link copied to clipboard
inline 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 read-only map.

Since Kotlin 1.0
@JvmName(name = "getVar")
inline operator fun <V, V1 : V> MutableMap<in String, out V>.getValue(thisRef: Any?, property: KProperty<*>): V1

Returns the value of the property for the given object from this mutable map.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T, K> Array<out T>.groupBy(keySelector: (T) -> K): Map<K, List<T>>
inline fun <K> BooleanArray.groupBy(keySelector: (Boolean) -> K): Map<K, List<Boolean>>
inline fun <K> ByteArray.groupBy(keySelector: (Byte) -> K): Map<K, List<Byte>>
inline fun <K> CharArray.groupBy(keySelector: (Char) -> K): Map<K, List<Char>>
inline fun <K> DoubleArray.groupBy(keySelector: (Double) -> K): Map<K, List<Double>>
inline fun <K> FloatArray.groupBy(keySelector: (Float) -> K): Map<K, List<Float>>
inline fun <K> IntArray.groupBy(keySelector: (Int) -> K): Map<K, List<Int>>
inline fun <K> LongArray.groupBy(keySelector: (Long) -> K): Map<K, List<Long>>
inline fun <K> ShortArray.groupBy(keySelector: (Short) -> K): Map<K, List<Short>>

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.

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

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.

Since Kotlin 1.0
inline fun <T, K, V> Array<out T>.groupBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map<K, List<V>>
inline fun <K, V> BooleanArray.groupBy(keySelector: (Boolean) -> K, valueTransform: (Boolean) -> V): Map<K, List<V>>
inline fun <K, V> ByteArray.groupBy(keySelector: (Byte) -> K, valueTransform: (Byte) -> V): Map<K, List<V>>
inline fun <K, V> CharArray.groupBy(keySelector: (Char) -> K, valueTransform: (Char) -> V): Map<K, List<V>>
inline fun <K, V> DoubleArray.groupBy(keySelector: (Double) -> K, valueTransform: (Double) -> V): Map<K, List<V>>
inline fun <K, V> FloatArray.groupBy(keySelector: (Float) -> K, valueTransform: (Float) -> V): Map<K, List<V>>
inline fun <K, V> IntArray.groupBy(keySelector: (Int) -> K, valueTransform: (Int) -> V): Map<K, List<V>>
inline fun <K, V> LongArray.groupBy(keySelector: (Long) -> K, valueTransform: (Long) -> V): Map<K, List<V>>
inline fun <K, V> ShortArray.groupBy(keySelector: (Short) -> K, valueTransform: (Short) -> V): Map<K, List<V>>

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.

Since Kotlin 1.0
inline fun <T, K, V> Iterable<T>.groupBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map<K, List<V>>

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.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T, K, M : MutableMap<in K, MutableList<T>>> Array<out T>.groupByTo(destination: M, keySelector: (T) -> K): M
inline fun <K, M : MutableMap<in K, MutableList<Boolean>>> BooleanArray.groupByTo(destination: M, keySelector: (Boolean) -> K): M
inline fun <K, M : MutableMap<in K, MutableList<Byte>>> ByteArray.groupByTo(destination: M, keySelector: (Byte) -> K): M
inline fun <K, M : MutableMap<in K, MutableList<Char>>> CharArray.groupByTo(destination: M, keySelector: (Char) -> K): M
inline fun <K, M : MutableMap<in K, MutableList<Double>>> DoubleArray.groupByTo(destination: M, keySelector: (Double) -> K): M
inline fun <K, M : MutableMap<in K, MutableList<Float>>> FloatArray.groupByTo(destination: M, keySelector: (Float) -> K): M
inline fun <K, M : MutableMap<in K, MutableList<Int>>> IntArray.groupByTo(destination: M, keySelector: (Int) -> K): M
inline fun <K, M : MutableMap<in K, MutableList<Long>>> LongArray.groupByTo(destination: M, keySelector: (Long) -> K): M
inline fun <K, M : MutableMap<in K, MutableList<Short>>> ShortArray.groupByTo(destination: M, keySelector: (Short) -> K): M

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.

Since Kotlin 1.0
inline fun <T, K, M : MutableMap<in K, MutableList<T>>> Iterable<T>.groupByTo(destination: M, keySelector: (T) -> K): 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.

Since Kotlin 1.0
inline fun <T, K, V, M : MutableMap<in K, MutableList<V>>> Array<out T>.groupByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): M
inline fun <K, V, M : MutableMap<in K, MutableList<V>>> BooleanArray.groupByTo(destination: M, keySelector: (Boolean) -> K, valueTransform: (Boolean) -> V): M
inline fun <K, V, M : MutableMap<in K, MutableList<V>>> ByteArray.groupByTo(destination: M, keySelector: (Byte) -> K, valueTransform: (Byte) -> V): M
inline fun <K, V, M : MutableMap<in K, MutableList<V>>> CharArray.groupByTo(destination: M, keySelector: (Char) -> K, valueTransform: (Char) -> V): M
inline fun <K, V, M : MutableMap<in K, MutableList<V>>> DoubleArray.groupByTo(destination: M, keySelector: (Double) -> K, valueTransform: (Double) -> V): M
inline fun <K, V, M : MutableMap<in K, MutableList<V>>> FloatArray.groupByTo(destination: M, keySelector: (Float) -> K, valueTransform: (Float) -> V): M
inline fun <K, V, M : MutableMap<in K, MutableList<V>>> IntArray.groupByTo(destination: M, keySelector: (Int) -> K, valueTransform: (Int) -> V): M
inline fun <K, V, M : MutableMap<in K, MutableList<V>>> LongArray.groupByTo(destination: M, keySelector: (Long) -> K, valueTransform: (Long) -> V): M
inline fun <K, V, M : MutableMap<in K, MutableList<V>>> ShortArray.groupByTo(destination: M, keySelector: (Short) -> K, valueTransform: (Short) -> V): 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.

Since Kotlin 1.0
inline fun <T, K, V, M : MutableMap<in K, MutableList<V>>> Iterable<T>.groupByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): 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.

Since Kotlin 1.0
Link copied to clipboard
fun <K, V> hashMapOf(vararg pairs: Pair<K, V>): 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.

Since Kotlin 1.0
Link copied to clipboard
fun <T> hashSetOf(vararg elements: T): HashSet<T>

Returns a new HashSet with the given elements.

Since Kotlin 1.0
Link copied to clipboard
fun <T> Array<out T>.indexOf(element: T): Int
fun ByteArray.indexOf(element: Byte): Int
fun CharArray.indexOf(element: Char): Int
fun DoubleArray.indexOf(element: Double): Int
fun FloatArray.indexOf(element: Float): Int
fun IntArray.indexOf(element: Int): Int
fun LongArray.indexOf(element: Long): Int
fun ShortArray.indexOf(element: Short): Int

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

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

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

Since Kotlin 1.0
fun <T> List<T>.indexOf(element: T): Int

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Array<out T>.indexOfFirst(predicate: (T) -> Boolean): Int
inline fun BooleanArray.indexOfFirst(predicate: (Boolean) -> Boolean): Int
inline fun ByteArray.indexOfFirst(predicate: (Byte) -> Boolean): Int
inline fun CharArray.indexOfFirst(predicate: (Char) -> Boolean): Int
inline fun DoubleArray.indexOfFirst(predicate: (Double) -> Boolean): Int
inline fun FloatArray.indexOfFirst(predicate: (Float) -> Boolean): Int
inline fun IntArray.indexOfFirst(predicate: (Int) -> Boolean): Int
inline fun LongArray.indexOfFirst(predicate: (Long) -> Boolean): Int
inline fun ShortArray.indexOfFirst(predicate: (Short) -> Boolean): Int

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

Since Kotlin 1.0
inline fun <T> Iterable<T>.indexOfFirst(predicate: (T) -> Boolean): Int

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

Since Kotlin 1.0
inline fun <T> List<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.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Array<out T>.indexOfLast(predicate: (T) -> Boolean): Int
inline fun BooleanArray.indexOfLast(predicate: (Boolean) -> Boolean): Int
inline fun ByteArray.indexOfLast(predicate: (Byte) -> Boolean): Int
inline fun CharArray.indexOfLast(predicate: (Char) -> Boolean): Int
inline fun DoubleArray.indexOfLast(predicate: (Double) -> Boolean): Int
inline fun FloatArray.indexOfLast(predicate: (Float) -> Boolean): Int
inline fun IntArray.indexOfLast(predicate: (Int) -> Boolean): Int
inline fun LongArray.indexOfLast(predicate: (Long) -> Boolean): Int
inline fun ShortArray.indexOfLast(predicate: (Short) -> Boolean): Int

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

Since Kotlin 1.0
inline fun <T> Iterable<T>.indexOfLast(predicate: (T) -> Boolean): Int

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

Since Kotlin 1.0
inline fun <T> List<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.

Since Kotlin 1.0
Link copied to clipboard
infix fun <T> Array<out T>.intersect(other: Iterable<T>): Set<T>
infix fun ByteArray.intersect(other: Iterable<Byte>): Set<Byte>
infix fun CharArray.intersect(other: Iterable<Char>): Set<Char>
infix fun IntArray.intersect(other: Iterable<Int>): Set<Int>
infix fun LongArray.intersect(other: Iterable<Long>): Set<Long>

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

Since Kotlin 1.0
infix fun <T> Iterable<T>.intersect(other: Iterable<T>): Set<T>

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

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Array<out T>.isEmpty(): Boolean
inline fun ByteArray.isEmpty(): Boolean
inline fun CharArray.isEmpty(): Boolean
inline fun FloatArray.isEmpty(): Boolean
inline fun IntArray.isEmpty(): Boolean
inline fun LongArray.isEmpty(): Boolean
inline fun ShortArray.isEmpty(): Boolean

Returns true if the array is empty.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Array<out T>.isNotEmpty(): Boolean

Returns true if the array is not empty.

Since Kotlin 1.0
inline fun <T> Collection<T>.isNotEmpty(): Boolean

Returns true if the collection is not empty.

Since Kotlin 1.0
inline fun <K, V> Map<out K, V>.isNotEmpty(): Boolean

Returns true if this map is not empty.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Iterable(crossinline iterator: () -> Iterator<T>): Iterable<T>

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

Since Kotlin 1.0
Link copied to clipboard
operator fun <T> Enumeration<T>.iterator(): Iterator<T>

Creates an Iterator for an java.util.Enumeration, allowing to use it in for loops.

Since Kotlin 1.0
inline operator fun <T> Iterator<T>.iterator(): Iterator<T>

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

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

Returns an Iterator over the entries in the Map.

Since Kotlin 1.0
@JvmName(name = "mutableIterator")
inline operator fun <K, V> MutableMap<K, V>.iterator(): MutableIterator<MutableMap.MutableEntry<K, V>>

Returns a MutableIterator over the mutable entries in the MutableMap.

Since Kotlin 1.0
Link copied to clipboard
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> BooleanArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: (Boolean) -> 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> CharArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: (Char) -> 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> FloatArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: (Float) -> 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> ShortArray.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: (Short) -> 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

Appends the string from all the elements separated using separator and using the given prefix and postfix if supplied.

Since Kotlin 1.0
Link copied to clipboard
fun <T> Array<out T>.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: (T) -> CharSequence? = null): String
fun BooleanArray.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: (Boolean) -> CharSequence? = null): String
fun ByteArray.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: (Byte) -> CharSequence? = null): String
fun CharArray.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: (Char) -> CharSequence? = null): String
fun DoubleArray.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: (Double) -> CharSequence? = null): String
fun FloatArray.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: (Float) -> 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 ShortArray.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: (Short) -> CharSequence? = null): String
fun <T> Iterable<T>.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: (T) -> CharSequence? = null): String

Creates a string from all the elements separated using separator and using the given prefix and postfix if supplied.

Since Kotlin 1.0
Link copied to clipboard
fun <T> Array<out T>.last(): T
fun <T> Iterable<T>.last(): T
fun <T> List<T>.last(): T

Returns the last element.

Since Kotlin 1.0
inline fun <T> Array<out T>.last(predicate: (T) -> Boolean): T
inline fun BooleanArray.last(predicate: (Boolean) -> Boolean): Boolean
inline fun ByteArray.last(predicate: (Byte) -> Boolean): Byte
inline fun CharArray.last(predicate: (Char) -> Boolean): Char
inline fun DoubleArray.last(predicate: (Double) -> Boolean): Double
inline fun FloatArray.last(predicate: (Float) -> Boolean): Float
inline fun IntArray.last(predicate: (Int) -> Boolean): Int
inline fun LongArray.last(predicate: (Long) -> Boolean): Long
inline fun ShortArray.last(predicate: (Short) -> Boolean): Short
inline fun <T> Iterable<T>.last(predicate: (T) -> Boolean): T
inline fun <T> List<T>.last(predicate: (T) -> Boolean): T

Returns the last element matching the given predicate.

Since Kotlin 1.0
Link copied to clipboard
fun <T> Array<out T>.lastIndexOf(element: T): Int
fun ByteArray.lastIndexOf(element: Byte): Int
fun CharArray.lastIndexOf(element: Char): Int
fun IntArray.lastIndexOf(element: Int): Int
fun LongArray.lastIndexOf(element: Long): Int

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

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

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

Since Kotlin 1.0
fun <T> List<T>.lastIndexOf(element: T): Int

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

Since Kotlin 1.0
Link copied to clipboard
fun <T> Array<out T>.lastOrNull(): T?

Returns the last element, or null if the array is empty.

Since Kotlin 1.0
fun <T> Iterable<T>.lastOrNull(): T?

Returns the last element, or null if the collection is empty.

Since Kotlin 1.0
fun <T> List<T>.lastOrNull(): T?

Returns the last element, or null if the list is empty.

Since Kotlin 1.0
inline fun <T> Array<out T>.lastOrNull(predicate: (T) -> Boolean): T?
inline fun BooleanArray.lastOrNull(predicate: (Boolean) -> Boolean): Boolean?
inline fun ByteArray.lastOrNull(predicate: (Byte) -> Boolean): Byte?
inline fun CharArray.lastOrNull(predicate: (Char) -> Boolean): Char?
inline fun DoubleArray.lastOrNull(predicate: (Double) -> Boolean): Double?
inline fun FloatArray.lastOrNull(predicate: (Float) -> Boolean): Float?
inline fun IntArray.lastOrNull(predicate: (Int) -> Boolean): Int?
inline fun LongArray.lastOrNull(predicate: (Long) -> Boolean): Long?
inline fun ShortArray.lastOrNull(predicate: (Short) -> Boolean): Short?
inline fun <T> Iterable<T>.lastOrNull(predicate: (T) -> Boolean): T?
inline fun <T> List<T>.lastOrNull(predicate: (T) -> Boolean): T?

Returns the last element matching the given predicate, or null if no such element was found.

Since Kotlin 1.0
Link copied to clipboard
fun <K, V> linkedMapOf(vararg pairs: Pair<K, V>): 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.

Since Kotlin 1.0
Link copied to clipboard
fun <T> linkedSetOf(vararg elements: T): LinkedHashSet<T>

Returns a new LinkedHashSet with the given elements. Elements of the set are iterated in the order they were specified.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> listOf(): List<T>

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

Since Kotlin 1.0
fun <T> listOf(element: T): List<T>

Returns an immutable list containing only the specified object element. The returned list is serializable.

Since Kotlin 1.0
fun <T> listOf(vararg elements: T): List<T>

Returns a new read-only list of given elements. The returned list is serializable (JVM).

Since Kotlin 1.0