In Kotlin, the mutableListOf method returns an instance of java.util.ArrayList that implements Kotlin's MutableList interface.
Now, the listOf method returns an instance of java.util.Arrays$ArrayList that implements Kotlin's List interface.
From what I understand, List and MutableList are just meant to be two different "views" of ArrayList, immutable and mutable. Why do they map to seemingly different ArrayList classes when they are, as juxtaposing interfaces, what defines the behavior and use of an ArrayList in Kotlin?
What is the difference between java.util.ArrayList and java.util.Arrays$ArrayList? I couldn't find anything about the latter in the java docs. This question stems from what this code outputs in the console:
val list = listOf(1, 2, 3)
val mutableList = mutableListOf(1, 2, 3)
println( list.javaClass ) // class java.util.Arrays$ArrayList
println( mutableList.javaClass ) // class java.util.ArrayList