Skip to content
Sharp

Collections · interview question

Given a List<String> catalog, which method call on an Iterator<String> allows safe removal of an item during iteration?

Multiple choiceHardchapter-4-curatedpremiumcollectionsiteration-and-traversal
Choose one answer
Answer and explanation

Correct answer

D. Remove()

Why

The remove() method of an Iterator allows you to safely remove the last element returned by the iterator without causing a ConcurrentModificationException.

Test yourself on Collections

A free test with instant, explained results. No account needed.

Start free test
All Collections questions →