for (Map.Entry e : map.entrySet())
{
T key = e.getKey();
U value = e.getValue();
.
.
.
}
In addition, if you use a LinkedHashMap as the implementation, you'll iterate in the order the key/value pairs were inserted. If that's not important, use a HashMap.