gset

package
v1.4.7 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package gset provides kinds of concurrent-safe(alternative) sets.

并发安全集合.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IntSet

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

func NewIntSet

func NewIntSet(unsafe ...bool) *IntSet

func (*IntSet) Add

func (set *IntSet) Add(item int) *IntSet

设置键

func (*IntSet) BatchAdd

func (set *IntSet) BatchAdd(items []int) *IntSet

批量添加设置键

func (*IntSet) Clear

func (set *IntSet) Clear()

清空set

func (*IntSet) Contains

func (set *IntSet) Contains(item int) bool

键是否存在

func (*IntSet) Iterator

func (set *IntSet) Iterator(f func(v int) bool)

给定回调函数对原始内容进行遍历,回调函数返回true表示继续遍历,否则停止遍历

func (*IntSet) LockFunc

func (set *IntSet) LockFunc(f func(m map[int]struct{}))

func (*IntSet) RLockFunc

func (set *IntSet) RLockFunc(f func(m map[int]struct{}))

func (*IntSet) Remove

func (set *IntSet) Remove(key int)

删除键值对

func (*IntSet) Size

func (set *IntSet) Size() int

大小

func (*IntSet) Slice

func (set *IntSet) Slice() []int

转换为数组

func (*IntSet) String

func (set *IntSet) String() string

转换为字符串

type InterfaceSet

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

func NewInterfaceSet

func NewInterfaceSet(unsafe ...bool) *InterfaceSet

func (*InterfaceSet) Add

func (set *InterfaceSet) Add(item interface{}) *InterfaceSet

添加

func (*InterfaceSet) BatchAdd

func (set *InterfaceSet) BatchAdd(items []interface{}) *InterfaceSet

批量添加

func (*InterfaceSet) Clear

func (set *InterfaceSet) Clear()

清空set

func (*InterfaceSet) Contains

func (set *InterfaceSet) Contains(item interface{}) bool

键是否存在

func (*InterfaceSet) Iterator

func (set *InterfaceSet) Iterator(f func(v interface{}) bool)

给定回调函数对原始内容进行遍历,回调函数返回true表示继续遍历,否则停止遍历

func (*InterfaceSet) LockFunc

func (set *InterfaceSet) LockFunc(f func(m map[interface{}]struct{}))

func (*InterfaceSet) RLockFunc

func (set *InterfaceSet) RLockFunc(f func(m map[interface{}]struct{}))

func (*InterfaceSet) Remove

func (set *InterfaceSet) Remove(key interface{})

删除键值对

func (*InterfaceSet) Size

func (set *InterfaceSet) Size() int

大小

func (*InterfaceSet) Slice

func (set *InterfaceSet) Slice() []interface{}

转换为数组

func (*InterfaceSet) String

func (set *InterfaceSet) String() string

转换为字符串

type Set

type Set = InterfaceSet

func New

func New(unsafe ...bool) *Set

默认Set类型

type StringSet

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

func NewStringSet

func NewStringSet(unsafe ...bool) *StringSet

func (*StringSet) Add

func (set *StringSet) Add(item string) *StringSet

设置键

func (*StringSet) BatchAdd

func (set *StringSet) BatchAdd(items []string) *StringSet

批量添加设置键

func (*StringSet) Clear

func (set *StringSet) Clear()

清空set

func (*StringSet) Contains

func (set *StringSet) Contains(item string) bool

键是否存在

func (*StringSet) Iterator

func (set *StringSet) Iterator(f func(v string) bool)

给定回调函数对原始内容进行遍历,回调函数返回true表示继续遍历,否则停止遍历

func (*StringSet) LockFunc

func (set *StringSet) LockFunc(f func(m map[string]struct{}))

func (*StringSet) RLockFunc

func (set *StringSet) RLockFunc(f func(m map[string]struct{}))

func (*StringSet) Remove

func (set *StringSet) Remove(key string)

删除键值对

func (*StringSet) Size

func (set *StringSet) Size() int

大小

func (*StringSet) Slice

func (set *StringSet) Slice() []string

转换为数组

func (*StringSet) String

func (set *StringSet) String() string

转换为字符串

Jump to

Keyboard shortcuts

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