![]() ![]() ![]() Val a_list = listOf(“Kotlin”, “Programing”, “Language”) The read-only list (immutable) can be created by using the listOf() method as shown below: The section below shows how to initialize and perform operations in mutable and immutable lists. The methods for changing a list e.g add, removeAt, replaceAll, etc.The List provides operations like size, get, etc.Just like Java, it inherits from the Collection.If you require to update or add new elements in a list then Kotlin provides MutableList class. you cannot add or update the elements in the original list. The other two collections are Set and Map. Kotlin has three Collections while List is one of those. A list is a generic collection of elements.
0 Comments
Leave a Reply. |