scala - Filtering a list of tuples -


i have list of tuples , want filter out elements second value in tuple not equal 7.

i do:

valuesaslist.filter(x=>x._2 != 7) 

can use wildcard notation make shorter?

thanks.

you can

valuesaslist.filter(_._2 != 7) 

but doubt should preferred on example or (think readability):

valuesaslist.filter {case (_, v) => v != 7} 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -