kt library

Classes

KtCollection<T>
A generic collection of elements. Methods in this interface support only read-only access to the collection; read/write access is supported through the KtMutableCollection interface. @param E the type of elements contained in the collection. The collection is covariant on its element type.
KtHashMap<K, V>
KtHashSet<T>
KtIterable<T>
Classes that inherit from this interface can be represented as a sequence of elements that can be iterated over. @param T the type of element being iterated over. The iterator is covariant on its element type.
KtIterator<T>
An iterator over a collection or another entity that can be represented as a sequence of elements. Allows to sequentially access the elements.
KtLinkedMap<K, V>
KtLinkedSet<T>
KtList<T>
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 KtMutableList interface. @param T the type of elements contained in the list. The list is covariant on its element type.
KtListIterator<T>
An iterator over a collection that supports indexed access.
KtMap<K, 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 KtMutableMap interface. @param K the type of map keys. The map is invariant on its key type, as it can accept key as a parameter (of containsKey for example) and return it in keys set. @param V the type of map values. The map is covariant on its value type.
KtMapEntry<K, V>
Represents a key/value pair held by a KtMap.
KtMutableCollection<T>
A generic collection of elements that supports adding and removing elements.
KtMutableIterable<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. @param T the type of element being iterated over. The mutable iterator is invariant on its element type.
KtMutableIterator<T>
An iterator over a mutable collection. Provides the ability to remove elements while iterating. @see MutableCollection.iterator
KtMutableList<T>
A generic ordered collection of elements that supports adding and removing elements. @param E the type of elements contained in the list. The mutable list is invariant on its element type.
KtMutableListIterator<T>
An iterator over a mutable collection that supports indexed access. Provides the ability to add, modify and remove elements while iterating.
KtMutableMap<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. @param K the type of map keys. The map is invariant on its key type. @param V the type of map values. The mutable map is invariant on its value type.
KtMutableMapEntry<K, V>
Represents a key/value pair held by a KtMutableMap.
KtMutableSet<T>
A generic unordered collection of elements that does not support duplicate elements, and supports adding and removing elements. @param T the type of elements contained in the set. The mutable set is invariant on its element type.
KtPair<A, B>
Represents a generic pair of two values.
KtSet<T>
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 KtMutableSet interface. @param E the type of elements contained in the set. The set is covariant on its element type.
KtTriple<A, B, C>
Represents a triad of values
TooGeneric
A method annotated with @tooGeneric is a indicator that the method is defined for a generic type T but only works for type X where X extends T.

Constants

nonNull → const Object
An element annotated with @notNull claims null value is forbidden to return (for methods), pass to (parameters) and hold (local variables and fields).
nullable → const Object
An element annotated with @nullable claims null value is perfectly valid to return (for methods), pass to (parameters) and hold (local variables and fields).
tooGeneric → const Object
A method annotated with @tooGeneric is a indicator that the method is defined for a generic type T but only works for type X where X extends T.

Properties

hashSetOf KtHashSet<T> Function<T>([T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6, T arg7, T arg8, T arg9])
Returns a new KtMutableSet based on HashSet with the given elements. Elements of the set are iterated in unpredictable order.
getter/setter pair
linkedSetOf KtLinkedSet<T> Function<T>([T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6, T arg7, T arg8, T arg9])
Returns a new KtMutableSet based on LinkedHashSet with the given elements. Elements of the set are iterated in the order they were specified.
getter/setter pair
listOf KtList<T> Function<T>([T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6, T arg7, T arg8, T arg9])
Returns a new read-only list of given elements.
getter/setter pair
mutableListOf KtMutableList<T> Function<T>([T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6, T arg7, T arg8, T arg9])
Returns a new mutable list of given elements.
getter/setter pair
mutableSetOf KtMutableSet<T> Function<T>([T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6, T arg7, T arg8, T arg9])
Returns a new KtMutableSet based on LinkedHashSet with the given elements. Elements of the set are iterated in the order they were specified.
getter/setter pair
setOf KtSet<T> Function<T>([T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6, T arg7, T arg8, T arg9])
Returns a new read-only set with the given elements. Elements of the set are iterated in the order they were specified.
getter/setter pair

Functions

compareBy<T>(Comparable selector(T)) Comparator<T>
Creates a comparator using the function to transform value to a Comparable instance for comparison.
compareByDescending<T>(Comparable selector(T)) Comparator<T>
Creates a descending comparator using the function to transform value to a Comparable instance for comparison.
emptyList<T>() KtList<T>
Returns an empty read-only list.
emptyMap<K, V>() KtMap<K, V>
Returns an empty read-only map of specified type.
emptySet<T>() KtSet<T>
Returns an empty read-only set.
hashMapFrom<K, V>([Map<K, V> map = const {}]) KtHashMap<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.
hashSetFrom<T>([Iterable<T> elements = const []]) KtMutableSet<T>
Returns a new HashSet based on elements. Elements of the set are iterated in unpredictable order.
linkedMapFrom<K, V>([Map<K, V> map = const {}]) KtLinkedMap<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.
linkedSetFrom<T>([Iterable<T> elements = const []]) KtLinkedSet<T>
Returns a new LinkedHashSet based on elements. Elements of the set are iterated in the order they were specified.
listFrom<T>([Iterable<T> elements = const []]) KtList<T>
Returns a new read-only list based on elements.
mapFrom<K, V>([Map<K, V> map = const {}]) KtMap<K, V>
Returns an immutable map, mapping only the specified key to the specified value.
mutableListFrom<T>([Iterable<T> elements = const []]) KtMutableList<T>
Returns a new mutable list based on elements.
mutableMapFrom<K, V>([Map<K, V> map = const {}]) KtMutableMap<K, V>
Returns a new KtMutableMap with the specified contents, given as a list of pairs where the first component is the key and the second is the value.
mutableSetFrom<T>([Iterable<T> elements = const []]) KtMutableSet<T>
Returns a new LinkedHashSet based on elements. Elements of the set are iterated in the order they were specified.
naturalOrder<T>() Comparator<T>
Returns a comparator that compares Comparable objects in natural order.
repeat(int times, void action(int)) → void
Executes the given function action specified number of times.
reverse<T>(Comparator<T> comparator) Comparator<T>
Returns a comparator that imposes the reverse ordering of this comparator.
reverseOrder<T>() Comparator<T>
Returns a comparator that compares Comparable objects in reversed natural order.
setFrom<T>([Iterable<T> elements = const []]) KtSet<T>
Returns a new read-only set based on elements. Elements of the set are iterated in the order they were specified.
TODO([String? reason]) → Never
Always throws NotImplementedException stating that operation is not implemented.

Exceptions / Errors

IndexOutOfBoundsException
NoSuchElementException
NotImplementedException
An exception is thrown to indicate that a method body remains to be implemented.