We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 13f4380 commit b01bae0Copy full SHA for b01bae0
1 file changed
collections/hashmap/HashMapSize.java
@@ -0,0 +1,30 @@
1
+package com.zetcode;
2
+
3
+import java.util.HashMap;
4
+import java.util.Map;
5
6
+public class HashMapSize {
7
8
+ public static void main(String[] args) {
9
10
+ Map<String, String> capitals = new HashMap<>();
11
12
+ capitals.put("svk", "Bratislava");
13
+ capitals.put("ger", "Berlin");
14
+ capitals.put("hun", "Budapest");
15
+ capitals.put("czk", "Prague");
16
+ capitals.put("pol", "Warsaw");
17
+ capitals.put("ita", "Rome");
18
19
+ int size = capitals.size();
20
21
+ System.out.printf("The size of the HashMap is %d%n", size);
22
23
+ capitals.remove("pol");
24
+ capitals.remove("ita");
25
26
+ size = capitals.size();
27
28
29
+ }
30
+}
0 commit comments