Map map = new HashMap(); map["foo"] = 5; // or: map.put("foo", 5) map["bar"] = 10; map["baz"] = 15; map["foo"] = 6; // replaces previous value of 5