Documentation
¶
Index ¶
- type ConcurrentHashSetdeprecated
- func (set *ConcurrentHashSet[T]) Add(e T) bool
- func (set *ConcurrentHashSet[T]) AddAll(c ...T) bool
- func (set *ConcurrentHashSet[T]) Clear()
- func (set *ConcurrentHashSet[T]) Clone() collection.Set[T]
- func (set *ConcurrentHashSet[T]) Contains(e T) bool
- func (set *ConcurrentHashSet[T]) ContainsAll(c ...T) bool
- func (set *ConcurrentHashSet[T]) Equals(o any) bool
- func (set *ConcurrentHashSet[T]) ForEach(handler func(e T) error) error
- func (set *ConcurrentHashSet[T]) IsEmpty() bool
- func (set *ConcurrentHashSet[T]) Iter() iter.Seq[T]
- func (set *ConcurrentHashSet[T]) Remove(e T) bool
- func (set *ConcurrentHashSet[T]) RemoveAll(c ...T) bool
- func (set *ConcurrentHashSet[T]) RemoveIf(filter func(T) bool) bool
- func (set *ConcurrentHashSet[T]) RetainAll(c ...T) bool
- func (set *ConcurrentHashSet[T]) Size() int
- func (set *ConcurrentHashSet[T]) ToSlice() []T
- 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 ConcurrentHashSet
deprecated
type ConcurrentHashSet[T comparable] struct { // contains filtered or unexported fields }
ConcurrentHashSet is a thread-safe set implementation that uses a Golang builtin map to store its elements.
Deprecated: Use the SyncSet instead.
func NewConcurrentHashSet
deprecated
func NewConcurrentHashSet[T comparable]() *ConcurrentHashSet[T]
NewConcurrentHashSet creates and returns am empty ConcurrentHashSet with the specified type.
Deprecated: Use the NewSyncSet instead.
func (*ConcurrentHashSet[T]) Add ¶
func (set *ConcurrentHashSet[T]) Add(e T) bool
Add adds the specified element to this set.
func (*ConcurrentHashSet[T]) AddAll ¶
func (set *ConcurrentHashSet[T]) AddAll(c ...T) bool
AddAll adds all of the specified elements to this set.
func (*ConcurrentHashSet[T]) Clear ¶
func (set *ConcurrentHashSet[T]) Clear()
Clear removes all of the elements from this set.
func (*ConcurrentHashSet[T]) Clone ¶
func (set *ConcurrentHashSet[T]) Clone() collection.Set[T]
Clone returns a copy of this set.
func (*ConcurrentHashSet[T]) Contains ¶
func (set *ConcurrentHashSet[T]) Contains(e T) bool
Contains returns true if this set contains the specified element.
func (*ConcurrentHashSet[T]) ContainsAll ¶
func (set *ConcurrentHashSet[T]) ContainsAll(c ...T) bool
ContainsAll returns true if this set contains all of the specified elements.
func (*ConcurrentHashSet[T]) Equals ¶
func (set *ConcurrentHashSet[T]) Equals(o any) bool
Equals compares set with the object pass from parameter.
func (*ConcurrentHashSet[T]) ForEach ¶
func (set *ConcurrentHashSet[T]) ForEach(handler func(e T) error) error
ForEach performs the given handler for each elements in the set until all elements have been processed or the handler returns an error.
func (*ConcurrentHashSet[T]) IsEmpty ¶
func (set *ConcurrentHashSet[T]) IsEmpty() bool
IsEmpty returns true if this set contains no elements.
func (*ConcurrentHashSet[T]) Iter ¶
func (set *ConcurrentHashSet[T]) Iter() iter.Seq[T]
Iter returns a channel of all elements in this set.
func (*ConcurrentHashSet[T]) Remove ¶
func (set *ConcurrentHashSet[T]) Remove(e T) bool
Remove removes the specified element from this set.
func (*ConcurrentHashSet[T]) RemoveAll ¶
func (set *ConcurrentHashSet[T]) RemoveAll(c ...T) bool
RemoveAll removes all of the specified elements from this set.
func (*ConcurrentHashSet[T]) RemoveIf ¶ added in v0.3.1
func (set *ConcurrentHashSet[T]) RemoveIf(filter func(T) bool) bool
RemoveIf removes all of the elements of this set that satisfy the given predicate.
func (*ConcurrentHashSet[T]) RetainAll ¶ added in v0.3.1
func (set *ConcurrentHashSet[T]) RetainAll(c ...T) bool
RetainAll retains only the elements in this set that are contained in the specified collection.
func (*ConcurrentHashSet[T]) Size ¶
func (set *ConcurrentHashSet[T]) Size() int
Size returns the number of elements in this set.
func (*ConcurrentHashSet[T]) ToSlice ¶
func (set *ConcurrentHashSet[T]) ToSlice() []T
ToSlice returns a slice containing all of the elements in this set.
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 }
func NewSyncSet ¶ added in v0.3.0
func NewSyncSet[T comparable]() *SyncSet[T]
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.