j

    julioromano

    1 year ago
    Why is there
    mutableStateListOf
    and 
    mutableStateMapOf
    but no
    mutableStateSetOf
    ?
    Big Chungus

    Big Chungus

    1 year ago
    I'm guessing because collections are harder to diff and as such have more tailored and optimised variants for this.
    Adam Powell

    Adam Powell

    1 year ago
    feel free to file a FR, answer is probably as simple as, "we haven't needed it ourselves yet"
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    1 year ago
    Also you can trivially implement a set on top of a map (I believe this is actually how some of the standard JVM collections like
    LinkedHashMap
    do it)
    Adam Powell

    Adam Powell

    1 year ago
    all of the current ones are basically thin wrappers around a shaded version of kotlinx.collections.immutable collections
    j

    julioromano

    1 year ago
    Also you can trivially implement a set on top of a map (I believe this is actually how some of the standard JVM collections like 
    LinkedHashMap
     do it)
    @Zach Klippenstein (he/him) [MOD] I though of that too, because the keys of a
    Map
    are indeed a
    Set
    . Though couldn’t come up with a simple way of declaring:
    val myCollection = remember { mutableStateMapOf<String, Long>() }
    and then accessing
    myCollection
    as a
    MutableSet
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    1 year ago
    Yea you’d have to probably manually implement the interface and delegate