All Bundles

Queue<H>

Queue of generics

Operations

Code example:

# insert elements
queue := Collection.Queue->New()<String>;
queue->AddFront("San Francisco");
queue->AddBack("Oakland");
queue->AddBack("East Bay");
queue->AddBack("Mountain View");

# remove element
queue->RemoveBack();

# get size
queue->Size()->PrintLine();

# get value by key
queue->Back()->PrintLine();
queue->Front()->PrintLine();

New

Default constructor

New()

AddBack

Adds a value to the back of the queue

method : public : AddBack(value:H) ~ Nil
Parameters
NameTypeDescription
valueHvalue to add

AddFront

Adds a value to the front of the queue

method : public : AddFront(value:H) ~ Nil
Parameters
NameTypeDescription
valueHvalue to add

Back

Get the value from the back of the queue

method : public : Back() ~ H
Return
TypeDescription
Hhead value, Nil if queue is empty

Empty

Clears the queue

method : public : Empty() ~ Nil

Front

Get the value from the front of the queue

method : public : Front() ~ H
Return
TypeDescription
Hhead value, Nil if queue is empty

IsEmpty

Checks to see if the queue is empty

method : public : IsEmpty() ~ Bool
Return
TypeDescription
Booltrue if empty, false otherwise

RemoveBack

Removes a value from the back of the queue

method : public : RemoveBack() ~ H
Return
TypeDescription
Hvalue removed

RemoveFront

Removes a value from the front of the queue

method : public : RemoveFront() ~ H
Return
TypeDescription
Hvalue removed

Size

Size of queue

method : public : Size() ~ Int
Return
TypeDescription
Intsize of queue

ToArray

Converts the queue into an object array

method : public : ToArray() ~ H[]
Return
TypeDescription
Hobject array