0

Need help with hashtable

not understanding the get method public v get(k k)

3rd May 2017, 8:50 PM
Nita Lovablestar
Nita Lovablestar - avatar
3 ответов
+ 1
Hashtable<String, String> ht = new Hashtable<>(); ht.put("name", "John Doe"); ht.put("age", "18"); System.out.println(ht.get("name")); //prints "John Doe" System.out.println(ht.get("age")); //prints "18"
3rd May 2017, 8:58 PM
Jeth
Jeth - avatar
0
whats the difference between hashtable and hashmap
4th May 2017, 3:01 AM
Edward
0
Hashtable is synchronized, HashMap is not. Usually it is better to use HashMap because Hashtable considered as legacy class and less flexible when you deal with complex algorithms, also when you working with threads you likely will be use your own synchronization algorithms so use of Hashtable loses its meaning at all.
4th May 2017, 3:17 AM
Jeth
Jeth - avatar