alexey.tsvetkov
02/28/2016, 11:05 PMsetOf
or emptySet<Long>().plus(5)
you don't get an immutable set; instead you get an immutable reference to a mutable set. You can check that by printing java class of an expression returned by setOf
for example. On the JVM platform that would be LinkedHashMap
, which means that the underlying set can be mutated from java.