logitopia / jmortar-core-search-sort

A library that provides production-grade searching and sorting utilities for Java. This project is in the very early stages of development.
GNU General Public License v3.0
0 stars 0 forks source link

Add a linear search algorithm #7

Open SteveCheesley opened 4 years ago

SteveCheesley commented 4 years ago

Story

As a consumer of the library I would like the ability to search a small (>20 items) data set using a linear search So that I can find items in the most resource efficient manor possible

Acceptance Criteria

User Documentation

This is the simplest of all searching algorithms. It simply steps through items in a set and checks each item to see if it matches the required element. You can either stop after the first match is found, or return a set of all matching items.

Matching should be provided, as before, by a lambda that compares two objects in some way.

The use of this search is if you have a small set of data that you wish to search through. This is the most efficient way from a resource perspective to seach a small set. If you have a larger set of data (20 items or more) then I would recommend selecting a more efficient search algorithm.

Can be applied to an unsorted or a sorted set of data