Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding and removing items from immutablelist #189

Open
fred-bowker opened this issue Aug 14, 2024 · 2 comments
Open

adding and removing items from immutablelist #189

fred-bowker opened this issue Aug 14, 2024 · 2 comments
Labels
doc Documentation improvement task

Comments

@fred-bowker
Copy link

The documentation for adding and removing items from immutablelist is unclear:

From the docs
Note: you need to import these operators from kotlinx.collections.immutable package in order for them to take the precedence over the ones from the standard library.

import kotlinx.collections.immutable.*

A lot of people don't use * in there imports and instead use the actual import, can the documentation be updated to reflect this.

Currently if i use + or - on an immutableList I get returned a List not an immutableList. it would be good if the documentation could be updated to show how I can use + or - to return an ImmutableList

Oh and thanks for creating this library :)

@Goooler
Copy link
Contributor

Goooler commented Oct 3, 2024

import kotlinx.collections.immutable.plus
import kotlinx.collections.immutable.minus
import kotlinx.collections.immutable.persistentListOf

@Test fun plus() {
    val list1 = persistentListOf(1, 2, 3)
    val list2 = persistentListOf(4, 5, 6)
    val list3: PersistentList<Int> = list1 + list2
    val list4: PersistentList<Int> = list3 - list2
    compareLists(list1, list4)
}

@qurbonzoda qurbonzoda added the doc Documentation improvement task label Nov 3, 2024
@qurbonzoda
Copy link
Contributor

Related #10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Documentation improvement task
Projects
None yet
Development

No branches or pull requests

3 participants