I have an interface:
interface Change
and a function:
fun test (listOfChanges: List<Change>)
and this class that implements Change
interface:
class MyChange :Change
How to check if listOfChanges
has an element of MyChange
class?
Like: if(listOfchanges.contains(MyChange::class)
You can use any()
:
listOfChanges.any { it is MyChange }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With