equalRange<T> function
Returns a Pair containing the lowerBound and upperBound of value.
The list must be partitioned with respect to value (e.g., sorted).
The returned range effectively bounds all elements equivalent to value.
Example:
final list = [10, 20, 30, 30, 40, 50];
final range = equalRange(list, 30); // Returns Pair(2, 4)
Implementation
Pair<int, int> equalRange<T>(
List<T> list,
T value, {
int Function(T, T)? compare,
}) {
return makePair(
lowerBound(list, value, compare: compare),
upperBound(list, value, compare: compare),
);
}