The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

Trying to somehow Compare Generics

Heres the thing, I have a class call HoldQueue it needs to hold a list of another class LeftistHeaps which will be a heap of another class TaskObject. LeftistHeap has to be defined as generic, but when implemented in HoldQueue is when it will be given TaskObject as the "data type" its storing. The problem lies in that I nee to make sure when I use a merge method defined in LeftistHeap that the root is highest priority out of the two heaps to be merged, thus the compare. So far Ive done this:

Re: Trying to somehow Compare Generics

Ryan, i have a little knowledge, but according to me, in the above code you are using recursive function as root=merge(root,newHeap.root), you are passing two constructors here, as you have only one in the function definition. Better try it, may be i am wrong. Well, there is no matter if you try it.