Define collection of data class


#1

If I’ve the below data class

data class User(val name: String = "", val age: Int = 0)

How can I define a collection of it, like:

var user = User [] // this is not working

I need to be able to call the users by:

user[0].name // something like this!

#2

https://kotlinlang.org/docs/reference/collections.html