I want to search a nested list for a tuple but I want to know the most efficient way to do so in Scala. For example,
List[(String, Int)] = List((b,1), (c,1), (d,1))
List#contains is the fastest way to do it. It will make at most one pass of the
List, and stops as soon as it finds a match. Unless you know the list is sorted, you can't make it any faster. The Scala collections library is written in such a way that all (if not, most) of the elementary functions are optimized for performance.
See the source.