cannot find symbol class entry
807580Dec 15 2009 — edited Dec 15 2009.\ListGraph.java:26: cannot find symbol
symbol : class Entry
location: class Map
for(Map.Entry<Stad,List<ListEdge>> me : nodes.entrySet())
^
1 error
this is what i get when i try to compile this code, its the lowest part thats getting errors:
import java.util.*;
import java.util.Map.*;
import java.util.Map.Entry;
class ListGraph{
private HashMap<Stad,List<ListEdge>> nodes =
new HashMap<Stad,List<ListEdge>>();
public void addNode(Stad ny){
nodes.put(ny, new ArrayList<ListEdge>());
}
public void connect(Stad from, Stad to, String n, int v){
List<ListEdge> fromList = nodes.get(from);
List<ListEdge> toList = nodes.get(to);
ListEdge e1 = new ListEdge(to, n, v);
fromList.add(e1);
ListEdge e2 = new ListEdge(from, n, v);
toList.add(e2);
}
public String toString(){
String ret = "";
for(Map.Entry<Stad,List<ListEdge>> me : nodes.entrySet())
ret += me.getKey()+": "+me.getValue()+"\n";
return ret;
}
}