I am often in the situation of doing this type of filtering:
allPeople
.filter(person => englishPeopleIds contains person.id)
and it would make my life easier and my code more readable if there was some sort of "belongsTo" function to do the following:
allPeople
.filter(_.id belongsTo englishPeopleIds)
belongsTo function would have this kind of behaviour (but would be a method of the element):
def belongsTo[T](element: T, list: List[T]): Boolean = list contains element
Do you know if such function is already implemented in Scala?