feat: add bulk insert methods to ListSignal and SharedListSignal#24026
Open
feat: add bulk insert methods to ListSignal and SharedListSignal#24026
Conversation
Add insertAllLast, insertAllFirst, and insertAllAt to ListSignal that perform the entire batch with a single notification. Add insertAllLast and insertAllFirst to SharedListSignal using transactions for atomicity.
…bulk insert methods Extract createSignals() and insertAllAtInternal() private helpers so that insertAllLast, insertAllFirst, and insertAllAt all delegate to a single code path for signal creation and list construction.
Adds insertAllAt(Collection, ListPosition) to SharedListSignal, matching the API symmetry with ListSignal which already has insertAllAt.
Delegate insertAllFirst and insertAllLast to insertAllAt instead of duplicating the transaction and iteration logic. This removes the reverse-iterate-then-reverse-ops approach in insertAllFirst.
…ture insertAllFirst now delegates to insertAllAt(0, values), reducing the boilerplate while insertAllLast keeps its own lock block to safely compute the current size inside the lock.
The collection parameter must not be null, but individual null values within the collection are allowed when the element type permits null, consistent with the single-insert methods.
…actions Nested transaction support is tested by calling insertAllLast and insertAllFirst from within a Signal.runInTransaction block.
Covers the missing test gap where insertAllFirst with an empty collection was not verified to be a no-op.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Add insertAllLast, insertAllFirst, and insertAllAt to ListSignal that perform the entire batch with a single notification. Add insertAllLast, insertAllFirst and insertAllAt to SharedListSignal using transactions for atomicity.