iterate through hashtable java
//create hash table
HashTable<String , int> ht = new HashTable<>();
ht.put("first",1);
ht.put("second",2);
//create a set holding all keys in the hashtable
Set<String> keys = ht.keySet();
//iterate through with a for loop
for(String key : keys) {
System.out.println(ht.get(key));
}
//OUTPUT
// 1
// 2
Also in Java:
- how to read in a file in java
- how add strings together
- how to minimize jframe in java
- java long to int
- how to initiate a queue in java
- how to end a program in an if statement java
- enum with numbers java
- java unique id
- capitalize string java
- convert from integer to character java
- java how to call getReader twice
- java file class
- how to know if String is the same java
- from file to array java
- java insert element at position
- sending a excel in an attachment in email java
- java how to define a function
- dictionary in java
- java android development get element by id
- Write a JAVA method that expands a given binomial (ax + by)n, where integers a, b, n are user inputs. For example, if a = 2, b = -12, n = 4 are entered the method should print or return
- string replace java
- how timer class and display to jtextfield w3schools in java
- java define custom exception
- dates in java 8