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.
The moose likes Java in General and the fly likes using Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Java in General
Bookmark "using "contains" method from PriorityQueue class" Watch "using "contains" method from PriorityQueue class" New topic

using "contains" method from PriorityQueue class

Jim Hester
Ranch Hand

Joined: Sep 19, 2009
Posts: 36
so, I have some nodes that I've put into a PriorityQueue and I want to check to see if a node I have outside the queue is already in the queue. When I use the <priorityqueue>.contains(Node) it seems to run forever (I did some debugging and it's tripping up right on line 91 below). There's quite a bit of code that I'll post below (both the class I'm working with and it's dependent class), but the long and short of my question is: is there a provided means of checking if a node I have outside the PQ is already IN the PQ? If not, any ideas on how to implement a method that does that (pseudo code fine). Any assistance and/or suggestions is appreciated. thanks!

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 43935
Please post a shorter bit of code which shows the problem. That is called an SSCCE. You may find more about SSCCEs here.
What does it say in the PriorityQueue documentation?
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: using "contains" method from PriorityQueue class
jQuery in Action, 3rd edition