SortedCollection >> includes: may fail to find elements
SortedCollection includes may fail to find an element, if the elements
in the SortedCollection define = according to one instance variable, but
the SortedCollection uses a sort block that compares a different instance
variable. This is true using a default sort block if the elements in the
SortedCollection define <= to use a instance variable other than the one
used for the = comparison.
This is since SortedCollection >> includes: performs a binary sort based
on the sorted order, so if the argument does not compare as = to an element
in the vicinty of the insert location, no further searching is done.
Use caution in defining the = and <= methods for elements that will be
in a SortedCollection, and in the sortblock method. If there is a need
to define these differently, <SortedCollection> asArray includes: will
return the correct result. Alternatively, subclass SortedCollection and
reimplement includes: as a linear search.