Hello, Im using a hashmap to map a counter to certain names. What i want now it print all tag names with assigned values, yet this code print the right value but not the tagname itself but the pointer to the name.
Code (simplified):
HashMap hm = new HashMap();
hm.add ("A", new Integer(1));
hm.add ("B", new Integer(2));
hm.add ("C", new Integer(3));
Set set = hm.keySet();
Iterator iter = set.iterator();
while (iter.hasNext()){
temp1 = hm.get(iter.next()).toString();
temp2 = iter.getValue().toString();
System.out.println(temp1 + " = " + temp2);
}
Bookmarks