Scala check if element is present in a list

Just use contains

myFunction(strings.contains(myString))

And if you didn't want to use strict equality, you could use exists:


myFunction(strings.exists { x => customPredicate(x) })

Even easier!

strings contains myString

this should work also with different predicate

myFunction(strings.find( _ == mystring ).isDefined)

In your case I would consider using Set and not List, to ensure you have unique values only. unless you need sometimes to include duplicates.

In this case, you don't need to add any wrapper functions around lists.