SearchAlgorithm<P extends GpsPoint, C extends GpsPointsView<P>, F> constructor

SearchAlgorithm<P extends GpsPoint, C extends GpsPointsView<P>, F>(
  1. C collection,
  2. SearchCompareDiff<C, F> compareDiff
)

Constructor for the algorithm. It's necessary to bind both the collection and the compareDiff, because an algorithm created for one list cannot necessarily be used in another list.

E.g. if an algorithm object was created for a sorted list and would then be applied on an unsorted list, the result would not be reliable. Or if it was created for a compareDiff for which it is sorted, but is later used with one for which it is not sorted. Binding these at construction time avoids these issues, but does mean that using a conceptually equal algorithm on a different collection requires instantiating a new algorithm object.

Implementation

SearchAlgorithm(this.collection, this.compareDiff);