binarySearch method
Returns the (ID, value) pair for id, or null if not found.
Uses binary search and runs in O(log n).
The list must be sorted by ID using compare.
Implementation
(D, V)? binarySearch(D id, [ComputeIDCompare<D>? compare]) {
var idx = binarySearchIndex(id, compare);
if (idx < 0) return null;
return this[idx];
}