-
Notifications
You must be signed in to change notification settings - Fork 0
/
queuer.go
33 lines (24 loc) · 880 Bytes
/
queuer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package queue
type Queuer[T any] interface {
/* Sets the equality comparer to the given function */
SetEqualityComparer(equals func(*T, *T) bool)
/* Returns the size of the queue */
Size() int
/* Returns true if the queue is empty. Otherwise, false */
Empty() bool
/* Pushes the given value to the back of the queue */
Enqueue(element T)
/* Removes the element at the front of the queue. Panics if the queue is empty */
Dequeue()
/*
Returns a reference to the element at the front of the queue without removing it. Panics if the queue
is empty
*/
Peek() *T
/* Returns true if the given value is found in the queue. Otherwise, false */
Contains(element T) bool
/* Empties the queue. Operations performed depends on the implementation */
Clear()
/* Iterates through each element in the queue and executes the given function */
ForEach(do func(*T))
}