Deque
Parameters
Type the values held by this Deque instance.
Initial capacity of the internal data container backing the created deque.
Up to this many values may be added to the deque before the internal data container needs to be resized and reallocated.
Internal storage reallocation scale factor.
If/when this Deque determines it needs to resize its internal data container to hold additional values being pushed, the internal data container will be resized at a rate of capacity * scaleFactor
.
If the scale factor returns a value that is equal to or less than the current capacity, the resize will fall back to a size of capacity + 1
.
Default: 1.5
Maximum size this deque can grow to.
If adding a value to this Deque would push the size or capacity of the deque to be greater than maxSize then an exception will be thrown.
Default: 2,147,483,647
(Int.MAX_VALUE)
Constructors
Types
Functions
Tests whether this deque is currently at capacity, or in other words is the number of items in this deque equal to the size of the underlying data container.
Ensures that this deque has at least the given capacity allocated.
Returns true if this deque contains one or more items.
Returns an iterator over the elements in this deque.
Calls the given function with each item in this deque and its index.
Returns the first item in this deque if it is not empty, otherwise returns the given value.
Returns the first item in this deque if it is not empty, otherwise returns the value returned by the given function.
Returns the first item in this deque if it is not empty, otherwise returns null
.
Returns the first item in this deque if it is not empty, otherwise returns the value returned by the given function.
Returns the last item in this deque if it is not empty, otherwise returns the given value.
Returns the last item in this deque if it is not empty, otherwise returns the value returned by the given function.
Returns the last item in this deque if it is not empty, otherwise returns null
.
Returns the last item in this deque if it is not empty, otherwise returns the value returned by the given function.
Removes each item off of this deque one at a time and calls the given function with each removed item along with the index of that item in the deque.
Removes and returns the first item in this deque or returns value if this deque is empty.
Removes and returns the first item in this deque or returns the value returned by fn if this deque is empty.
Removes and returns the first item in this deque or returns null
if this deque is empty.
Removes the first item from this deque and returns it.
Removes and returns the last item in this deque or returns the value returned by fn if this deque is empty.
Removes and returns the last item in this deque or returns null
if this deque is empty.
Removes the last item from this deque and returns it.
Returns an iterator over the elements in this deque in reverse, starting from the last element and ending with the first.