Documentation ¶ Index ¶ func InSlice[T comparable](v T, items []T) bool type Set func NewSet[T comparable](capacity int, elements ...T) *Set[T] func (set *Set[T]) Add(elements ...T) *Set[T] func (set *Set[T]) Contains(element T) bool func (set *Set[T]) Elements() []T func (set *Set[T]) IsEmpty() bool func (set *Set[T]) Length() int func (set *Set[T]) Remove(elements ...T) *Set[T] 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 移除元素 Source Files ¶ View all Source files set.goslice.go Click to show internal directories. Click to hide internal directories.