Yup, I roughly know what a priority queue is. I suppose its just a normal queue with items sorted according to a specific priority. However, the implementation boggles me.
Basically my problem is like this: I have an
Word object, that consists of an (int number) and a (double weight), i didnt put it in the code cos it might mix things up..
This Word object was what I wanted to sort with the priority queue, not the Integer object. The (int number) of the Word object is what i would like to use to sort these objects within the queue, and i thought i would need an comparator for this, since it isn't a primitive and
Java might have trouble sorting it via its "natural order" (correct me if wrong). But i couldn't even get the basic case as illustrated in the code above correct. Hence I'd like to know why it may be not working.
The Word class looks something like this: