MCPcopy Index your code
hub / github.com/eapache/queue / Add

Method Add

queue.go:50–59  ·  view source on GitHub ↗

Add puts an element on the end of the queue.

(elem interface{})

Source from the content-addressed store, hash-verified

48
49// Add puts an element on the end of the queue.
50func (q *Queue) Add(elem interface{}) {
51 if q.count == len(q.buf) {
52 q.resize()
53 }
54
55 q.buf[q.tail] = elem
56 // bitwise modulus
57 q.tail = (q.tail + 1) & (len(q.buf) - 1)
58 q.count++
59}
60
61// Peek returns the element at the head of the queue. This call panics
62// if the queue is empty.

Callers 11

TestQueueSimpleFunction · 0.80
TestQueueWrappingFunction · 0.80
TestQueueLengthFunction · 0.80
TestQueueGetFunction · 0.80
TestQueueGetNegativeFunction · 0.80
BenchmarkQueueSerialFunction · 0.80
BenchmarkQueueGetFunction · 0.80
BenchmarkQueueTickTockFunction · 0.80

Calls 1

resizeMethod · 0.95

Tested by 11

TestQueueSimpleFunction · 0.64
TestQueueWrappingFunction · 0.64
TestQueueLengthFunction · 0.64
TestQueueGetFunction · 0.64
TestQueueGetNegativeFunction · 0.64
BenchmarkQueueSerialFunction · 0.64
BenchmarkQueueGetFunction · 0.64
BenchmarkQueueTickTockFunction · 0.64