Queue of generics
OperationsCode 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();
Default constructor
New()
Adds a value to the back of the queue
method : public : AddBack(value:H) ~ Nil
Name | Type | Description |
---|---|---|
value | H | value to add |
Adds a value to the front of the queue
method : public : AddFront(value:H) ~ Nil
Name | Type | Description |
---|---|---|
value | H | value to add |
Get the value from the back of the queue
method : public : Back() ~ H
Type | Description |
---|---|
H | head value, Nil if queue is empty |
Clears the queue
method : public : Empty() ~ Nil
Get the value from the front of the queue
method : public : Front() ~ H
Type | Description |
---|---|
H | head value, Nil if queue is empty |
Checks to see if the queue is empty
method : public : IsEmpty() ~ Bool
Type | Description |
---|---|
Bool | true if empty, false otherwise |
Removes a value from the back of the queue
method : public : RemoveBack() ~ H
Type | Description |
---|---|
H | value removed |
Removes a value from the front of the queue
method : public : RemoveFront() ~ H
Type | Description |
---|---|
H | value removed |
Size of queue
method : public : Size() ~ Int
Type | Description |
---|---|
Int | size of queue |
Converts the queue into an object array
method : public : ToArray() ~ H[]
Type | Description |
---|---|
H | object array |