Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LinkedListQueue ¶
type LinkedListQueue[T any] struct { // contains filtered or unexported fields }
func (*LinkedListQueue[T]) Dequeue ¶
func (q *LinkedListQueue[T]) Dequeue() optionals.Optional[T]
func (*LinkedListQueue[T]) Enqueue ¶
func (q *LinkedListQueue[T]) Enqueue(v T)
func (*LinkedListQueue[T]) ForEach ¶
func (q *LinkedListQueue[T]) ForEach(f func(T))
func (*LinkedListQueue[T]) IsEmpty ¶
func (q *LinkedListQueue[T]) IsEmpty() bool
func (*LinkedListQueue[T]) Peek ¶
func (q *LinkedListQueue[T]) Peek() optionals.Optional[T]
func (*LinkedListQueue[T]) Size ¶
func (q *LinkedListQueue[T]) Size() int
type Queue ¶
type Queue[T any] interface { // Adds an element to the back of the queue. Enqueue(T) // Removes and returns an element from the front of the queue. // Returns None if the queue is empty. Dequeue() optionals.Optional[T] // Returns (but does not remove) an element from the front of the // queue. Returns None if the queue is empty. Peek() optionals.Optional[T] // Returns true if the queue is empty. IsEmpty() bool // Returns the length of the queue. Size() int // Calls the given function with each element in the queue, from // front to back. ForEach(func(T)) }
A FIFO queue.
func NewLinkedListQueue ¶
Click to show internal directories.
Click to hide internal directories.