title: Value in list is not updated by thread
body: <p>I tried to update value in a list by thread, <br/>
  but it does not working for me.
  <br/>Below is my code, please point what i am wrong.
  Thanks.</p>
  
  <pre><code>// List of Integer values
  public static volatile ArrayList&lt;Integer&gt; intList = new ArrayList&lt;Integer&gt;();
  
  public static void main(String... args) {
      intList.add(11);
  
      Thread thread1 = new Thread(new Runnable() {
          @Override
          public void run() {
              // Loop and increase value of a list of integer
              while (true) {
                  try {
                      Thread.sleep(500);
                  } catch (InterruptedException e) {
                      e.printStackTrace();
                  }
                  synchronized (this) {
                      for (Integer item : intList) {
                          System.out.print("thread 1: " + item);
                          item++; //increase value
                          System.out.print(" -&gt; " + item + "\n");
                      }
                  }
              }
          }
      });
      thread1.start();
  }
  </code></pre>
  
  <p>Output: <br/>
  <i>thread 1: 11 -> 12</i><br/>
  <i>thread 1: 11 -> 12</i><br/>
  <i>thread 1: 11 -> 12</i><br/>
  <i>thread 1: 11 -> 12</i><br/>
  <i>thread 1: 11 -> 12</i><br/>
  => value is not changed when the loop start, it still 11 every time of beginning of loop. <br/>
  What's wrong?</p>