title: Synchronized List/Map in Java if only one thread is writing to it
body: <p>The first thread is filling a collection continuously with objects. A second thread needs to iterate over these objects, but it will not change the collection.</p>
  
  <p>Currently I use <code>Collection.synchronized</code> for making it thread-safe, but is there a fast way to doing it?</p>
  
  <h2>Update</h2>
  
  <p>It's simple: The first thread (ui) continuously writes the mouse position to the ArrayList, as long as the mousebutton is pressed down. The second thread (render) draws a line based on the list.</p>