container

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InSlice

func InSlice[T comparable](v T, items []T) bool

InSlice 返回目标元素是否在切片中的布尔值

Types

type Set

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

Set 由不重复的T组成的集合。该集合非线程安全。

func NewSet

func NewSet[T comparable](capacity int, elements ...T) *Set[T]

NewSet 返回指定容量的Set集合。

func (*Set[T]) Add

func (set *Set[T]) Add(elements ...T) *Set[T]

Add 往Set集合中添加元素。

func (*Set[T]) Contains

func (set *Set[T]) Contains(element T) bool

Contains 返回是否包含当前元素的布尔值

func (*Set[T]) Elements

func (set *Set[T]) Elements() []T

Elements 返回当前Set集合中的所有元素。

func (*Set[T]) IsEmpty

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

IsEmpty 返回当前集合是否为空

func (*Set[T]) Length

func (set *Set[T]) Length() int

Length 返回当前的元素个数

func (*Set[T]) Remove

func (set *Set[T]) Remove(elements ...T) *Set[T]

Remove 移除元素

Jump to

Keyboard shortcuts

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