Skip to content
Sharp

Collections · interview question

When iterating a Map with entrySet(), which entry method allows modification of a value?

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

Correct answer

A. SetValue()

Why

The setValue() method allows updating the value of a Map entry, enabling modifications during iteration without removing the entry.

Test yourself on Collections

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

Start free test
All Collections questions →