![]() Methods in this interface support only read-only access to the list read/write access is supported through the MutableList interface. Note that, the index of a list starts at zero. kotlin-stdlib / llections / List List Common JVM JS Native 1.0 interface List : Collection (source) A generic ordered collection of elements.The get() method takes an argument, which is the index in the list. ![]() In the example below, a list of five elements is created and then we accessed its elements by using the get() method. Now, let us look at a few useful list methods for performing tasks like accessing elements, iterating through the list, deleting, adding and updating elements (in the case of mutable lists).Īn example of creating and accessing a read-only list â the get method Val a_list = mutableListOf(âKotlinâ, âProgramingâ, âLanguageâ) You may also create a list by specifying its type:įor creating a mutable list, you may use the mutableListOf() method as follows: Val a_list = listOf(âKotlinâ, âProgramingâ, âLanguageâ) Java Backend Development(Live) Android App Development with Kotlin(Live). The read-only list (immutable) can be created by using the listOf() method as shown below: Java can read text in different ways, as a single unit (a String object). In this post, I added the code for how to convert the image url list to Multipart Body in kotlin android. The section below shows how to initialize and perform operations in mutable and immutable lists.
0 Comments
Leave a Reply. |