开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜