Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

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;
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 12 2010
Added on Dec 15 2009
3 comments
2,898 views