<div dir="ltr"><div>Find method must find an item in the list. Whether the list is sorted or not, whether the binary search optimization can be applied or not - are implementation details.</div><div><br></div><div>Find method should either:</div><div>1) Raise exception if list is not sorted,</div><div>2) Use IndexOf method if the list is not sorted (preferable).</div><div><br></div><div>Adding optional parameters is hardly a good solution. Instead, add a FindSorted method.</div><div><br></div><div>To summarise:</div><div><br></div><div>procedure Find(const S: string; out Index: Integer):Boolean;</div><div>begin</div><div>  if Sorted then</div><div>    Result := FindSorted(S, Index);</div><div>  else</div><div>  begin</div><div>    Index := IndexOf(S);</div><div>    Result := (Index >= 0);</div><div>  end;</div><div>end;</div><div><br></div><div>procedure FindSorted(const S: string; out Index: Integer):Boolean;<br></div><div>begin</div><div>  if not Sorted then</div><div>    raise Exception.Create('List must be sorted');</div><div>  // search logic here...</div><div>end;</div><div><br></div><div><br></div><div>Denis</div></div>