TwoClocks
09/02/2020, 5:26 AMforEach{}
over it? Does it explode, or what?Bapi Das
09/02/2020, 6:04 AMforEach{}
it will Concurrent method exception. So use Iterator for do that type of work.ephemient
09/02/2020, 6:34 AMMutableList.listIterator()
returns a MutableListIterator
ephemient
09/02/2020, 6:35 AMephemient
09/02/2020, 6:37 AMephemient
09/02/2020, 6:38 AM.iterator()
also works in the above example, returning a MutableIterator
, but MutableListIterator
has some additional methods such as .add()
and .set()
)Ashish Kumar Joy
09/02/2020, 6:42 AMTwoClocks
09/02/2020, 7:26 AMTwoClocks
09/02/2020, 7:27 AMforEach
loop. they just don't want to be called again. but they figure that out while they are being dispatched too.TwoClocks
09/02/2020, 7:29 AMTwoClocks
09/02/2020, 7:31 AMnkiesel
09/02/2020, 7:49 AMlist.removeAll { it.dont_call_me_again }
)