Lists
Lists are ordered collections. With a list, you can insert an element at a very specific location, as well as retrieve elements by the position in the collection. Kotlin provides a couple of pre-built methods for constructing immutable and mutable lists. Remember, immutability is achieved via interface. Here is how you would create lists in idiomatic Kotlin:
val intList: List<Int> = listOf println("Int list[${intList.javaClass.canonicalName}]:${intList.joinToString(", ")}") val emptyList: List<String> = emptyList<String>() println("Empty list[${emptyList.javaClass.canonicalName}]:${emptyList.joinToStrin g(",")}") val nonNulls: List<String> = listOfNotNull<String>(null, "a", "b", "c") println("Non-Null string lists[${nonNulls.javaClass.canonicalName}]:${nonNulls.joinToString (",")}") val doubleList: ArrayList<Double>...