This week's book giveaway is in the Android forum.
We're giving away four copies of Create an Uber Clone in 7 Days: Build a real world full stack mobile app in Java and have Shai Almog on-line!
See this thread for details.
Win a copy of Create an Uber Clone in 7 Days: Build a real world full stack mobile app in Java this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

using "contains" method from PriorityQueue class  RSS feed

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!




 
Marshal
Posts: 59466
187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
it's a teeny, tiny, wafer thin ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!