Skip to content

VadimIpatov/gcircularqueue

 
 

Repository files navigation

gcircularqueue is Circular Queue in Golang

Install

go get github.com/vadimipatov/gcircularqueue

Usage

This package is a typical circular with interfaces as following:

New

Normal queue

queue := gcircularqueue.NewCircularQueue(size int)

Thread-safe queue via sync.RWMutex

queue := gcircularqueue.NewCircularQueueThreadSafe(size int)

IsEmpty/IsFull

isEmpty := queue.IsEmpty()
isFull := queue.IsFull()

Push

queue.Push("kitty")
// note: it will panic if pushing a thing into a full queue

Shift

element := queue.Shift()
// note: `element will be nil when shifting from a empty queue

TODO

  • Update this README
  • Add methods Len and Elements to the threadsafe implementation
  • Update tests

About

Circular Queue in Golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%