title: Android remove item from nested Arraylist given error Concurrent Modification Exception
body: <p>I am new in android. I want to remove item from Arraylist inside Arraylist. But when i removed particular item its given me an error 'ConcurrentModificationException'. So how can i handle it or if any other solution possible then please suggest me to solve this error. i am posting my code.</p>
  
  <p>My code is as follow,</p>
  
  <pre><code>for (Item cart : CartItems) {
                  if (cart.getIsSub_item() == false) {
                      for (Item list : sclList) {
                          CartItems.remove(list);
                      }
                  } else {
                      for (Item i : sclList.get(sub_position).getSub_items()) {
                          if (CartItems.contains(i)) {
                              CartItems.remove(i);
                          }
                      }
                  }
              }
  </code></pre>
  
  <p>Here is my logcat::</p>
  
  <pre><code>java.lang.RuntimeException: An error occured while executing doInBackground()
              at android.os.AsyncTask$3.done(AsyncTask.java:300)
              at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
              at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
              at java.util.concurrent.FutureTask.run(FutureTask.java:242)
              at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
              at java.lang.Thread.run(Thread.java:841)
       Caused by: java.util.ConcurrentModificationException
              at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:573)
              at com.njoyful.userapp.Fragments.OrderFragment$RemoveSubItem.doInBackground(OrderFragment.java:800)
              at com.njoyful.userapp.Fragments.OrderFragment$RemoveSubItem.doInBackground(OrderFragment.java:774)
              at android.os.AsyncTask$2.call(AsyncTask.java:288)
              at java.util.concurrent.FutureTask.run(FutureTask.java:237)
  </code></pre>
  
  <p>On first line, I am getting error. Thank you.</p>