Kotlin Collections inside. Part 1.

Everyday during Java/Android development we use collection for different purposes: modifying data collections, displaying an UI with a list of items as well as business logic related processes. Java collections are quite straightforward and easy component for simple use cases. At the same time we have a lot of different collection interfaces implementations. t’s the developer’s task to choose the right implementation for the given purpose. Of course you still have Java to Kotlin compatibility, so all Java collections are available for Kotlin applications as well. Lets check what actually Kotlin collections are. Let me show you a general scheme of Kotlin collection framework.

As you can see that is where immutability principle was implemented, that means that you can not perform modifications on collections. The first interface in collections hierarchy is Iterable. It provides the Iterator that gives you possibility to iterate your collection. MutableIterable extends Iterable, it provides MutableIterator for mutable collections.

Read full story on the Runtastic blog

Android Developer, Tech geek