This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
compare method should return Positive int : if first arg > then second arg. 0 or any negative : if first arg == to secong arg. Negative int : if first arg < then second arg.
PQsort pqs = new PQsort(); // get a Comparator PriorityQueue<Integer> pq2 = new PriorityQueue<Integer>(10,pqs);
3. IN THE ABOVE CODE IF I CHANGE 10 to 100 I STILL GET THE SAME RESULT, WHY?
Why you expect results to be changed by changing 10 to 100....? 10 or 100 (any int in constructor) specifies initial capacity of PriorityQueue
Read the [B]javadoc if you have any doubt using method[/B] [ October 04, 2006: Message edited by: Riyaz Saiyed ]
Joined: Aug 13, 2006
Typo please read as, compare method should return Positive int : if first argument > then second argument. 0 (Zero) : if first argument == to second argument. Negative int : if first argument< then second argument.