public static void Dijk(HashMap<String, HashMap<String, Integer>> map, String go, String stop){
PriorityQueue pq = new PriorityQueue();
for (String x: map){
}
}
Why is the complier telling me I can’t use a foreach loop here?
Also this is smaller section of a large program but I haven’t had much experience with priority queues I want to use it to hold a <String, int> //or Integer am I doing this right? (Im using the PQ as a binary heap essentially) (this method will be implementing Dijkstra’s algorithm)
Thank you for your help/answers in advance!
Assuming you intend to iterate over the keys of the HashMap, you should try
As for the priority queue, take a look at the Java collection PriorityQueue