Skip to content
Alex Zuzin edited this page Apr 13, 2017 · 3 revisions

Ad-hoc Javaslang sets can be created as follows:

val hashSet = hashSet(1, 2, 3)
val linkedHashSet = linkedHashSet("slow", "beige", "cat")
val treeSet = treeSet("this string", "is less than", "that string")

NOTE: elements of a TreeSet must be Comparable

A Javaslang Set can be converted to a Kotlin MutableSet:

val mutableSet = hashSet(1, 2, 3).toMutableSet()

A Kotlin Set can be converted to a Javaslang Set:

val jsList = setOf(1, 2, 3).toJsSet()
Clone this wiki locally