generic

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2021 License: GPL-3.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hashable

type Hashable interface {
	Hash() interface{}
}

Hashable object. The hash can be used for cache.

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

Queue is a simple queue with unique items.

func NewQueue

func NewQueue() Queue

NewQueue create a new Queue.

func (*Queue) Empty

func (q *Queue) Empty() bool

Empty or not?

func (*Queue) Pull

func (q *Queue) Pull() Hashable

Pull an item from the Queue.

func (*Queue) Push

func (q *Queue) Push(items ...Hashable)

Push items into the queue. The queue contains only unique items.

func (*Queue) Size

func (q *Queue) Size() int

Size of the queue.

type Stack added in v1.0.5

type Stack struct {
	// contains filtered or unexported fields
}

Stack is a basic stack.

func NewStack added in v1.0.5

func NewStack() Stack

NewStack creates a new empty stack.

func (*Stack) IsEmpty added in v1.0.5

func (s *Stack) IsEmpty() bool

IsEmpty tells if the stack is empty or not.

func (*Stack) Peek added in v1.0.5

func (s *Stack) Peek() interface{}

Peek the top item.

func (*Stack) Pop added in v1.0.5

func (s *Stack) Pop() interface{}

Pop the top item.

func (*Stack) Push added in v1.0.5

func (s *Stack) Push(item interface{})

Push an item onto the stack.

func (*Stack) Size added in v1.0.5

func (s *Stack) Size() int

Size of the stack.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL