Closed
Description
This issue was originally filed by @seaneagan
A method on Collection to find the first of it's elements which matches a predicate would be useful:
E find(bool predicate(E item)) {
var filtered = filter(predicate);
if(filtered.isEmpty) return null; // throw instead ?
return filtered.iterator().next();
};
it might also make sense to rename Collection#filter to Collection#findAll since "filter" seems to have a mutative connotation.