I am trying to compile this sample which maps users by lastname, but it fails with "Compiler terminated with exit code: -1". Am I missing anything?
import std.util.*
import std.*
fun main(args : Array<String>) {
val users = arrayList(
User(“John”, “Doe1”, 31),
User(“John”, “Doe2”, 32),
User(“John”, “Doe3”, 33))
val usersByLastName = users.map {it.lastName}
for (item in usersByLastName) {
println(item)
}
}
Here is the User.kt:
public class User(val firstName: String, val lastName: String, val age: Int) {
fun toString() =“$firstName $lastName, age $age”
}