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

Allow Creating Immutable Builders (Map/SortedSet/List) intialised with initial Values #45

Open
d80tb7 opened this issue Mar 1, 2023 · 0 comments

Comments

@d80tb7
Copy link

d80tb7 commented Mar 1, 2023

Right now, `ListBuilder, MapBuilder and SortedSetBuilder) are intialised with empty data structures. This is great if you want to create an object from scratch, but doesn't cover the use case where you have an existing object and want to make a large number of modifications to it.

I propose we add functions that allow a user to create builders from initial data structures. For example:

NewSortedSetBuilderFromExisting[T any](s SortedSet[T]) *SortedSetBuilder[T] 

We would guarantee that the builder itself would mutate a copy so that the initial data structure would remain immutable.

Happy to make a PR if you think this would be useful.

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

No branches or pull requests

1 participant