Scala: How to get the first match in a sequence and immediately returnUsing iterators with map/find/flatten can efficiently find the first matching element in a sequence without processing the entire sequence.