Sequence optimized for add/removing items at the beginning or end.
The underlying implementation dynamically resizes.
Operation | Computational complexity |
---|---|
length | O(1) |
get/set | O(1) |
push/pop, unshift/shift | O(1) (amortized, due to dynamic sizing) |
insert/remove | O(n) |
Constructor
new (?maxSize:Int)
Returns a new empty Deque
.
Parameters:
maxSize | Optional maximum size of the collection. By default, the
sequence is unbounded. If |
---|
Static methods
staticfromCollection<T> (other:Collection<T>):Deque<T>
Returns a new Deque
from the given collection.