Documentation ¶
Overview ¶
Package queue implements a double-ended queue (aka "deque") data structure on top of a slice. All operations run in (amortized) constant time. Benchmarks compare favorably to container/list as well as to Go's channels. These queues are not safe for concurrent use.
Index ¶
- type Queue
- func (q *Queue) Back() interface{}
- func (q *Queue) Front() interface{}
- func (q *Queue) Init() *Queue
- func (q *Queue) Len() int
- func (q *Queue) PopBack() interface{}
- func (q *Queue) PopFront() interface{}
- func (q *Queue) PushBack(v interface{})
- func (q *Queue) PushFront(v interface{})
- func (q *Queue) String() string
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
}
Queue represents a double-ended queue. The zero value is an empty queue ready to use.
func (*Queue) Back ¶
func (q *Queue) Back() interface{}
Back returns the last element of queue q or nil.
func (*Queue) Front ¶
func (q *Queue) Front() interface{}
Front returns the first element of queue q or nil.
func (*Queue) PopBack ¶
func (q *Queue) PopBack() interface{}
PopBack removes and returns the last element of queue q or nil.
func (*Queue) PopFront ¶
func (q *Queue) PopFront() interface{}
PopFront removes and returns the first element of queue q or nil.
func (*Queue) PushBack ¶
func (q *Queue) PushBack(v interface{})
PushBack inserts a new value v at the back of queue q.