J.IV · Java 25 practice question

According to JEP 431, what defines a sequenced collection?

Choose one answer
Check answer and explanation

Correct answer: A Collection with a defined encounter order, having first and last elements with successors and predecessors between them.

Explanation

JEP 431 defines a sequenced collection as a Collection whose elements have a defined encounter order, with first and last elements and successors and predecessors between them.

Common trap

Sorted collections like TreeSet are sequenced, but insertion-ordered collections like ArrayList and LinkedHashSet are also sequenced without being sorted. Random access by index is not required; LinkedList, ArrayDeque, and LinkedHashSet are sequenced collections without index-based random access.

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

Report an error in this question