+= notation
Andrew Gillis
7 years ago
70 | 70 |
func (q *Queue) Get(i int) interface{} {
|
71 | 71 |
// If indexing backwards, convert to positive index.
|
72 | 72 |
if i < 0 {
|
73 | |
i = q.count + i
|
|
73 |
i += q.count
|
74 | 74 |
}
|
75 | 75 |
if i < 0 || i >= q.count {
|
76 | 76 |
panic("queue: Get() called with index out of range")
|