Scala filter on two conditions

前端 未结 3 1778
自闭症患者
自闭症患者 2021-02-02 05:47

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 &         


        
3条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-02 06:47

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

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

提交回复
热议问题