9/28/2023 0 Comments Mapof kotlinPrintln("Its the values the entries are used to store as the separate variable "+map1.values ) Println("Its the keys entries and it is used to store the variable : "+map1.keys ) Println("Thank you users for to spenting the time with our application your entries are : "+map1) Val map1 = mapOf(6 to "Have a Nice Day users", 7 to "Its the Seventh index and key value", 8 to "Its the eigth index and its key value", 9 to "Its the ninth index and its key value", 10 to "Its the tenth index and its key value", 11 to "Its the eleventh index and its key value") Println("Its the first example for reagrding the kotlin map interface we used different classes and methods that can be related to the interface") Val map = mapOf(1 to "Siva", 2 to "raman", 3 to "Welcome", 4 to "To", 5 to "My Domain", 12 to "Its the twelth index and key value", 13 to "Its the thirteen index and key value", 14 to "Its the fourteen index and key value", 15 to "Its the fifteen index and key value") Given below are the examples of Kotlin Map: Example #1 The map is of any type in the kotlin language the key and value elements will be stored as a separate index it takes the predicate arguments, the filter conditions will be of the negative type, and the key will be unique and it has many values. The classes used on the map interface will be of any type this is because of the classes used internally on the kotlin package. Like that map value also covariant and its value type it also be changed if it’s required. The key type is the invariant one, and it is accepted as the parameter it uses a method like containsKey() and also it returns the keys set. If we use the mutablemap interface, it supports both read and write access. The members from the map interface are readable ones, so we cant edit and changeable for that. It is the immutable one, and it is the fixed size, so after declaring the mapping size, it cannot be changed both static and dynamic. The key is the unique one, and it holds only a single value for each key it also different pairs and combined with each other. Like java, it can be of the same type and feature. How does Map Function work in Kotlin?Ī map is an interface that is used for to store the datas as the key-value pairs. The mapping interface uses any type like Integer, String, Characters as the parameter type. The above codes are the basic syntax for utilising the map interface on the kotlin. some coding logics it depends upon the application requirement.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |