How to restrict types which are allowed as "T" in a generic class?
I've got a class Foo<T>
. How can I say that I want T
to be some class implementing BarInterface
? Writing simply class Foo<T implements BarInterface>
doesn't compile.
Use extends
instead of implements
.
精彩评论