Documentation
¶
Index ¶
- type HashSet
- func (set *HashSet[T]) Add(e T) bool
- func (set *HashSet[T]) AddAll(c ...T) bool
- func (set *HashSet[T]) Clear()
- func (set *HashSet[T]) Clone() collection.Set[T]
- func (set *HashSet[T]) Contains(e T) bool
- func (set *HashSet[T]) ContainsAll(c ...T) bool
- func (set *HashSet[T]) Equals(o any) bool
- func (set *HashSet[T]) ForEach(handler func(e T) error) error
- func (set *HashSet[T]) IsEmpty() bool
- func (set *HashSet[T]) Iter() iter.Seq[T]
- func (set *HashSet[T]) Remove(e T) bool
- func (set *HashSet[T]) RemoveAll(c ...T) bool
- func (set *HashSet[T]) RemoveIf(filter func(T) bool) bool
- func (set *HashSet[T]) RetainAll(c ...T) bool
- func (set *HashSet[T]) Size() int
- func (set *HashSet[T]) ToSlice() []T
- type SyncSet
- func (s *SyncSet[T]) Add(val T) bool
- func (s *SyncSet[T]) AddAll(c ...T) bool
- func (s *SyncSet[T]) Clear()
- func (s *SyncSet[T]) Clone() collection.Set[T]
- func (s *SyncSet[T]) Contains(e T) bool
- func (s *SyncSet[T]) ContainsAll(c ...T) bool
- func (s *SyncSet[T]) Equals(o any) bool
- func (s *SyncSet[T]) ForEach(handler func(e T) error) error
- func (s *SyncSet[T]) IsEmpty() bool
- func (set *SyncSet[T]) Iter() iter.Seq[T]
- func (s *SyncSet[T]) Remove(k T) bool
- func (s *SyncSet[T]) RemoveAll(c ...T) bool
- func (s *SyncSet[T]) RemoveIf(filter func(T) bool) bool
- func (s *SyncSet[T]) RetainAll(c ...T) bool
- func (s *SyncSet[T]) Size() int
- func (s *SyncSet[T]) ToSlice() []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HashSet ¶
type HashSet[T comparable] map[T]empty
HashSet is a set implementation that uses a Golang builtin map to store its elements.
func (*HashSet[T]) Clear ¶
func (set *HashSet[T]) Clear()
Clear removes all of the elements from this set.
func (*HashSet[T]) Clone ¶
func (set *HashSet[T]) Clone() collection.Set[T]
Clone returns a copy of this set.
func (*HashSet[T]) ContainsAll ¶
ContainsAll returns true if this set contains all of the specified elements.
func (*HashSet[T]) ForEach ¶
ForEach performs the given handler for each elements in the set until all elements have been processed or the handler returns an error.
func (*HashSet[T]) RemoveIf ¶ added in v0.3.1
RemoveIf removes all of the elements of this set that satisfy the given predicate.
func (*HashSet[T]) RetainAll ¶ added in v0.3.1
RetainAll retains only the elements in this set that are contained in the specified collection.
type SyncSet ¶ added in v0.3.0
type SyncSet[T comparable] struct { // contains filtered or unexported fields }
SyncSet is a thread-safe set implementation that based on sync.Map.
func NewSyncSet ¶ added in v0.3.0
func NewSyncSet[T comparable]() *SyncSet[T]
NewSyncSet creates a new SyncSet.
func (*SyncSet[T]) Clear ¶ added in v0.3.0
func (s *SyncSet[T]) Clear()
Clear removes all of the elements from this collection.
func (*SyncSet[T]) Clone ¶ added in v0.3.0
func (s *SyncSet[T]) Clone() collection.Set[T]
Clone returns a copy of this set.
func (*SyncSet[T]) Contains ¶ added in v0.3.0
Contains returns true if this collection contains the specified element.
func (*SyncSet[T]) ContainsAll ¶ added in v0.3.0
ContainsAll returns true if this collection contains all of the elements in the specified collection.
func (*SyncSet[T]) Equals ¶ added in v0.3.0
Equals compares this collection with the object pass from parameter.
func (*SyncSet[T]) ForEach ¶ added in v0.3.0
ForEach performs the given handler for each elements in the collection until all elements have been processed or the handler returns an error.
func (*SyncSet[T]) IsEmpty ¶ added in v0.3.0
IsEmpty returns true if this collection contains no elements.
func (*SyncSet[T]) Remove ¶ added in v0.3.0
Remove removes the specified element from this collection.
func (*SyncSet[T]) RemoveAll ¶ added in v0.3.0
RemoveAll removes all of the elements in the specified collection from this collection.
func (*SyncSet[T]) RemoveIf ¶ added in v0.3.1
RemoveIf removes all of the elements of this collection that satisfy the given predicate.
func (*SyncSet[T]) RetainAll ¶ added in v0.3.1
RetainAll retains only the elements in this collection that are contained in the specified collection.