A study note based on Kotlin Collections Document.
Kotlin provides collection types of
Map. There are a read-only and a mutable interface. Read-only collection types are covariant.
Set are subclasses of
setOf to create immutable list and set. Use
mutableSetOf to create mutable list and set. The default implementation of
LinkedHashSet that preserves the order of elements insertion.
Map<K, V> is not a subclass of
mutableMapOf to create immutable and mutable set. The default implementation
LinkedHashMap keeps the order of elements insertion.
You can use concerte type such as
LinkedList to create a collection instance.
To create a copy or convert to a different type, use
Iterable and is eager.
Sequence is lazy.
generateSequence to create a sequence from a function. Use
sequence to create a sequence in chunks.
- Plus and Minus:
groupBy, a group support
- Others: search, ordering, aggregate