Hi I have problem with creating a generic TreeSet with its Iterator. I want to use it to three different kind of Types.
Can anyone help me how to do that?
Hi I have problem with creating a generic TreeSet with its Iterator. I want to use it to three different kind of Types.
Can anyone help me how to do that?
If you want to create a TreeSet
which contains objects of type ClassA
, ClassB
and ClassC
you'd have to use
TreeSet<MostSpecificSupertypeOfABC>
If if there's no suitable type to use, you could create one as I have described in an answer to the question below: