Skip to content
Ruslan Sennov edited this page Sep 12, 2017 · 3 revisions

Ad-hoc Vavr 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 Vavr Set can be converted to a Kotlin MutableSet:

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

A Kotlin Set can be converted to a Vavr Set:

val vavrSet = setOf(1, 2, 3).toVavrSet()
Clone this wiki locally