A Deque<T> is a double-ended queue that allows efficient insertion and removal
at both ends. It's implemented as a doubly-linked list, making it ideal for
situations where you need to add or remove elements from either end in constant time.
Deque also implements the Iterable interface, so you can use it in a for...of loop.
A
Deque<T>
is a double-ended queue that allows efficient insertion and removal at both ends. It's implemented as a doubly-linked list, making it ideal for situations where you need to add or remove elements from either end in constant time.Deque
also implements theIterable
interface, so you can use it in afor...of
loop.Examples