title: How to modify subList without ConcurrentModificationException?
body: <p>I have a little problem with <code>ListIterator</code>.</p>
  
  <p>I have started iterate original list <code>[1, 4, 5]</code>, I am between <code>1</code> and <code>4</code>. Then I modify list to the <code>[1, 2, 3, 4, 5]</code>. Now I would like to iterate rest of the original list. Here I give an example code:</p>
  
  <pre><code>public class Test {
      public static void main(String[] args) {        
          List&lt;Integer&gt; list = new LinkedList&lt;Integer&gt;();  // []
          list.add(new Integer(1));  // [1]
          list.add(new Integer(4));  // [1, 4]
          list.add(new Integer(5));  // [1, 4, 5]
          ListIterator&lt;Integer&gt; iterator = (ListIterator&lt;Integer&gt;) list.iterator();
  
          System.out.println(iterator.next()); // prints [1]
  
          // modify subList
          List&lt;Integer&gt; subList = list.subList(0, 2);    // [1, 4]
          subList.add(1, new Integer(2));    // [1, 2, 4]
          subList.add(2, new Integer(3));    // [1, 2, 3, 4]
  
          // need to print rest of oryginal list: [4, 5]
          while (iterator.hasNext())
              System.out.println(iterator.next());
      }
  }
  </code></pre>
  
  <p>When I'm executing it I have got java.util.ConcurrentModificationException. Do you have any idea how can I do it correctly?</p>