ListIdValuePairExtension<D extends Object, V> extension

Binary-search utilities for lists of (ID, value) pairs.

The list must be sorted by ID according to the provided comparator (or the default comparator) for correct results.

on

Methods

binarySearch(D id, [ComputeIDCompare<D>? compare]) → (D, V)?

Available on List<(D, V)>, provided by the ListIdValuePairExtension extension

Returns the (ID, value) pair for id, or null if not found.
binarySearchIndex(D id, [ComputeIDCompare<D>? compare]) int

Available on List<(D, V)>, provided by the ListIdValuePairExtension extension

Returns the index of the entry with the given id, or -1 if not found.