hashset

package module
v0.0.0-...-47453c5 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 4 Imported by: 1

README

hashset

https://github.com/yudeguang/hashset , https://github.com/yudeguang/noGcMap , https://github.com/yudeguang/noGcStaticMap 为同一系列的无GC类型

本包除了提供若干基础类型的hashset 还提供无GC类型的StringThreadSafeNoGC

package main

import (
	"github.com/yudeguang/hashset"
	"log"
)

func main() {
	log.SetFlags(log.Lshortfile | log.Ltime)
	s := hashset.NewStringThreadSafeNoGC()
	s.Add("1")
	log.Println(s.Contains("1"))
	s.Remove("1")
	log.Println(s.Contains("1"))
}


Documentation

Overview

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Copyright 2020 hashset Author(https://github.com/yudeguang17/hashset). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/hashset.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SetAny

type SetAny struct {
	Items map[interface{}]struct{}
}

Set holds elements in go's native map

func InnerJoinAny

func InnerJoinAny(m, n *SetAny) *SetAny

两集合的交集

func New

func New(values ...interface{}) *SetAny

New instantiates a new empty set and adds the passed values, if any, to the set

func UnionAny

func UnionAny(m, n *SetAny) *SetAny

两个集合的合集

func (*SetAny) Add

func (set *SetAny) Add(Items ...interface{})

Add adds the Items (one or more) to the set.

func (*SetAny) Clear

func (set *SetAny) Clear()

Clear clears all values in the set.

func (*SetAny) Contains

func (set *SetAny) Contains(Items ...interface{}) bool

Contains check if Items (one or more) are present in the set. All Items have to be present in the set for the method to return true. Returns true if no arguments are passed at all, i.e. set is always superset of empty set.

func (*SetAny) Empty

func (set *SetAny) Empty() bool

Empty returns true if set does not contain any elements.

func (*SetAny) Remove

func (set *SetAny) Remove(Items ...interface{})

Remove removes the Items (one or more) from the set.

func (*SetAny) Size

func (set *SetAny) Size() int

Size returns number of elements within the set.

func (*SetAny) String

func (set *SetAny) String() string

String returns a string representation of container

func (*SetAny) ToSlice

func (set *SetAny) ToSlice() []interface{}

Values returns all Items in the set.

type SetByte

type SetByte struct {
	Items map[byte]struct{}
}

byte类型

func InnerJoinByte

func InnerJoinByte(m, n *SetByte) *SetByte

两集合的交集

func NewByte

func NewByte(values ...byte) *SetByte

初始化Set,支持在初始化的时候插入任意数量的元素

func UnionByte

func UnionByte(m, n *SetByte) *SetByte

两个集合的合集

func (*SetByte) Add

func (set *SetByte) Add(items ...byte)

向set中添加一个或者多元素

func (*SetByte) Clear

func (set *SetByte) Clear()

清空set

func (*SetByte) Contains

func (set *SetByte) Contains(items ...byte) bool

判断时候包含传入的所有元素,不传入任何元素也被认为是true

func (*SetByte) Empty

func (set *SetByte) Empty() bool

判断set是否为空

func (*SetByte) Remove

func (set *SetByte) Remove(items ...byte)

删除一个或者多个元素

func (*SetByte) Size

func (set *SetByte) Size() int

返回set元素数量

func (*SetByte) String

func (set *SetByte) String() string

实现string接口

func (*SetByte) ToSlice

func (set *SetByte) ToSlice() []byte

转换成切片

type SetComplex64

type SetComplex64 struct {
	Items map[complex64]struct{}
}

complex64类型

func InnerJoinComplex64

func InnerJoinComplex64(m, n *SetComplex64) *SetComplex64

两集合的交集

func NewComplex64

func NewComplex64(values ...complex64) *SetComplex64

初始化Set,支持在初始化的时候插入任意数量的元素

func UnionComplex64

func UnionComplex64(m, n *SetComplex64) *SetComplex64

两个集合的合集

func (*SetComplex64) Add

func (set *SetComplex64) Add(items ...complex64)

向set中添加一个或者多元素

func (*SetComplex64) Clear

func (set *SetComplex64) Clear()

清空set

func (*SetComplex64) Contains

func (set *SetComplex64) Contains(items ...complex64) bool

判断时候包含传入的所有元素,不传入任何元素也被认为是true

func (*SetComplex64) Empty

func (set *SetComplex64) Empty() bool

判断set是否为空

func (*SetComplex64) Remove

func (set *SetComplex64) Remove(items ...complex64)

删除一个或者多个元素

func (*SetComplex64) Size

func (set *SetComplex64) Size() int

返回set元素数量

func (*SetComplex64) String

func (set *SetComplex64) String() string

实现string接口

func (*SetComplex64) ToSlice

func (set *SetComplex64) ToSlice() []complex64

转换成切片

type SetComplex128

type SetComplex128 struct {
	Items map[complex128]struct{}
}

complex128类型

func InnerJoinComplex128

func InnerJoinComplex128(m, n *SetComplex128) *SetComplex128

两集合的交集

func NewComplex128

func NewComplex128(values ...complex128) *SetComplex128

初始化Set,支持在初始化的时候插入任意数量的元素

func UnionComplex128

func UnionComplex128(m, n *SetComplex128) *SetComplex128

两个集合的合集

func (*SetComplex128) Add

func (set *SetComplex128) Add(items ...complex128)

向set中添加一个或者多元素

func (*SetComplex128) Clear

func (set *SetComplex128) Clear()

清空set

func (*SetComplex128) Contains

func (set *SetComplex128) Contains(items ...complex128) bool

判断时候包含传入的所有元素,不传入任何元素也被认为是true

func (*SetComplex128) Empty

func (set *SetComplex128) Empty() bool

判断set是否为空

func (*SetComplex128) Remove

func (set *SetComplex128) Remove(items ...complex128)

删除一个或者多个元素

func (*SetComplex128) Size

func (set *SetComplex128) Size() int

返回set元素数量

func (*SetComplex128) String

func (set *SetComplex128) String() string

实现string接口

func (*SetComplex128) ToSlice

func (set *SetComplex128) ToSlice() []complex128

转换成切片

type SetFloat32

type SetFloat32 struct {
	Items map[float32]struct{}
}

float32类型

func InnerJoinFloat32

func InnerJoinFloat32(m, n *SetFloat32) *SetFloat32

两集合的交集

func NewFloat32

func NewFloat32(values ...float32) *SetFloat32

初始化Set,支持在初始化的时候插入任意数量的元素

func UnionFloat32

func UnionFloat32(m, n *SetFloat32) *SetFloat32

两个集合的合集

func (*SetFloat32) Add

func (set *SetFloat32) Add(items ...float32)

向set中添加一个或者多元素

func (*SetFloat32) Clear

func (set *SetFloat32) Clear()

清空set

func (*SetFloat32) Contains

func (set *SetFloat32) Contains(items ...float32) bool

判断时候包含传入的所有元素,不传入任何元素也被认为是true

func (*SetFloat32) Empty

func (set *SetFloat32) Empty() bool

判断set是否为空

func (*SetFloat32) Remove

func (set *SetFloat32) Remove(items ...float32)

删除一个或者多个元素

func (*SetFloat32) Size

func (set *SetFloat32) Size() int

返回set元素数量

func (*SetFloat32) String

func (set *SetFloat32) String() string

实现string接口

func (*SetFloat32) ToSlice

func (set *SetFloat32) ToSlice() []float32

转换成切片

type SetFloat64

type SetFloat64 struct {
	Items map[float64]struct{}
}

float64类型

func InnerJoinFloat64

func InnerJoinFloat64(m, n *SetFloat64) *SetFloat64

两集合的交集

func NewFloat64

func NewFloat64(values ...float64) *SetFloat64

初始化Set,支持在初始化的时候插入任意数量的元素

func UnionFloat64

func UnionFloat64(m, n *SetFloat64) *SetFloat64

两个集合的合集

func (*SetFloat64) Add

func (set *SetFloat64) Add(items ...float64)

向set中添加一个或者多元素

func (*SetFloat64) Clear

func (set *SetFloat64) Clear()

清空set

func (*SetFloat64) Contains

func (set *SetFloat64) Contains(items ...float64) bool

判断时候包含传入的所有元素,不传入任何元素也被认为是true

func (*SetFloat64) Empty

func (set *SetFloat64) Empty() bool

判断set是否为空

func (*SetFloat64) Remove

func (set *SetFloat64) Remove(items ...float64)

删除一个或者多个元素

func (*SetFloat64) Size

func (set *SetFloat64) Size() int

返回set元素数量

func (*SetFloat64) String

func (set *SetFloat64) String() string

实现string接口

func (*SetFloat64) ToSlice

func (set *SetFloat64) ToSlice() []float64

转换成切片

type SetInt

type SetInt struct {
	Items map[int]struct{}
}

Int类型

func InnerJoinInt

func InnerJoinInt(m, n *SetInt) *SetInt

两集合的交集

func NewInt

func NewInt(values ...int) *SetInt

初始化Set,支持在初始化的时候插入任意数量的元素

func UnionInt

func UnionInt(m, n *SetInt) *SetInt

两个集合的合集

func (*SetInt) Add

func (set *SetInt) Add(items ...int)

向set中添加一个或者多元素

func (*SetInt) Clear

func (set *SetInt) Clear()

清空set

func (*SetInt) Contains

func (set *SetInt) Contains(items ...int) bool

判断时候包含传入的所有元素,不传入任何元素也被认为是true

func (*SetInt) Empty

func (set *SetInt) Empty() bool

判断set是否为空

func (*SetInt) Remove

func (set *SetInt) Remove(items ...int)

删除一个或者多个元素

func (*SetInt) Size

func (set *SetInt) Size() int

返回set元素数量

func (*SetInt) String

func (set *SetInt) String() string

实现string接口

func (*SetInt) ToSlice

func (set *SetInt) ToSlice() []int

转换成切片

type SetInt8

type SetInt8 struct {
	Items map[int8]struct{}
}

int8类型

func InnerJoinInt8

func InnerJoinInt8(m, n *SetInt8) *SetInt8

两集合的交集

func NewInt8

func NewInt8(values ...int8) *SetInt8

初始化Set,支持在初始化的时候插入任意数量的元素

func UnionInt8

func UnionInt8(m, n *SetInt8) *SetInt8

两个集合的合集

func (*SetInt8) Add

func (set *SetInt8) Add(items ...int8)

向set中添加一个或者多元素

func (*SetInt8) Clear

func (set *SetInt8) Clear()

清空set

func (*SetInt8) Contains

func (set *SetInt8) Contains(items ...int8) bool

判断时候包含传入的所有元素,不传入任何元素也被认为是true

func (*SetInt8) Empty

func (set *SetInt8) Empty() bool

判断set是否为空

func (*SetInt8) Remove

func (set *SetInt8) Remove(items ...int8)

删除一个或者多个元素

func (*SetInt8) Size

func (set *SetInt8) Size() int

返回set元素数量

func (*SetInt8) String

func (set *SetInt8) String() string

实现string接口

func (*SetInt8) ToSlice

func (set *SetInt8) ToSlice() []int8

转换成切片

type SetInt16

type SetInt16 struct {
	Items map[int16]struct{}
}

int16类型

func InnerJoinInt16

func InnerJoinInt16(m, n *SetInt16) *SetInt16

两集合的交集

func NewInt16

func NewInt16(values ...int16) *SetInt16

初始化Set,支持在初始化的时候插入任意数量的元素

func UnionInt16

func UnionInt16(m, n *SetInt16) *SetInt16

两个集合的合集

func (*SetInt16) Add

func (set *SetInt16) Add(items ...int16)

向set中添加一个或者多元素

func (*SetInt16) Clear

func (set *SetInt16) Clear()

清空set

func (*SetInt16) Contains

func (set *SetInt16) Contains(items ...int16) bool

判断时候包含传入的所有元素,不传入任何元素也被认为是true

func (*SetInt16) Empty

func (set *SetInt16) Empty() bool

判断set是否为空

func (*SetInt16) Remove

func (set *SetInt16) Remove(items ...int16)

删除一个或者多个元素

func (*SetInt16) Size

func (set *SetInt16) Size() int

返回set元素数量

func (*SetInt16) String

func (set *SetInt16) String() string

实现string接口

func (*SetInt16) ToSlice

func (set *SetInt16) ToSlice() []int16

转换成切片

type SetInt32

type SetInt32 struct {
	Items map[int32]struct{}
}

int32类型

func InnerJoinInt32

func InnerJoinInt32(m, n *SetInt32) *SetInt32

两集合的交集

func NewInt32

func NewInt32(values ...int32) *SetInt32

初始化Set,支持在初始化的时候插入任意数量的元素

func UnionInt32

func UnionInt32(m, n *SetInt32) *SetInt32

两个集合的合集

func (*SetInt32) Add

func (set *SetInt32) Add(items ...int32)

向set中添加一个或者多元素

func (*SetInt32) Clear

func (set *SetInt32) Clear()

清空set

func (*SetInt32) Contains

func (set *SetInt32) Contains(items ...int32) bool

判断时候包含传入的所有元素,不传入任何元素也被认为是true

func (*SetInt32) Empty

func (set *SetInt32) Empty() bool

判断set是否为空

func (*SetInt32) Remove

func (set *SetInt32) Remove(items ...int32)

删除一个或者多个元素

func (*SetInt32) Size

func (set *SetInt32) Size() int

返回set元素数量

func (*SetInt32) String

func (set *SetInt32) String() string

实现string接口

func (*SetInt32) ToSlice

func (set *SetInt32) ToSlice() []int32

转换成切片

type SetInt64

type SetInt64 struct {
	Items map[int64]struct{}
}

int64类型

func InnerJoinInt64

func InnerJoinInt64(m, n *SetInt64) *SetInt64

两集合的交集

func NewInt64

func NewInt64(values ...int64) *SetInt64

初始化Set,支持在初始化的时候插入任意数量的元素

func UnionInt64

func UnionInt64(m, n *SetInt64) *SetInt64

两个集合的合集

func (*SetInt64) Add

func (set *SetInt64) Add(items ...int64)

向set中添加一个或者多元素

func (*SetInt64) Clear

func (set *SetInt64) Clear()

清空set

func (*SetInt64) Contains

func (set *SetInt64) Contains(items ...int64) bool

判断时候包含传入的所有元素,不传入任何元素也被认为是true

func (*SetInt64) Empty

func (set *SetInt64) Empty() bool

判断set是否为空

func (*SetInt64) Remove

func (set *SetInt64) Remove(items ...int64)

删除一个或者多个元素

func (*SetInt64) Size

func (set *SetInt64) Size() int

返回set元素数量

func (*SetInt64) String

func (set *SetInt64) String() string

实现string接口

func (*SetInt64) ToSlice

func (set *SetInt64) ToSlice() []int64

转换成切片

type SetRune

type SetRune struct {
	Items map[rune]struct{}
}

rune类型

func InnerJoinRune

func InnerJoinRune(m, n *SetRune) *SetRune

两集合的交集

func NewRune

func NewRune(values ...rune) *SetRune

初始化Set,支持在初始化的时候插入任意数量的元素

func UnionRune

func UnionRune(m, n *SetRune) *SetRune

两个集合的合集

func (*SetRune) Add

func (set *SetRune) Add(items ...rune)

向set中添加一个或者多元素

func (*SetRune) Clear

func (set *SetRune) Clear()

清空set

func (*SetRune) Contains

func (set *SetRune) Contains(items ...rune) bool

判断时候包含传入的所有元素,不传入任何元素也被认为是true

func (*SetRune) Empty

func (set *SetRune) Empty() bool

判断set是否为空

func (*SetRune) Remove

func (set *SetRune) Remove(items ...rune)

删除一个或者多个元素

func (*SetRune) Size

func (set *SetRune) Size() int

返回set元素数量

func (*SetRune) String

func (set *SetRune) String() string

实现string接口

func (*SetRune) ToSlice

func (set *SetRune) ToSlice() []rune

转换成切片

type SetString

type SetString struct {
	Items map[string]struct{}
}

Int类型

func InnerJoinString

func InnerJoinString(m, n *SetString) *SetString

两集合的交集

func NewString

func NewString(values ...string) *SetString

初始化Set,支持在初始化的时候插入任意数量的元素

func UnionString

func UnionString(m, n *SetString) *SetString

两个集合的合集

func (*SetString) Add

func (set *SetString) Add(items ...string)

向set中添加一个或者多元素

func (*SetString) Clear

func (set *SetString) Clear()

清空set

func (*SetString) Contains

func (set *SetString) Contains(items ...string) bool

判断时候包含传入的所有元素,不传入任何元素也被认为是true

func (*SetString) Empty

func (set *SetString) Empty() bool

判断set是否为空

func (*SetString) Remove

func (set *SetString) Remove(items ...string)

删除一个或者多个元素

func (*SetString) Size

func (set *SetString) Size() int

返回set元素数量

func (*SetString) String

func (set *SetString) String() string

实现string接口

func (*SetString) ToSlice

func (set *SetString) ToSlice() []string

转换成切片

type SetStringThreadSafeNoGC

type SetStringThreadSafeNoGC struct {
	Items *noGCMap.NoGcMapAny //核心部分
}

线程安全

func NewStringThreadSafeNoGC

func NewStringThreadSafeNoGC() *SetStringThreadSafeNoGC

New instantiates a new empty set and adds the passed values, if any, to the set

func (*SetStringThreadSafeNoGC) Add

func (set *SetStringThreadSafeNoGC) Add(Items ...string)

Add adds the Items (one or more) to the set.

func (*SetStringThreadSafeNoGC) Clear

func (set *SetStringThreadSafeNoGC) Clear()

Clear clears all values in the set.

func (*SetStringThreadSafeNoGC) Contains

func (set *SetStringThreadSafeNoGC) Contains(Items ...string) bool

Contains check if Items (one or more) are present in the set. All Items have to be present in the set for the method to return true. Returns true if no arguments are passed at all, i.e. set is always superset of empty set.

func (*SetStringThreadSafeNoGC) Empty

func (set *SetStringThreadSafeNoGC) Empty() bool

Empty returns true if set does not contain any elements.

func (*SetStringThreadSafeNoGC) Remove

func (set *SetStringThreadSafeNoGC) Remove(Items ...string)

Remove removes the Items (one or more) from the set.

func (*SetStringThreadSafeNoGC) Size

func (set *SetStringThreadSafeNoGC) Size() int

Size returns number of elements within the set.

type SetThreadSafe

type SetThreadSafe struct {
	Items sync.Map
}

线程安全

func InnerJoinThreadSafe

func InnerJoinThreadSafe(m, n *SetThreadSafe) *SetThreadSafe

两集合的交集,这里不能同其它类型一样,先用Size函数得到长度,再计算,性能会较差

func NewThreadSafe

func NewThreadSafe(values ...interface{}) *SetThreadSafe

New instantiates a new empty set and adds the passed values, if any, to the set

func UnionThreadSafe

func UnionThreadSafe(m, n *SetThreadSafe) *SetThreadSafe

两个集合的合集

func (*SetThreadSafe) Add

func (set *SetThreadSafe) Add(Items ...interface{})

Add adds the Items (one or more) to the set.

func (*SetThreadSafe) Clear

func (set *SetThreadSafe) Clear()

Clear clears all values in the set.

func (*SetThreadSafe) Contains

func (set *SetThreadSafe) Contains(Items ...interface{}) bool

Contains check if Items (one or more) are present in the set. All Items have to be present in the set for the method to return true. Returns true if no arguments are passed at all, i.e. set is always superset of empty set.

func (*SetThreadSafe) Empty

func (set *SetThreadSafe) Empty() bool

Empty returns true if set does not contain any elements.

func (*SetThreadSafe) Remove

func (set *SetThreadSafe) Remove(Items ...interface{})

Remove removes the Items (one or more) from the set.

func (*SetThreadSafe) Size

func (set *SetThreadSafe) Size() int

Size returns number of elements within the set.

func (*SetThreadSafe) String

func (set *SetThreadSafe) String() string

String returns a string representation of container

func (*SetThreadSafe) ToSlice

func (set *SetThreadSafe) ToSlice() []interface{}

Values returns all Items in the set.

type SetUint

type SetUint struct {
	Items map[uint]struct{}
}

uint类型

func InnerJoinUint

func InnerJoinUint(m, n *SetUint) *SetUint

两集合的交集

func NewUint

func NewUint(values ...uint) *SetUint

初始化Set,支持在初始化的时候插入任意数量的元素

func UnionUint

func UnionUint(m, n *SetUint) *SetUint

两个集合的合集

func (*SetUint) Add

func (set *SetUint) Add(items ...uint)

向set中添加一个或者多元素

func (*SetUint) Clear

func (set *SetUint) Clear()

清空set

func (*SetUint) Contains

func (set *SetUint) Contains(items ...uint) bool

判断时候包含传入的所有元素,不传入任何元素也被认为是true

func (*SetUint) Empty

func (set *SetUint) Empty() bool

判断set是否为空

func (*SetUint) Remove

func (set *SetUint) Remove(items ...uint)

删除一个或者多个元素

func (*SetUint) Size

func (set *SetUint) Size() int

返回set元素数量

func (*SetUint) String

func (set *SetUint) String() string

实现string接口

func (*SetUint) ToSlice

func (set *SetUint) ToSlice() []uint

转换成切片

type SetUint8

type SetUint8 struct {
	Items map[uint8]struct{}
}

uint8类型

func InnerJoinUint8

func InnerJoinUint8(m, n *SetUint8) *SetUint8

两集合的交集

func NewUint8

func NewUint8(values ...uint8) *SetUint8

初始化Set,支持在初始化的时候插入任意数量的元素

func UnionUint8

func UnionUint8(m, n *SetUint8) *SetUint8

两个集合的合集

func (*SetUint8) Add

func (set *SetUint8) Add(items ...uint8)

向set中添加一个或者多元素

func (*SetUint8) Clear

func (set *SetUint8) Clear()

清空set

func (*SetUint8) Contains

func (set *SetUint8) Contains(items ...uint8) bool

判断时候包含传入的所有元素,不传入任何元素也被认为是true

func (*SetUint8) Empty

func (set *SetUint8) Empty() bool

判断set是否为空

func (*SetUint8) Remove

func (set *SetUint8) Remove(items ...uint8)

删除一个或者多个元素

func (*SetUint8) Size

func (set *SetUint8) Size() int

返回set元素数量

func (*SetUint8) String

func (set *SetUint8) String() string

实现string接口

func (*SetUint8) ToSlice

func (set *SetUint8) ToSlice() []uint8

转换成切片

type SetUint16

type SetUint16 struct {
	Items map[uint16]struct{}
}

uint16类型

func InnerJoinUint16

func InnerJoinUint16(m, n *SetUint16) *SetUint16

两集合的交集

func NewUint16

func NewUint16(values ...uint16) *SetUint16

初始化Set,支持在初始化的时候插入任意数量的元素

func UnionUint16

func UnionUint16(m, n *SetUint16) *SetUint16

两个集合的合集

func (*SetUint16) Add

func (set *SetUint16) Add(items ...uint16)

向set中添加一个或者多元素

func (*SetUint16) Clear

func (set *SetUint16) Clear()

清空set

func (*SetUint16) Contains

func (set *SetUint16) Contains(items ...uint16) bool

判断时候包含传入的所有元素,不传入任何元素也被认为是true

func (*SetUint16) Empty

func (set *SetUint16) Empty() bool

判断set是否为空

func (*SetUint16) Remove

func (set *SetUint16) Remove(items ...uint16)

删除一个或者多个元素

func (*SetUint16) Size

func (set *SetUint16) Size() int

返回set元素数量

func (*SetUint16) String

func (set *SetUint16) String() string

实现string接口

func (*SetUint16) ToSlice

func (set *SetUint16) ToSlice() []uint16

转换成切片

type SetUint32

type SetUint32 struct {
	Items map[uint32]struct{}
}

uint32类型

func InnerJoinUint32

func InnerJoinUint32(m, n *SetUint32) *SetUint32

两集合的交集

func NewUint32

func NewUint32(values ...uint32) *SetUint32

初始化Set,支持在初始化的时候插入任意数量的元素

func UnionUint32

func UnionUint32(m, n *SetUint32) *SetUint32

两个集合的合集

func (*SetUint32) Add

func (set *SetUint32) Add(items ...uint32)

向set中添加一个或者多元素

func (*SetUint32) Clear

func (set *SetUint32) Clear()

清空set

func (*SetUint32) Contains

func (set *SetUint32) Contains(items ...uint32) bool

判断时候包含传入的所有元素,不传入任何元素也被认为是true

func (*SetUint32) Empty

func (set *SetUint32) Empty() bool

判断set是否为空

func (*SetUint32) Remove

func (set *SetUint32) Remove(items ...uint32)

删除一个或者多个元素

func (*SetUint32) Size

func (set *SetUint32) Size() int

返回set元素数量

func (*SetUint32) String

func (set *SetUint32) String() string

实现string接口

func (*SetUint32) ToSlice

func (set *SetUint32) ToSlice() []uint32

转换成切片

type SetUint64

type SetUint64 struct {
	Items map[uint64]struct{}
}

uint64类型

func InnerJoinUint64

func InnerJoinUint64(m, n *SetUint64) *SetUint64

两集合的交集

func NewUint64

func NewUint64(values ...uint64) *SetUint64

初始化Set,支持在初始化的时候插入任意数量的元素

func UnionUint64

func UnionUint64(m, n *SetUint64) *SetUint64

两个集合的合集

func (*SetUint64) Add

func (set *SetUint64) Add(items ...uint64)

向set中添加一个或者多元素

func (*SetUint64) Clear

func (set *SetUint64) Clear()

清空set

func (*SetUint64) Contains

func (set *SetUint64) Contains(items ...uint64) bool

判断时候包含传入的所有元素,不传入任何元素也被认为是true

func (*SetUint64) Empty

func (set *SetUint64) Empty() bool

判断set是否为空

func (*SetUint64) Remove

func (set *SetUint64) Remove(items ...uint64)

删除一个或者多个元素

func (*SetUint64) Size

func (set *SetUint64) Size() int

返回set元素数量

func (*SetUint64) String

func (set *SetUint64) String() string

实现string接口

func (*SetUint64) ToSlice

func (set *SetUint64) ToSlice() []uint64

转换成切片

type SetUintptr

type SetUintptr struct {
	Items map[uintptr]struct{}
}

uintptr类型

func InnerJoinUintptr

func InnerJoinUintptr(m, n *SetUintptr) *SetUintptr

两集合的交集

func NewUintptr

func NewUintptr(values ...uintptr) *SetUintptr

初始化Set,支持在初始化的时候插入任意数量的元素

func UnionUintptr

func UnionUintptr(m, n *SetUintptr) *SetUintptr

两个集合的合集

func (*SetUintptr) Add

func (set *SetUintptr) Add(items ...uintptr)

向set中添加一个或者多元素

func (*SetUintptr) Clear

func (set *SetUintptr) Clear()

清空set

func (*SetUintptr) Contains

func (set *SetUintptr) Contains(items ...uintptr) bool

判断时候包含传入的所有元素,不传入任何元素也被认为是true

func (*SetUintptr) Empty

func (set *SetUintptr) Empty() bool

判断set是否为空

func (*SetUintptr) Remove

func (set *SetUintptr) Remove(items ...uintptr)

删除一个或者多个元素

func (*SetUintptr) Size

func (set *SetUintptr) Size() int

返回set元素数量

func (*SetUintptr) String

func (set *SetUintptr) String() string

实现string接口

func (*SetUintptr) ToSlice

func (set *SetUintptr) ToSlice() []uintptr

转换成切片

Jump to

Keyboard shortcuts

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