The interface describes the method:

fun setElements(items: MutableList<*>) 

I implement the interface:

 var mLocalItems: MutableList<String>? = null override fun setElements(items: MutableList<*>) { mLocalItems = items } 

The studio gives me a type mismatch.

  • Actually the question is, how do items result in mLocalItems?
  • Is it possible to use interfaces in Kotlin without generics? (after all, in Java we can declare a List list).

    1 answer 1

    You can cast the type using the as operator :

     mLocalItems = items as MutableList<String>