title: Best way to prevent concurrent modification exception
body: <p>Here is some pseudo code as follows.</p>
  
  <pre><code>public class MyObject
  {   
      private List&lt;Object&gt; someStuff;
      private Timer timer;
  
      public MyObject()
      {
          someStuff = new ArrayList&lt;Object&gt;();
  
          timer = new Timer(new TimerTask(){
  
              public void run()
              {
                  for(Object o : someStuff)
                  {
                      //do some more stuff involving add and removes possibly
                  }
              }
          }, 0, 60*1000);
      }
  
      public List&lt;Object&gt; getSomeStuff()
      {
          return this.someStuff;
      }
  }
  </code></pre>
  
  <p>So essentially the problem is that other objects not listed in the code above call getSomeStuff() to get the list for read-only purposes. I am getting concurrentmodificationexception in the timer thread when this occurs. I tried making the getSomeStuff method synchronized, and even tried synchronized blocks in the timer thread, but still kept getting the error. What is the easiest method of stopping concurrent access of the list?</p>