Peek returns the element at the head of the queue. This call panics if the queue is empty.
()
| 61 | // Peek returns the element at the head of the queue. This call panics |
| 62 | // if the queue is empty. |
| 63 | func (q *Queue) Peek() interface{} { |
| 64 | if q.count <= 0 { |
| 65 | panic("queue: Peek() called on empty queue") |
| 66 | } |
| 67 | return q.buf[q.head] |
| 68 | } |
| 69 | |
| 70 | // Get returns the element at index i in the queue. If the index is |
| 71 | // invalid, the call will panic. This method accepts both positive and |
no outgoing calls