-
Notifications
You must be signed in to change notification settings - Fork 4
Simple FIFO queue for golang
License
yasushi-saito/fifo_queue
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
fifo_queue.Queue is a simple FIFO queue. It supports pushing an item at the end, and popping an item from the front. It is implemented as a single-linked list of arrays of items. INSTALLATION go get github.com/yasushi-saito/fifo_queue EXAMPLE: import "github.com/yasushi-saito/fifo_queue" q := fifo_queue.NewQueue() q.PushBack("foo") q.PushBack("bar") item := q.PopFront().(string) // "foo" item = q.PopFront().(string) // "bar" TYPES type Item interface{} type Queue struct { // contains filtered or unexported fields } func NewQueue() *Queue Create a new empty FIFO queue func (q *Queue) Len() int Return the number of items in the queue func (q *Queue) PopFront() Item Remove the item at the head of the queue and return it. REQUIRES: q.Len() > 0 func (q *Queue) PushBack(item Item) Add an item to the end of the queue
About
Simple FIFO queue for golang
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published