4 ms·
No, filter() still visits everything in the list, it just takes a predicate to decide if that item is added to a new list. some() or every() can be used for ear
by neurotrace 9y ago
No, filter() still visits everything in the list, it just takes a predicate to decide if that item is added to a new list. some() or every() can be used for early termination though.