I have a class Person:
class Person(var fullName: String, var nickname: String, var age: Int)
In my code, at some point I have a List of Person objects, and a list of nicknames.
var people: List<Person> = listOf(
Person("Adam Asshat", "dontinviteme", 21),
Person("Bob Bowyer", "bob", 37),
Person("Emily Eden", "emily", 22)
)
var invitedToParty: List<String> = listOf("bob", "emily")
Now I want to get a List with only Bob and Emily by using lambda's, but I'm not sure how I'd go about it in Kotlin.
var invitedPeople: List<Person> = // a lambda that results in a list containing only Bob and Emily's objects
In C# I'd probably use LINQ and a .where()-method combined with an == any() but Kotlin doesn't seem to have anything like that from what I've found.
Is this even possible in Kotlin lambda's?