I'm writing a program that makes extensive use of large HashMaps. It is multithreaded, so I've used read-write locks when accessing it. However, it has a special property that I'd like to exploit.
After data is "put" into the HashMap, that data is never changed. Ever. Whenever a change to the state of this data structure is made, it actually just creates a new "generation" of the structure, leaving the old one intact.
That is, is it safe to read a value from a HashMap at the same time that another thread is writing a value, knowing that the other thread will never be writing to the value you're reading? Is there some simple hashtable structure that will give me this sort of guarantee?