I couldn't get your example to compile.
but here is mine. seems to work fine:
import java.util.*;
public class testmap {
public static void main(String[] args) {
HashMap<String,Integer> testmap=new HashMap<String,Integer>();
testmap.put("Billy", 500);
testmap.put("Jerry",400);
testmap.put("Lisa", 40);
testmap.put("Jennifer", 80);
Set<Entry<String, Integer>> grabset = testmap.entrySet();
Iterator<Map.Entry<String,Integer>> i = grabset.iterator();
while (i.hasNext()){
Map.Entry<String,Integer> me = (Map.Entry<String,Integer>)i.next();
System.out.println (((String)me.getKey()).length());
}
}
}