Collections and Data Operations in Kotlin

In the previous chapters, we have covered a wide range of topics, starting from data types, classes, and objects in Kotlin and moving on to immutability, functions, delegates, and coroutines in the last chapter. In this chapter, we are going to discuss the collections framework and data operations in Kotlin. Kotlin inherits collections framework from Java, but has significant changes from it in favor of functional programming.

The collections framework that Kotlin provides is more functional than Java and, as the signature of Kotlin, it is easier to use and understand.

We will start this chapter with the fundamentals of collections and gradually move on to data operations that collections support in Kotlin. The following is the list of topics that we are going to cover in this chapter:

  • An introduction to collections
  • The Iterator and Iterable interfaces
  • Collection types in Kotlin—Array, List, Map, and Set
  • Mutability and immutability
  • Working with lists
  • Various data operations—map, sort, filter, flatMap, partition, fold, and group by

So, what are we waiting for? Let's get started with collections.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.45.80