 <p>Reflection API allows one to manipulate/access data that is not accessable otherwise - or some data on the class that is unknown at compile time.</p> <p>In here, it is really not needed. All you need is to <code>put()</code> the element into the map, it will "remove" the old value from the key you just inserted (if it is already there) and associate it (the key) with the newly added value.</p> <p>So, basically - all you need to do is <code>myMap.put(key,newValue)</code>, and the implementation of the <code>Map</code> (assuming it is a correct one, of course) will take care of the rest.</p> <hr> <p>If you want to store the data between runs of the program - you will have to save it (the map) on disk. In order to do so, you can use <a href="http://en.wikipedia.org/wiki/Serialization#Java" rel="nofollow">serialization</a>, or if you can use <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Properties.html" rel="nofollow"><code>Properties</code></a> in some cases. <br>Make sure that you load the map from disk once the program starts, or you will not see the values you stored.</p>