Documentation
¶
Overview ¶
Package queue implements a FIFO (first in first out) data structure supporting arbitrary types (even a mixture).
Internally it uses a dynamically growing circular slice of blocks, resulting in faster resizes than a simple dynamic array/slice would allow.
Example (Usage) ¶
Simple usage example that inserts the numbers 0, 1, 2 into a queue and then removes them one by one, printing them to the standard output.
package main
import (
"fmt"
"github.com/project-iris/iris/container/queue"
)
func main() {
// Create a queue an push some data in
q := queue.New()
for i := 0; i < 3; i++ {
q.Push(i)
}
// Pop out the queue contents and display them
for !q.Empty() {
fmt.Println(q.Pop())
}
}
Output: 0 1 2
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
First in, first out data structure.
func (*Queue) Front ¶
func (q *Queue) Front() interface{}
Returns the first element in the queue. Note, no bounds checking are done.
func (*Queue) Pop ¶
func (q *Queue) Pop() (res interface{})
Pops out an element from the queue. Note, no bounds checking are done.
Click to show internal directories.
Click to hide internal directories.