Monkey Documentation

Class Deque<T>

A deque is a 'double ended queue'. More...


Extended by:
Constructors:
Properties:
Methods:

Detailed Discussion

A deque is a 'double ended queue'.

It is similar to a stack, only items can be pushed and popped to and from either end of the stack.

This means it can be used as either a FIFO or LIFO/FILO queue.


Constructor Documentation

Method New ()

Creates a new empty deque.

Method New ( data:T[] )

Creates a new deque containing the elements of data.


Property Documentation

Method IsEmpty : Bool () Property

Returns true if the deque is empty.

Method Length : Int () Property

Returns the number of items in the deque.


Method Documentation

Method Clear : Void ()

Removes all items from the deque.

Method Get : T ( index:Int )

Returns an item at the given index from the deque.

The first item in the deck is at index 0, the last is at index Length-1.

If the deque is empty, a runtime error occurs.

Method ObjectEnumerator : Object ()

Returns an object enumerator for use with For Eachin loops.

Method PopFirst : T ()

Removes an item from the beginning of the deque.

If the deque is empty, a runtime error occurs.

Method PopLast : T ()

Removes an item from the end of the deque.

If the deque is empty, a runtime error occurs.

Method PushFirst : Void ( value:T )

Adds an item to the beginning of the deque.

Method PushLast : Void ( value:T )

Adds an item to the end of the deque.

Method Set : Void ( index:Int, value:T )

Sets an item at the given index.

The first item in the deck is at index 0, the last is at index Length-1.

If the deque is empty, a runtime error occurs.

Method ToArray : T[] ()

Converts the deque to an array.