queue

package
v0.0.0-...-9abe38d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2017 License: BSD-2-Clause Imports: 2 Imported by: 17

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

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 New

func New() *Queue

New returns an initialized empty queue.

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) Init

func (q *Queue) Init() *Queue

Init initializes or clears queue q.

func (*Queue) Len

func (q *Queue) Len() int

Len returns the number of elements of queue q.

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.

func (*Queue) PushFront

func (q *Queue) PushFront(v interface{})

PushFront inserts a new value v at the front of queue q.

func (*Queue) String

func (q *Queue) String() string

String returns a string representation of queue q formatted from front to back.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL