Ole
Ole

Reputation: 47090

<T extends Identifiable<? extends Serializable>>?

Just want to see if I'm reading this expression correctly:

<T extends Identifiable<? extends Serializable>>

T is a subclass of Identifiable and that subclass is serializable? So in other words the ? in <? extends Serializable>> is effectively a reference to the the T extends Identifiable part of the code?

Upvotes: 1

Views: 1238

Answers (1)

templatetypedef
templatetypedef

Reputation: 373082

Close, but not quite. The grouping here looks like this:

T extends (Identifiable<? extends Serializable>)

In other words, this says that T must be a subtype of the Identifiable interface, where the generic argument to Identifiable must be something that implements Serializable. For example, you could have T be something that is a subtype of Identifiable<Integer>, since Integer is serializable, but not a subtype of Identifiable<Thread>, since Thread is not serializable.

Upvotes: 2

Related Questions