Standard way to get first element of iterator satisfying predicate

You could use filter instead of Iterators.filter, but the first one allocates a new array, which will be very inefficient. The Iterators submodule provides different lazy iterators, which can be more efficient in some situations than working with arrays.

1 Like