in JAVA by
Q:
Write code to remove elements from ArrayList while iterating?

1 Answer

0 votes
by

 Key here is to check whether candidate uses ArrayList's remove() or Iterator's remove(). Here is the sample code which uses right way o remove elements from ArrayList while looping over and avoids ConcurrentModificationException.

Related questions

0 votes
asked Oct 24, 2020 in JAVA by sharadyadav1986
0 votes
asked Jan 24, 2020 in JAVA by rahuljain1
0 votes
asked Jan 27, 2020 in JAVA by rahuljain1
...