data class Animal (val name:String)
val animals = listOf(Animal("Lion"), Animal("Elephant"), Animal("Tiger"))
println(animals.filter { it.name.contains("n") }.toString())
You can use find method, that returns the first element matching the given [predicate], or null if no such element was found.
Try this code to find value in array of objects
val findedElement = array?.find {
it.id == value.id
}
if (findedElement != null) {
//your code here
}