hashset

package
v0.0.0-...-a261c41 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HashSet

type HashSet[T comparable] struct {
	// contains filtered or unexported fields
}

HashSet 是一个线程安全的哈希集合

func NewHashSet

func NewHashSet[T comparable]() *HashSet[T]

NewHashSet 创建一个新的HashSet

func (*HashSet[T]) Add

func (set *HashSet[T]) Add(key T)

Add 将元素添加到HashSet

func (*HashSet[T]) Clear

func (set *HashSet[T]) Clear()

Clear 清空HashSet中的所有元素

func (*HashSet[T]) Contains

func (set *HashSet[T]) Contains(key T) bool

Contains 检查HashSet中是否包含指定的元素

func (*HashSet[T]) IsEmpty

func (set *HashSet[T]) IsEmpty() bool

IsEmpty 检查HashSet是否为空

func (*HashSet[T]) Iterator

func (set *HashSet[T]) Iterator() <-chan T

Iterator 返回一个只读通道,用于遍历HashSet中的元素

func (*HashSet[T]) Remove

func (set *HashSet[T]) Remove(key T)

Remove 从HashSet中移除指定的元素

func (*HashSet[T]) Size

func (set *HashSet[T]) Size() int

Size 返回HashSet中的元素数量

func (*HashSet[T]) String

func (set *HashSet[T]) String() string

String 返回HashSet的字符串表示形式

Jump to

Keyboard shortcuts

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