Kotlin.Collection vs. java.util.Collection

Problem is that f.ex. this does not compile:

val set = setOf(2, 5, 8) val result = set.filter { it > 2 } result.add(8) // Error:(13, 12) Kotlin: Unresolved reference: add

So I was looking for an alternative solution. By the way, this does not compile with the same error although toSet() is called:

val set = setOf(2, 5, 8) val result = set.filter { it > 2 }.toSet() result.add(8) // Error:(13, 12) Kotlin: Unresolved reference: add

Funny thing is that this prints "class java.util.ArrayList":

val set = setOf(2, 5, 8) val result = set.filter { it > 2 } println(result.javaClass)

Yet you can't call add on an  java.util.ArrayList ... Am using Kotlin 0.11.1079