Reputation: 73
I have a interface:
interface SomeInterface<T>{
}
In java i can declare list as follows:
List<SomeInterface> list = new ArrayList<>();
How to write the same in Kotlin? If i try this:
var list = ArrayList<PreferenceSerializer>()
I get an error
Upvotes: 6
Views: 9222
Reputation: 33865
Kotlin doesn't have raw types. Since SomeInterface
is generic, you would need to parametrize it. For instance with a wildcard:
var list = ArrayList<SomeInterface<*>>()
Upvotes: 18