NoamEpstein
NoamEpstein

Reputation: 127

Whats the interface in angle brackets in Kotlin?

In Kotlin I often read

class MyFragment : BaseMvpFragment<MvpView, MvpPresenter>(), MvpView {}

whereas MvpView and MvpPresenter are interfaces.. so MyFragment extends BaseMvpFragment<MvpView, MvpPresenter>() but how can I interpret <MvpView, MvpPresenter> ?

Upvotes: 2

Views: 1593

Answers (2)

gidds
gidds

Reputation: 18577

They are type parameters; see here.

Upvotes: 2

s1m0nw1
s1m0nw1

Reputation: 81949

The class BaseMvpFragment obviously defines two generic types which are being specified via <MvpView, MvpPresenter>.

Consider the List<T> interface. When you implement it, it looks like this:

class VerySpecialList : List<String> { ... }

Upvotes: 3

Related Questions