The code snippet below looks fine, but surprisingly, the list size is less than 200_000. Take a look at the code snippet and explain what's wrong.
import java.util.*
import kotlin.concurrent.thread
fun addNumbers(numbers: MutableList<Int>) {
for (i in 0 until 100_000) numbers.add(i)
}
fun main() {
val numbers: MutableList<Int> = Vector<Int>()
val thread = thread(start = false, name = "Thread 1", block = {
addNumbers(numbers)
})
thread.start()
addNumbers(numbers)
println(numbers.size) // 200_000
}