search

trait Collection[A] {
  def search[B >: A](e: B): SearchResult
  def search[B >: A](e: B, i: Int, j: Int): SearchResult
}

search searches the first element in this collection which equals (==) the element e and returns a Found containing the index where it was found.

If e cannot be found in the collection then an InsertionPoint containing the index where the element would be inserted is returned.

The search can be restrict to the interval [i, j).