I've just started playing with Java 8 lambdas and I'm trying to implement some of the things that I'm used to in functional languages.
For example, most functional languages have some kind of find function that operates on sequences, or lists that returns the first element, for which the predicate is true. The only way I can see to achieve this in Java 8 is:
.filter(x -> x > 5)
However, this seems inefficient to me, as the filter will scan the whole list, at least to my understanding (which could be wrong). Is there a better way?