title: IndexOutOfBoundException while adding in queueList
body: <pre><code>private void removeQueue(Queue queue)
      {
          queue.setTodoDeleted(false);
          if ( queueIndex != -1) {
              this.queueList.add(queueIndex , queue);
              mItemManger.closeAllItems();
          }
      }
  </code></pre>
  
  <p>where queueList is ArrayList of <code>queue</code> ArrayList <code>queuelist</code>.</p>
  
  <p><strong>Problem</strong> : Index is 2 and list size is 1 while adding in the queueList so, <code>IndexOutOfBoundException</code> throws at Line<br>
  <code>this.queueList.add(queueIndex , queue)</code>.</p>
  
  <p>What is the best way to avoid this? In Advanced, thanks</p>