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.
这正式成为我的头脑!
我想要做的是将一个类型传递给一个方法,然后返回相同的类型。正是这个:
public <T> T get(T in) { return in; }
只有我希望 T 成为抽象基类的子类,而不仅仅是任何旧类。有点像这样:
public <T extends BaseClass> T get(<T extends BaseClass> in) { return in; }
但众所周知;它不是这样工作的。
还没有尝试过,但这不起作用吗?
public <T extends BaseClass> T get(T in) { return in; }