I would like to filter my data set on two conditions at once.

Is it possible?

I want something like this:

mystuff = mystuff.filter(_.isX && _.name == "xyz")

Using slightly less concise lambda syntax:

mystuff = mystuff.filter(x => (x.isX && x.name == "xyz"))

You can find more detail on Scala anonymous function syntax here.


While there might be some performance impact depending on what "myStuff" is, you could always filter twice

mystuff = mystuff.filter(_.isX).filter(_.name == "xyz")