瀏覽代碼

+= notation

Andrew Gillis 9 年之前
父節點
當前提交
04e142afea
共有 1 個文件被更改,包括 1 次插入1 次删除
  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")