-
Notifications
You must be signed in to change notification settings - Fork 12
Maps
Ruslan Sennov edited this page Sep 12, 2017
·
3 revisions
Ad-hoc Vavr maps can be created as follows:
val hashSet = hashMap(1 to 1, 2 to 2, 3 to 3)
val linkedHashMap = linkedHashMap(1 to "none", 2 to "a couple", 3 to "a lot")
val treeMap = treeMap("this string" to 1, "is less than" to 2)
NOTE: keys in a TreeMap must be Comparable
A Vavr Map can be converted to a Kotlin MutableMap
:
val mutableMap = hashMap(1 to 1, 2 to 2, 3 to 3).toMutableMap()
A Kotlin Map
can be converted to a Vavr Map
:
val vavrMap = mapOf(1 to 1, 2 to 2, 3 to 3).toVavrMap()
JΛVΛSLΛNG, (C) 2014 - 2017 javaslang.io