Collections is nothing but a backpack, guess what are the things you can store in a backpack.
Probably you must have guessed everything that we can store in backpack, but let list few of them : 1. Laptop, Mouse, HeadPhones, earPhones, Mouse (computer's and animal too), Book, Notepad, pen, pencil you can write so on.
Almost you can store everything, you cannot store elephant though.
Within the backpack's size you can store all the things.
Lets' discuss about kotlin Collection : Collection is a framework which manipulates only one data type, which is god data type of Kotlin.
I mean data type of
Collections in kotlin is a framework that provides an architecture to store and manipulate the group of objects Collections in Kotlin is a framework that provides an architecture to store and manipulate the group of objects
I am not going to discuss everything present in collection, but only collection that we use frequently and which are :
Kotlin does not have collections of its own, Kotlin depends solely on Java Collections Library.
Every collections in kotlin is instance of Java collection, Kotlin Collection provide few more extension methods to existing method in java.
Kotlin Provide more methods to perform operation more efficiently more than Java. I do not expect you to understand java to learn this collection, so do not worry if you do not know java.
More over you do not have to convert the Java to kotlin to use the collections, this makes easier an remove the overhead
Kotlin Enhances the Java Collections by distinguishing the read-only(mutable) and mutable collections
Mutable collections can be add, remove, update the values of an element/item in same collection and it will not create the new collections.
Immutable collections also provides same operation as Mutable Collections but immutable collections produces new collection when you make a change.
You can find all the collections in the kotlin.collections package.
This article is written by Pavan, who is serving notice period in an MNC, Bangalore. He thought, let the articles speak rather than his image. He is also the same person who created the reporter for Protractor Jasmine