collection

package
v0.0.0-...-50176c9 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UniqueString

func UniqueString(slice []string) []string

去除数组中重复元素

Types

type IllegalArgumentError

type IllegalArgumentError struct {
	ErrorMessage string
}

func (*IllegalArgumentError) Error

func (e *IllegalArgumentError) Error() string

type Set

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

func NewSet

func NewSet(size int, values ...interface{}) *Set

func (*Set) Add

func (s *Set) Add(val interface{}) bool

add a value into set, if this set already has the value it will return false, else return true

func (*Set) Clear

func (s *Set) Clear() *Set

func (*Set) Contains

func (s *Set) Contains(val interface{}) bool

return true if this set contains the value, otherwise will return false

func (*Set) IsEmpty

func (s *Set) IsEmpty() bool

values len is 0 will return true otherwise will return false

func (*Set) Remove

func (s *Set) Remove(val interface{}) bool

if contains the value then delete the value and return ture otherwise will return false

func (Set) Size

func (s Set) Size() int

func (*Set) String

func (s *Set) String() string

func (*Set) Values

func (s *Set) Values() []interface{}

get values from the set

type Stack

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

func NewStack

func NewStack(size int) *Stack

create a new stack

func (*Stack) Clear

func (s *Stack) Clear() *Stack

clear the stack

func (*Stack) Elements

func (s *Stack) Elements() []interface{}

func (*Stack) IsEmpty

func (s *Stack) IsEmpty() bool

judge the stack if has elements return true if has no elements, otherwise return true

func (*Stack) Pop

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

pop a value from stack, if has value to pop, bool will is true, otherwise is false

func (*Stack) Push

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

push a value into stack

func (Stack) Size

func (s Stack) Size() int

Jump to

Keyboard shortcuts

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