![]() Create a new Kotlin file named Main.kt under the kotlin folder.Ĭopy the following code and paste it into the file. Go to IntelliJ and create a new Kotlin project. An empty list means that there are no elements in the data structure. This tutorial will teach us how to create an empty mutable list. If you need an immutable empty list instance, you can use the listOf() function, as shown below: 2. However, when you create an implementation of the List without specifying whether the list is mutable or immutable, it is assumed to be mutable by default. ![]() From Kotlin 1. The MutableList type returns a list that can be modified, and the List type returns a list that cannot be modified. A list is empty if and only if it contains no elements. Note that MutableList is a list because it inherits from the List interface. A mutable list is a list that can be modified by adding or removing elements in the data structure.Īn immutable list is a list that cannot be modified by either adding or removing elements in the data structure.įrom the two terms, we can have two types of lists that include List and MutableList. Modifier l'adresse IP d'un ordinateur sous Seven
0 Comments
Leave a Reply. |