J.IV · Java 25 practice question

How did JEP 431 retrofit SequencedCollection, SequencedSet, and SequencedMap into the existing Java collections hierarchy without breaking existing custom implementations?

Choose one answer
Check answer and explanation

Correct answer: Every new method declared in the sequenced interfaces provides a default implementation.

Explanation

JEP 431 gives all newly declared methods in the sequenced collection interfaces default implementations so existing subclasses continue to compile and work.

Common trap

The sequenced interfaces declare concrete operations such as reversed(), getFirst(), and getLast(), so they are not marker interfaces. Java has no @Sequenced annotation for opting into interface retrofitting.

Source: JEP 431: Sequenced Collections — Description
Checked against the cited text on 2026-11-25.

Report an error in this question