I am looking to convert an List<String> to an List<Int> in Kotlin.
val stringArray = "1 2 3 4 5 6".split(" ")
val intArray = MutableList<Int>(0, {0})
for (item in stringArray) {
intArray.add(item.toInt())
}
The above will do it, but it feels as if there is a better way of doing this (possible with lambdas and streams?).