suhas
09/11/2021, 3:14 AMids.forEach { id ->
val person = persons.find { it.id == id}
filteredList.add(person)
}
Rajkumar Singh
09/11/2021, 3:27 AMfilteredList += persons.filter { it.id in ids} OR persons.filterTo(filteredList) { it.id in ids }
suhas
09/11/2021, 3:29 AMephemient
09/11/2021, 3:38 AMpersons.retainAll { it.id in ids }
persons.size
· ids.size
); if persons
is not small then it would be better to convert ids
to a Set
firstsuhas
09/11/2021, 5:44 AM