kotlinx.collections.immutable icon indicating copy to clipboard operation
kotlinx.collections.immutable copied to clipboard

Add `buildPersistentList { }`, `buildPersistentMap { }`, `buildPersistentSet { }` to match the builders in kotlin stdlib

Open yogurtearl opened this issue 2 years ago • 4 comments
trafficstars

Add buildPersistentList { }, buildPersistentMap { }, buildPersistentSet { } to match the collection builders in kotlin stdlib

I would imagine it would look something like this:

fun <E> buildPersistentList(block: PersistentList.Builder<E>.() -> Unit): PersistentList<E> = 
    persistentListOf<E>().builder().apply(block).build() 

yogurtearl avatar Dec 13 '22 23:12 yogurtearl

I think it's a good idea but it should be inlined because otherwise it doesn't work at @Composable functions.

Shusek avatar Mar 08 '23 16:03 Shusek

Addressing the fix to #166, can you take a review?

Goooler avatar Dec 30 '23 05:12 Goooler