One of the new interfaces for collections introduced in java 21 is the SequencedSet interface which is used for Set implementations whose elements follow a defined order (For example, LinkedHashSet is a SequencedSet).
Considering *ArraySet classes also have strictly defined ordering of their elements due to being array backed, they should implement SequencedSet in java 21 and above.
Yep but we're still at Java 9. NavigableSet world be a better candidate. Also, ArrayMap does not guarantee any iteration order (try to delete an element).
One of the new interfaces for collections introduced in java 21 is the
SequencedSet
interface which is used forSet
implementations whose elements follow a defined order (For example,LinkedHashSet
is aSequencedSet
).Considering
*ArraySet
classes also have strictly defined ordering of their elements due to being array backed, they should implementSequencedSet
in java 21 and above.