When debugging an idea, it is possible to substitute the values ​​of variables Evaluate -> set value, but can I change the collection (delete the collection item)?

I tried to remove

col.remove(col.iterator().next())

But something did not work

Method threw 'java.lang.UnsupportedOperationException' exception.

  • Try not col.remove, but iterator.remove - Limmy
  • Do you want to delete an item during debug? And this is done in the debug console? - Alexey Shimansky
  • I press alt + F8 and write there - cadmy
  • It does not work, the same mistake - cadmy
  • Well, in principle, you can col.remove(indexOfElement) only when it col.remove(indexOfElement) . If during a cycle, then there will be a ConcurrentModificationException anyway. - Alexey Shimansky

1 answer 1

enter image description here

I did it like this, i.e. This is possible in principle. (It also works with a regular iterator).