6

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 an error

Jorn Vernee
  • 31,735
  • 4
  • 76
  • 93
user1381126
  • 73
  • 1
  • 5

1 Answers1

15

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<*>>()
Jorn Vernee
  • 31,735
  • 4
  • 76
  • 93