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.
嗨,我在创建带有迭代器的通用 TreeSet 时遇到问题。我想将它用于三种不同的类型。
谁能帮我怎么做?
如果你想创建一个TreeSet包含类型对象的,ClassA你必须使用ClassBClassC
TreeSet
ClassA
ClassB
ClassC
TreeSet<MostSpecificSupertypeOfABC>
如果没有合适的类型可供使用,您可以按照我在以下问题的答案中描述的那样创建一个: