I see Kotlin has a List
List geeks = Ar
There is one more way to build a list in Kotlin that is as of this writing in the experimental state but hopefully should change soon.
inline fun buildList(builderAction: MutableList.() -> Unit): List
Builds a new read-only List by populating a MutableList using the given builderAction and returning a read-only list with the same elements.
Example:
val list = buildList {
testDataGenerator.fromJson("/src/test/resources/data.json").forEach {
add(dao.insert(it))
}
}
For further reading check the official doc.