ceylon / ceylon.language

DEPRECATED
Apache License 2.0
153 stars 57 forks source link

split occurrence/inclusion-related operations to SearchableList #767

Closed gavinking closed 9 years ago

gavinking commented 9 years ago

Operations like firstOccurrence() and firstInclusion() suffered from several problems:

Therefore, they have been factored out to a new invariant interface SearchableList which is implemented by String, Array, and ArrayList. Since all these are invariant types, we've regained typesafety. In addition, optional parameters from and length have been added, and the implementations on String have been made much more efficient.

I have one more small remaining task here which is to decide between:

gavinking commented 9 years ago

I went with the simpler implementation. I doubt it is that expensive to instantiate a comprehension.

This is now done.

gavinking commented 9 years ago

After benchmarking, I went back to something more like what I had before.