1//create hash table
2HashTable<String , int> ht = new HashTable<>();
3ht.put("first",1);
4ht.put("second",2);
5
6//create a set holding all keys in the hashtable
7Set<String> keys = ht.keySet();
8
9//iterate through with a for loop
10for(String key : keys) {
11 System.out.println(ht.get(key));
12}
13
14//OUTPUT
15// 1
16// 2