mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-22 15:53:50 +08:00
Add the chapter of hash map.
This commit is contained in:
@ -91,4 +91,16 @@ public class PrintUtil {
|
||||
showTrunks(p.prev);
|
||||
System.out.print(p.str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a hash map
|
||||
* @param <K>
|
||||
* @param <V>
|
||||
* @param map
|
||||
*/
|
||||
public static <K, V> void printHashMap(Map<K, V> map) {
|
||||
for (Map.Entry <K, V> kv: map.entrySet()) {
|
||||
System.out.println(kv.getKey() + " -> " + kv.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user