Ver Fonte

+= notation

Andrew Gillis há 9 anos atrás
pai
commit
04e142afea
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      queue.go

+ 1 - 1
queue.go

@@ -71,7 +71,7 @@ func (q *Queue) Peek() interface{} {
 func (q *Queue) Get(i int) interface{} {
 	// If indexing backwards, convert to positive index.
 	if i < 0 {
-		i = q.count + i
+		i += q.count
 	}
 	if i < 0 || i >= q.count {
 		panic("queue: Get() called with index out of range")