Queue
Queue of generics
# 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();
Operations
AddBack
Adds a value to the back of the queue
method : public : AddBack(value:H) ~ Nil
Parameters
Name | Type | Description |
---|---|---|
value | H | value to add |
AddFront
Adds a value to the front of the queue
method : public : AddFront(value:H) ~ Nil
Parameters
Name | Type | Description |
---|---|---|
value | H | value to add |
Back
Get the value from the back of the queue
method : public : Back() ~ H
Return
Type | Description |
---|---|
H | head value, Nil if queue is empty |
Front
Get the value from the front of the queue
method : public : Front() ~ H
Return
Type | Description |
---|---|
H | head value, Nil if queue is empty |
IsEmpty
Checks to see if the queue is empty
method : public : IsEmpty() ~ Bool
Return
Type | Description |
---|---|
Bool | true if empty, false otherwise |
RemoveBack
Removes a value from the back of the queue
method : public : RemoveBack() ~ H
Return
Type | Description |
---|---|
H | value removed |