Collections in Kotlin

This post was originally posted at and reposted on Medium on 28th April 2021.

Types of Collection in Kotlin

  1. Immutable
    The one which can’t be modified once the object is created. We can just iterate over them or create a copy of them but we can’t modify the actual one.
  2. Mutable
    These can be modified means that we can add items or elements to the original object once they are created along with iteration and copy.


* 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.
public interface Iterable<out T> {
* Returns an iterator over the elements of this object.
public operator fun iterator(): Iterator<T>

Please continue reading at



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store