arrayset

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT-0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArraySet

type ArraySet[T any] struct {
	Items []T
	Eq    func(T, T) bool
}

func FromSeq

func FromSeq[T comparable](seq seqs.Seq[T]) ArraySet[T]

func FromSlice

func FromSlice[T comparable](vs []T) ArraySet[T]

func FromValues

func FromValues[T comparable](vs ...T) ArraySet[T]

func (ArraySet[T]) Cardinality

func (s ArraySet[T]) Cardinality() int

func (ArraySet[T]) Clone

func (s ArraySet[T]) Clone() ArraySet[T]

func (ArraySet[T]) Contains

func (s ArraySet[T]) Contains(v T) bool

func (*ArraySet[T]) Exclude

func (s *ArraySet[T]) Exclude(vs ...T)

func (*ArraySet[T]) ExcludeSeq

func (s *ArraySet[T]) ExcludeSeq(seq seqs.Seq[T])

ExcludeSeq removes all items from the set that are found in the specified sequence.

NOTE: The current implementation is slower than calling Exclude(seqs.ToSlice(seq)) would be if converting the sequence to a slice is practical.

func (*ArraySet[T]) ExcludeSet

func (s *ArraySet[T]) ExcludeSet(set sets.SetOf[T])

ExcludeSet removes all items from the array set that are contained in the specified set.

func (ArraySet[T]) ForEachUntil

func (s ArraySet[T]) ForEachUntil(fn func(T) bool)

func (*ArraySet[T]) Include

func (s *ArraySet[T]) Include(vs ...T)

func (*ArraySet[T]) IncludeSeq

func (s *ArraySet[T]) IncludeSeq(seq seqs.Seq[T])

func (ArraySet[T]) Len

func (s ArraySet[T]) Len() int

func (ArraySet[T]) WithEq

func (s ArraySet[T]) WithEq(eq func(T, T) bool) ArraySet[T]

WithEq returns a copy of the array set with its equality operator overridden with the specified function.

func (ArraySet[T]) WithItems

func (s ArraySet[T]) WithItems(items []T) ArraySet[T]

WithItems returns a copy of the array set with its items overridden with the specified items.

type Builder

type Builder[T any] struct {
	// contains filtered or unexported fields
}

func WithEq

func WithEq[T any](eq func(T, T) bool) Builder[T]

func (Builder[T]) FromSeq

func (b Builder[T]) FromSeq(seq seqs.Seq[T]) ArraySet[T]

func (Builder[T]) FromSlice

func (b Builder[T]) FromSlice(vs []T) ArraySet[T]

func (Builder[T]) FromValues

func (b Builder[T]) FromValues(vs ...T) ArraySet[T]

Jump to

Keyboard shortcuts

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