Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 C# 中,我可以这样做:
public class QuadTree<T> where T : IHasRect
有没有办法在 Java 中做类似的事情?
如果where T : IHasRect表示这T是必须实现IHasRect接口的类型,则 Java 等价物是
where T : IHasRect
T
IHasRect
public class QuadTree<T extends HasRect>
阅读泛型教程以获取更多信息。