shadow:utility

Class ArrayDeque<E>

Parent class

shadow:standard@Object

Interfaces

shadow:utility@Deque<E>

class ArrayDeque<E>

Class ArrayDeque<E> stores a double-ended queue (deque) of elements of type E, implemented with a dynamic array as internal storage. A deque can be used in place of a stack or queue. ArrayDeque<E> is optimized for adding and removing from both the front and the back of the deque but does not provide the arbitrary access to elements that a general list data structure would.

Create Summary

Modifiers Return Types Method and Description
public () create()

Destroy Summary

Modifiers Return Types Method and Description
public () destroy()

Method Summary

Modifiers Return Types Method and Description
public (ArrayDeque<E>) addFirst(E element)

Adds an element to the beginning of the deque.

public (ArrayDeque<E>) addLast(E element)

Adds an element to the end of the deque.

public (ArrayDeque<E>) clear()

Removes all elements from the deque.

public readonly (ArrayDeque<E>) copy(AddressMap addresses)
public readonly (E) getFirst()

Gets the element at the beginning of the deque.

public readonly (E) getLast()

Gets the element at the end of the deque.

public readonly (boolean) isEmpty()

Checks whether or not the deque is empty.

public readonly (Iterator<E>) iterator()

Creates an iterator to iterate over all the values in the deque.

public (E) removeFirst()

Removes the element at the beginning of the deque.

public (E) removeLast()

Removes the element from the end of the deque.

public readonly (String) toString()

Produces a String representation of the deque, listing all elements in order.

Property Summary

Modifiers Return Types Method and Description
public readonly get (int) size()
public readonly get locked (long) sizeLong()

Gets size of the deque.

Create Detail

create

public create() => ()

Destroy Detail

destroy

public destroy() => ()

Method Detail

addFirst

public addFirst(E element) => (ArrayDeque<E>)

Adds an element to the beginning of the deque. This operation is constant time in the best case and amortized constant time in the worst case, which occurs when deque storage is full and a linear-time array resize must be performed.

Parameters

element - element to be added

Returns

deque after the element is added

addLast

public addLast(E element) => (ArrayDeque<E>)

Adds an element to the end of the deque. This operation is constant time in the best case and amortized constant time in the worst case, which occurs when deque storage is full and a linear-time array resize must be performed.

Parameters

element - element to be added

Returns

deque after the element is added

clear

public clear() => (ArrayDeque<E>)

Removes all elements from the deque. This operation is constant time.

Returns

deque after being cleared

copy

public readonly copy(AddressMap addresses) => (ArrayDeque<E>)

getFirst

public readonly getFirst() => (E)

Gets the element at the beginning of the deque. This operation is constant time.

Returns

first element in the deque

Throws

NoSuchElementException - if the deque is empty

getLast

public readonly getLast() => (E)

Gets the element at the end of the deque. This operation is constant time.

Returns

last element in the deque

Throws

NoSuchElementException - if the deque is empty

isEmpty

public readonly isEmpty() => (boolean)

Checks whether or not the deque is empty.

Returns

true if the deque is empty

iterator

public readonly iterator() => (Iterator<E>)

Creates an iterator to iterate over all the values in the deque.

Returns

iterator

removeFirst

public removeFirst() => (E)

Removes the element at the beginning of the deque. This operation is constant time.

Returns

element being removed

Throws

NoSuchElementException - if the deque is empty

removeLast

public removeLast() => (E)

Removes the element from the end of the deque. This operation is constant time.

Returns

element being removed

Throws

NoSuchElementException - if the deque is empty

toString

public readonly toString() => (String)

Produces a String representation of the deque, listing all elements in order.

Returns

String representation

Property Detail

size

public readonly get size() => (int)

sizeLong

public readonly get locked sizeLong() => (long)

Gets size of the deque.