title: Unexpected ArrayList size
body: <p>I have the following code,</p>
  <pre><code>if(scores.size() &lt;= 0) {
      scores.add(0, current);
      score1.setText(scores.get(0));
      Log.d(LOG_TAG, &quot;array = &quot; + scores.size());
  
  
  } else if(scores.size() &lt;= 1){
      scores.add(1, scores.get(0));
      scores.add(0, current);
      score1.setText(scores.get(0));
      score2.setText(scores.get(1));
      Log.d(LOG_TAG, &quot;array = &quot; + scores.size());
   } else if(scores.size() &lt;= 2) {
      scores.add(2, scores.get(1));
      scores.add(1, scores.get(0));
      scores.add(0, current);
      score1.setText(scores.get(0));
      score2.setText(scores.get(1));
      score3.setText(scores.get(2));
      Log.d(LOG_TAG, &quot;array = &quot; + scores.size());
  }
  </code></pre>
  <p><code>scores</code> is an <code>ArrayList</code> holding <code>String</code> values,
  <code>current</code> is a <code>String</code> value taken each time the button is pressed and is taken from the <code>EditText</code> box.</p>
  <p>On running the code, I would expect that the number of elements in the <code>ArrayList</code> to increase by 1. But Logcat shows the <code>ArrayList</code> size as 1 after the first button click, then 3 and then 7.</p>
  <p>What I expect to happen is the <code>ArrayList</code> increases by 1 each time, <code>ArrayList index 0</code> moves to <code>index 1</code> and the new value is put at <code>index 0</code></p>
  <p>I cant put my finger on what I am doing wrong.</p>