setKit

package
v3.0.32 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewGset func(safe ...bool) *gset.Set = gset.NewSet

NewGset Deprecated: 存储的元素类型为 interface{}.

@param safe 是否并发安全?

View Source
var NewGsetFrom func(items interface{}, safe ...bool) *gset.Set = gset.NewFrom

NewGsetFrom Deprecated: 存储的元素类型为 interface{}.

@param items (1) 切片实例(元素类型不限)

(2) 可以为nil

@param safe 是否并发安全?

Functions

func NewSet

func NewSet[T comparable](threadSafe bool, args ...T) mapset.Set[T]

NewSet

@param threadSafe 是否并发安全?

e.g.

set := setKit.NewSet[interface{}](false)
// Add成功
fmt.Println(set.Add(1)) // true
// Add失败
fmt.Println(set.Add(1)) // false

func NewSetFromMapKeys

func NewSetFromMapKeys[T comparable, V any](threadSafe bool, val map[T]V) mapset.Set[T]

func NewSetWithSize

func NewSetWithSize[T comparable](threadSafe bool, cardinality int) mapset.Set[T]

Types

type SetWithLock

type SetWithLock[T comparable] struct {
	mutexKit.RWMutex

	// Set 并发不安全的
	Set mapset.Set[T]
}

func NewSetWithLock

func NewSetWithLock[T comparable]() *SetWithLock[T]

func (*SetWithLock[E]) Size

func (set *SetWithLock[E]) Size() (size int)

Jump to

Keyboard shortcuts

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