github.com/getgauge/gauge@v1.6.9/gauge/ItemQueue.go (about) 1 /*---------------------------------------------------------------- 2 * Copyright (c) ThoughtWorks, Inc. 3 * Licensed under the Apache License, Version 2.0 4 * See LICENSE in the project root for license information. 5 *----------------------------------------------------------------*/ 6 7 package gauge 8 9 type ItemQueue struct { 10 Items []Item 11 } 12 13 func (queue *ItemQueue) Next() Item { 14 if len(queue.Items) > 0 { 15 next := queue.Items[0] 16 queue.Items = queue.Items[1:] 17 return next 18 } 19 return nil 20 } 21 22 func (queue *ItemQueue) Peek() Item { 23 if len(queue.Items) > 0 { 24 return queue.Items[0] 25 } 26 return nil 27 }