I have a list of fragments and want to find a specific one based on the fragment type passed in as an argument. Sort of like this:
private fun findFragment(findFragment: Fragment): Fragment {
    fragments.forEach {
        if (it is findFragment) {
            return it
        }
    }
}
findFragment(MyFragment)
I don't want to send an instance but rather the type, and if that type exists in the list, the instance should be returned. I get an error on if (it is findFragment) saying unresolved reference findMyFragment.
How do I make this happen?
 
    