searching library

A collection of index search algorithms.

Functions

binarySearch<E, V>(List<E> list, V value, {int? start, int? count, EntryComparator<E, V>? compare}) int
Returns the index of the first occurance of the value in a sorted list, otherwise -1 if not found. It is ensured that the index is as lowest as possible.
binarySearchQuick<E, V>(List<E> list, V value, {int? start, int? count, EntryComparator<E, V>? compare}) int
This function returns the index of the first occurence of a value in a sorted list. Unlike binarySearch, this does not ensure that the index of the value is as minimum as possible.
binarySearchUpper<E, V>(List<E> list, V value, {int? start, int? count, EntryComparator<E, V>? compare}) int
Returns the index of the last occurance of the value in a sorted list, otherwise -1 if not found.
linearSearch<E>(List<E> list, E value, {int? start, int? count}) int
Returns the first index of the value in the list, otherwise -1.
linearSearchBy<E>(List<E> list, EqualityTest<E> test, {int? start, int? count}) int
Returns the first index where the test is true in the list, otherwise -1.
linearSearchReversed<E>(List<E> list, E value, {int? start, int? count}) int
Returns the last index of the value in a list in reverse order, otherwise -1.
linearSearchReversedBy<E>(List<E> list, EqualityTest<E> test, {int? start, int? count}) int
Returns the last index where the test is true in the list, otherwise -1.
lowerBound<E, V>(List<E> list, V value, {int? start, int? count, EntryComparator<E, V>? compare}) int
Returns the index of the first item from a sorted list that is either equal to or greater than the the value, otherwise if all items are lesser than the value, the length of the list is returned.
upperBound<E, V>(List<E> list, V value, {int? start, int? count, EntryComparator<E, V>? compare, bool exactMatch = false}) int
Returns the index of the first item from a sorted list that is strictly greater than the value, otherwise if all items are less than or equal to the value the length of the list is returned.