kt_collection library

Classes

KCollectionExtension<T>
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.
KtIterableExtension<T>
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.
KtListExtension<T>
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.
KtMapExtension<K, V>
KtMutableCollection<T>
A generic collection of elements that supports adding and removing elements. [...]
KtMutableCollectionExtension<T>
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.
KtMutableIterableExtension<T>
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.
KtMutableListExtension<T>
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.
KtMutableMapExtension<K, V>
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). [...]
const _NonNull()
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). [...]
const _Nullable()
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. [...]
const TooGeneric()

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

Exceptions / Errors

IndexOutOfBoundsException
NoSuchElementException