go_collections

package module
v0.0.4-0...-997ecf9 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2020 License: MIT Imports: 1 Imported by: 0

README

go-collections

A Collections class in GoLang, similar to the Python Collections class.

Documentation

Index

Constants

View Source
const (
	MINFILL   float32 = 0.1
	MAXFILL   float32 = 0.9
	FILLRATIO float32 = 0.8
	MINCAP    int     = 10
)

Variables

This section is empty.

Functions

func Reverse

func Reverse(list []interface{})

func Shuffle

func Shuffle(list []interface{})

Types

type Set

type Set map[string]interface{}

func NewSet

func NewSet(list []string) *Set

func (*Set) Add

func (s *Set) Add(el string)

func (*Set) AddAll

func (s *Set) AddAll(el ...string)

func (Set) Contains

func (s Set) Contains(el string) bool

func (Set) Empty

func (s Set) Empty() bool

func (*Set) Merge

func (s *Set) Merge(other Set)

func (*Set) Remove

func (s *Set) Remove(el string)

func (Set) Size

func (s Set) Size() int

func (Set) ToArray

func (s Set) ToArray() []string

type SimpleList

type SimpleList []interface{}

func (SimpleList) Empty

func (s SimpleList) Empty() bool

func (SimpleList) Peek

func (s SimpleList) Peek() interface{}

func (SimpleList) PeekFront

func (s SimpleList) PeekFront() interface{}

func (*SimpleList) Pop

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

func (*SimpleList) PopFront

func (s *SimpleList) PopFront() interface{}

func (*SimpleList) Put

func (s *SimpleList) Put(i interface{})

func (SimpleList) Size

func (s SimpleList) Size() int

type Stack

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

func NewStack

func NewStack(slice []interface{}, opts ...StackOptionFunc) Stack

func (Stack) Empty

func (s Stack) Empty() bool

func (Stack) Peek

func (s Stack) Peek() interface{}

func (*Stack) Pop

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

func (*Stack) Put

func (s *Stack) Put(i interface{})

func (Stack) Size

func (s Stack) Size() int

type StackOptionFunc

type StackOptionFunc func(*Stack) error

func SetFillRatio

func SetFillRatio(p float32) StackOptionFunc

func SetMaxFillPrct

func SetMaxFillPrct(p float32) StackOptionFunc

func SetMinCapacity

func SetMinCapacity(cap int) StackOptionFunc

func SetMinFillPrct

func SetMinFillPrct(p float32) StackOptionFunc

Jump to

Keyboard shortcuts

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