What is the most straightforward way to create a hash table (or associative array...) in Java? My google-fu has turned up a couple examples, but is there a standard way to do t
Also don't forget that both Map and Hashtable are generic in Java 5 and up (as in any other class in the Collections framework).
Map numbers = new HashMap(); numbers.put("one", 1); numbers.put("two", 2); numbers.put("three", 3); Integer one = numbers.get("one"); Assert.assertEquals(1, one);