Documentation ¶
Index ¶
- type SortedSet
- func (s *SortedSet[T]) Add(v T)
- func (s *SortedSet[T]) AddAll(other *SortedSet[T])
- func (s *SortedSet[T]) Clone() *SortedSet[T]
- func (s *SortedSet[T]) Contains(v T) bool
- func (s *SortedSet[T]) Filter(predicate func(T) bool) *SortedSet[T]
- func (s *SortedSet[T]) Len() int
- func (s *SortedSet[T]) SortedSlice() []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SortedSet ¶
type SortedSet[T any] struct { // contains filtered or unexported fields }
SortedSet is a Set whose elements are traversable in sorted ordered.
func NewSortedSet ¶
NewSortedSet makes a SortedSet of the elements in the passed slice. The original slice is not modified.
func NewSortedSetFn ¶
NewSortedSetFn makes a SortedSet of the elements in the passed slice. The original slice is not modified.
func (*SortedSet[T]) Add ¶
func (s *SortedSet[T]) Add(v T)
Add adds an element to the SortedSet. If adding another SortedSet, AddAll is more efficient than repeated calls to Add as it avoids needing to materialize an intermediate slice.
func (*SortedSet[T]) Clone ¶
Clone makes a copy of this SortedSet. Behaviorally, the copy is completely independent of the original, but as the copying is done lazily with copy-on-write structures, performance of mutations on both sets may be worse while initial copies are (lazily) made.
func (*SortedSet[T]) Filter ¶
Filter creates a new SortedSet containing only the elements from this one for which the passed predicate evaluates true.
func (*SortedSet[T]) SortedSlice ¶
func (s *SortedSet[T]) SortedSlice() []T
SortedSlice returns a sorted slice of the values in the SortedSet. The returned slice is owned by the caller, and may be modified freely.