title: Does a synchronized block prevent other thread access to object?
body: <p>If I do something to a list inside a synchronized block, does it prevent other threads from accessing that list elsewhere?</p>
  
  <pre><code>List&lt;String&gt; myList = new ArrayList&lt;String&gt;();
  
  synchronized {
    mylist.add("Hello");
  }
  </code></pre>
  
  <p>Does this prevent other threads from iterating over <code>myList</code> and removing/adding values?</p>
  
  <p>I'm looking to add/remove values from a list, but at the same time protect it from other threads/methods from iterating over it (as the values in the list might be invalidated)</p>