2 ms·
> Java collections don’t have a type representing an ordered sequence of elements, Java 21 fills this gap by introducing the SequencedCollection, SequencedSet a
by theandrewbailey 3y ago
> Java collections don’t have a type representing an ordered sequence of elements, Java 21 fills this gap by introducing the SequencedCollection, SequencedSet and SequencedMap interfaces. These interfaces provide methods for adding, modifying or deleting elements at the beginning or end of the collection, as well as for iterating over a collection in reverse order.
That sounds like a deque, and it's been in Java for a long time. (No set or map implementations though.)
https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/util/Deque.html https://docs.oracle.com/en/java/javase/18/docs/api/java.base...
- deleted 3y ago[deleted]
- joaonmatos 3y agoSome of the methods were explicitly lifted out of the Deque into this interface. Basically the aim of the new interface is to provide an unified experience and standard methods to all the collections that can feasibly support it.