Hacker News new | ask | show | jobs
by free 5422 days ago
Ideally, whatever your key/value is would have the toString method over ridden to meaningfully represent it. Alternatively, I could write it as

for(Map.Entry<K, V> entry : map.entrySet()){

     System.out.println(entry.getKey());

     System.out.println(entry.getValue());

}