Lambda use with a filter function

Report a typo

We have a list of some Persons:

case class Person(name: String, age: Int, gender: String)

val people: List[Person]

Filter people based on multiple conditions using a lambda function to receive a list with "Female" gender only and the age over 25. Save the result to the filteredPeople value.

Sample Input 1:

Person(John,25,Male)
Person(Jane,30,Female)
Person(Bob,20,Male)
Person(Sara,35,Female)

Sample Output 1:

Person(Jane,30,Female)
Person(Sara,35,Female)
Write a program in Scala 3
val filteredPeople = people.filter { ??? }
___

Create a free account to access the full topic