Debian Codegraph @

examples/linkedlistqueue/linkedlistqueue.go

raw symbols SCIP
1 // Copyright (c) 2015, Emir Pasic. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package main
6
7 import llq "github.com/emirpasic/gods/v2/queues/linkedlistqueue"
8
9 // LinkedListQueueExample to demonstrate basic usage of LinkedListQueue
10 func main() {
11 queue := llq.New[int]() // empty
12 queue.Enqueue(1) // 1
13 queue.Enqueue(2) // 1, 2
14 _ = queue.Values() // 1, 2 (FIFO order)
15 _, _ = queue.Peek() // 1,true
16 _, _ = queue.Dequeue() // 1, true
17 _, _ = queue.Dequeue() // 2, true
18 _, _ = queue.Dequeue() // nil, false (nothing to deque)
19 queue.Enqueue(1) // 1
20 queue.Clear() // empty
21 queue.Empty() // true
22 _ = queue.Size() // 0
23 }