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 interface Visitor<T> { public void visit(T t); } interface VisitorCompany extends Visitor<Employee>, Visitor<Company>, Visitor<Department>;
I assume something like this is not possible in java?
由于类型擦除,这在 java 中是不可能的。关于类型擦除的解释请参考这里类型擦除。