SortedListX<T extends Object> extension
Useful extension functions for sorted Lists.
- on
-
- List<
T>
- List<
Methods
-
mergeSorted<
K> (Iterable< T> ? other, {required K key(T item), required Comparator<T> compare, T update(T original, T updated)?}) → List<T> -
Available on List<
Merges this list withT> , provided by the SortedListX extensionothervia an O(N+M) two-pointer pass, with duplicates deduplicated bykey. -
sortedInsert(
T element, {required Comparator< T> compare}) → List<T> -
Available on List<
InsertsT> , provided by the SortedListX extensionelementinto this sorted list at the correct position. -
sortedUpsert<
K> (T element, {required K key(T item), T update(T original, T updated)?, required Comparator< T> compare}) → List<T> -
Available on List<
Inserts or replacesT> , provided by the SortedListX extensionelementin this sorted list bykey. -
sortedUpsertAt(
int existingIndex, T element, {required Comparator< T> compare, T update(T original, T updated)?}) → List<T> -
Available on List<
Like sortedUpsert but with the existing-element index pre-supplied by the caller — useful when the caller already has the index from another scan (e.g. anT> , provided by the SortedListX extensionoldMessagelookup in the same code path). Avoids the duplicate O(N)indexWherethat sortedUpsert would otherwise run.