public static IReadOnlyList <int> FindAllIndexes <T>(this IList <T> collection, T valueToFind, Func <SearchOptions <T>, SearchOptions <T> > optionsFactory) { if (collection == null) { throw new ArgumentNullException(nameof(collection)); } var options = optionsFactory(SearchOptions <T> .Default()); return(options.Strategy.FindAllIndexes(collection, valueToFind).ToList()); }
/// <summary> /// Performs search using Linear Search algorithm. /// Performance: /// Best: O(1) /// Worst: O(n) /// Average: O(1) /// </summary> /// <typeparam name="T">Type contained in the collection</typeparam> /// <param name="options"></param> /// <returns></returns> public static SearchOptions <T> UseLinearSearch <T>(this SearchOptions <T> options) { return(SearchOptions <T> .Default()); }