title: how to avoid ConcurrentModificationException kotlin
body: <p>I have a list of accounts, and when i make the long click, I want to remove the item from the arraylist. I'm trying to remove it from a alertdialog, but i'm getting the ConcurrentModificationException. This is where is crashing:</p>
  
  <pre class="lang-kotlin prettyprint-override"><code>listAccounts.forEachIndexed { index, account -&gt;
      if (idParamether == account.id) {
          listAccounts.remove(account)
      }
  }
  </code></pre>