{"action":"opened","issue":{"url":"https://api.github.com/repos/ceylon/ceylon.language/issues/767","labels_url":"https://api.github.com/repos/ceylon/ceylon.language/issues/767/labels{/name}","comments_url":"https://api.github.com/repos/ceylon/ceylon.language/issues/767/comments","events_url":"https://api.github.com/repos/ceylon/ceylon.language/issues/767/events","html_url":"https://github.com/ceylon/ceylon.language/issues/767","id":108430337,"number":767,"title":"split occurrence/inclusion-related operations to SearchableList","user":{"login":"gavinking","id":579974,"avatar_url":"https://avatars.githubusercontent.com/u/579974?v=3","gravatar_id":"","url":"https://api.github.com/users/gavinking","html_url":"https://github.com/gavinking","followers_url":"https://api.github.com/users/gavinking/followers","following_url":"https://api.github.com/users/gavinking/following{/other_user}","gists_url":"https://api.github.com/users/gavinking/gists{/gist_id}","starred_url":"https://api.github.com/users/gavinking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gavinking/subscriptions","organizations_url":"https://api.github.com/users/gavinking/orgs","repos_url":"https://api.github.com/users/gavinking/repos","events_url":"https://api.github.com/users/gavinking/events{/privacy}","received_events_url":"https://api.github.com/users/gavinking/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ceylon/ceylon.language/labels/FEATURE","name":"FEATURE","color":"02e10c"}],"state":"open","locked":false,"assignee":{"login":"gavinking","id":579974,"avatar_url":"https://avatars.githubusercontent.com/u/579974?v=3","gravatar_id":"","url":"https://api.github.com/users/gavinking","html_url":"https://github.com/gavinking","followers_url":"https://api.github.com/users/gavinking/followers","following_url":"https://api.github.com/users/gavinking/following{/other_user}","gists_url":"https://api.github.com/users/gavinking/gists{/gist_id}","starred_url":"https://api.github.com/users/gavinking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gavinking/subscriptions","organizations_url":"https://api.github.com/users/gavinking/orgs","repos_url":"https://api.github.com/users/gavinking/repos","events_url":"https://api.github.com/users/gavinking/events{/privacy}","received_events_url":"https://api.github.com/users/gavinking/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/ceylon/ceylon.language/milestones/10","html_url":"https://github.com/ceylon/ceylon.language/milestones/1.2","labels_url":"https://api.github.com/repos/ceylon/ceylon.language/milestones/10/labels","id":807571,"number":10,"title":"1.2","description":"","creator":{"login":"gavinking","id":579974,"avatar_url":"https://avatars.githubusercontent.com/u/579974?v=3","gravatar_id":"","url":"https://api.github.com/users/gavinking","html_url":"https://github.com/gavinking","followers_url":"https://api.github.com/users/gavinking/followers","following_url":"https://api.github.com/users/gavinking/following{/other_user}","gists_url":"https://api.github.com/users/gavinking/gists{/gist_id}","starred_url":"https://api.github.com/users/gavinking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gavinking/subscriptions","organizations_url":"https://api.github.com/users/gavinking/orgs","repos_url":"https://api.github.com/users/gavinking/repos","events_url":"https://api.github.com/users/gavinking/events{/privacy}","received_events_url":"https://api.github.com/users/gavinking/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":144,"state":"open","created_at":"2014-09-30T00:35:13Z","updated_at":"2015-09-26T00:54:06Z","due_on":"2014-10-28T23:00:00Z","closed_at":null},"comments":0,"created_at":"2015-09-26T00:54:06Z","updated_at":"2015-09-26T00:54:06Z","closed_at":null,"body":"Operations like `firstOccurrence()` and `firstInclusion()` suffered from several problems:\r\n\r\n- since they were declared by the covariant type `List`, they weren't typesafe,\r\n- they were required to be implemented by every `List`, even though they weren't really appropriate for e.g. `LinkedList`\r\n- the implementations on `String` were inefficient\r\n- the actual usecases for these operations called for additional optional parameters, e.g. `from` indexes\r\n\r\nTherefore, 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.\r\n\r\nI have one more small remaining task here which is to decide between:\r\n\r\n- defining all the operations in terms of `occurrences()` and `inclusions()`&mdash;making `SearchableList` easier to implement, or\r\n- leaving it as it is, where  `occurrences()` and `inclusions()` are defined in terms of the other operations of `SearchableList`&mdash;potentially more efficient."}}