![]() ![]() Immutable Map: mapOf() Mutable Map: mutableMapOf() hashMapOf() HashMap() Immutable Set: setOf() Mutable Set: mutableSetOf() hashSetOf() Immutable List: listOf() Mutable List: arrayListOf() mutableListOf() ArrayList() Kotlin provides different methods in each collection: Collection Type We can update, delete, and add new elements. The mutable collection supports both read and write operations. Once we created an immutable collection, we cannot add or remove elements. The immutable collection only supports read operations. There are 3 types of collections in Kotlin:Įach collection is categorized into two types – immutable and mutable. Typically, they are of the same data type. The objects are called elements (or items). Kotlin collections are used to store a group of objects in a single variable. In this article, we will explore collections with examples. I want change result of kotlin.Kotlin Collections help us to store a group of objects in a single variable. Quantity: valueofquantity Toast.makeText(applicationContext, "List Item : "+ cart(), Toast.LENGTH_LONG).show() I want to see all item value where i have add before to itemOrder in Toast like Then i add for itemOrder like this: itemOrder.add(Order.Order(finalHolder1.nameItem!!.text.toString(),`finalHolder1 priceItem!!.text, finalHolder1.quantity, finalHolder1.note!!.text.toString(), finalHolder1.quantity * hargaSatuan).toString()) ![]() File model Order.kt: private var itemName:String? = nullįun Order(itemName: String, price: CharSequence, all: Int, note: String, quantity: Int)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |