Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
38 lines (29 loc) · 1.07 KB

File metadata and controls

38 lines (29 loc) · 1.07 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
34
35
36
37
38
package queue
// A Queue is an ordered sequence of items, the order is usually first in first out.
// New items are added to the back of the queue and
// existing items are removed from the front of the queue.
//
// This interface provides basic methods for adding and extracting elements
// from the queue.
// Items are extracted from the head of the queue and added to the tail
// of the queue.
type Queue[T comparable] interface {
// Get retrieves and removes the head of the queue.
Get() (T, error)
// Offer inserts the element to the tail of the queue.
Offer(elem T) error
// Reset sets the queue to its initial state.
Reset()
// Contains returns true if the queue contains the element.
Contains(elem T) bool
// Peek retrieves but does not remove the head of the queue.
Peek() (T, error)
// Size returns the number of elements in the queue.
Size() int
// IsEmpty returns true if the queue is empty.
IsEmpty() bool
// Iterator returns a channel that will be filled with the elements
Iterator() <-chan T
// Clear removes all elements from the queue.
Clear() []T
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.