What happens if two threads perform a get of one hashmap at the same time?
Location: http://www.jguru.com/faq/view.jsp?EID=1048741 Created: Jan 21, 2003 Author: Muruganantham Mani (http://www.jguru.com/guru/viewbio.jsp?EID=1041080) Question originally posed by Enrique Monton (http://www.jguru.com/guru/viewbio.jsp?EID=755656 [I know a HashMap object is not synchronized if not done explicitly, so in a case where you have to write and read data in a hashmap from different threads you need to synchronize it (or use another object). However in my case I am writing to the HashMap (put) only once and it is done at the beginnig. Once the HashMap is filled I am going to read it from different threads at the same time. Do I need to synchronize these reads?] Synchronization needs to be done only when there is a chance of changing the data from different threads simultaneously. In your case, it is simply going to be a read, the synchronization is not required. If you need to remove or modify the values in the hashmap, then you [may] need to synchronize that. For synchron