Key Features of Stardust 6
Immutable Collections
With version 6, Stardust has real immutable collections allowing multiple instances to share parts of the same data structures. This is realized by basing Stardust’s immutable collections on kotlinx.collections.immutable.
// Create an immutable multi-map
val multiMap1: PersistentMultiMap<String, String> = buildPersistentMultiMap {
    putAll("A", listOf("B", "C"))
    putAll("D", listOf("E", "F"))
}
// Create an altered copy of `multiMap1`
val multiMap2 = multiMap1.mutate {
    it.putAll("D", listOf("G"))
    it.putAll("X", listOf("X", "Z"))
    it.remove("A", prune = true)
}
println(rope {
    -"Map 1 remains unchanged:"
    indent { multiMap1.ropeIndented(this, "multiMap1") }
    nl()
    -"Map 2 contains the mutations:"
    indent { multiMap2.ropeIndented(this, "multiMap2") }
})
Map 1 remains unchanged:
    multiMap1 |2| {
        "A" |2| {
            "B"
            "C"
        }
        "D" |2| {
            "E"
            "F"
        }
    }
Map 2 contains the mutations:
    multiMap2 |2| {
        "D" |3| {
            "E"
            "F"
            "G"
        }
        "X" |2| {
            "X"
            "Z"
        }
    }