What is a good way( read better readability) to filter a list of tuples. I'm using
tupleList.filter(_._2).map(_._1)
But this does not feel readable.
What is a good way( read better readability) to filter a list of tuples. I'm using
tupleList.filter(_._2).map(_._1)
But this does not feel readable.
Not sure how much better but you can use collect:
and of course give x some meaningful name. If the first element is not a boolean you can even do something like:
and give x and y meaningful names