Stephan van Hulst wrote:Well, what is it you want? If you want the type of the parent to depend on whatever the type of the object you're passing to the setParent() method is, you can't do this in Java.
I'll try your code fragment.
I want the parent of a node of orange to be a Node<Orange>
I thought that if you define a tree of Oranges, you can have iterators that return Node<Orange> etc.
Its not that the invocation of the setParent() varies, when you define a bunch of Node<Orange>'s, then type safety would say you can only call
setParent() with a value that is a Node<Orange> But it doesn't seem to work,or my understanding is all out of sync with generics.