Q:

JVM Implementation of Kotlin Set and MutableSet

What implementation class is used to back the Set<E> and MutableSet<E> types returned by setOf() and mutableSetOf()?  
Since the api documentation describes MutableSet as A generic unordered collection of elements, and since elements don't have to be Comparable, I'm guessing it's a HashSet but I can't find confirmation.

A:

Taking a look inside Kotlin sources here and here, it seems that both return LinkedHashSet. There is an exception, in case setOf() is provided an empty list, it returns a singleton object (Kotlin object) which is defined at the top of the first file (link).

