arrayset

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: MIT-0 Imports: 5 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[Obj any] struct {
	Items []Obj
	Eq    func(Obj, Obj) bool
}

func FromIter added in v0.6.0

func FromIter[Obj comparable](seq iter.Seq[Obj]) ArraySet[Obj]

func FromSeq

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

func FromSlice

func FromSlice[Obj comparable](objs []Obj) ArraySet[Obj]

func FromValues

func FromValues[Obj comparable](objs ...Obj) ArraySet[Obj]

func (ArraySet[_]) Cardinality

func (s ArraySet[_]) Cardinality() (core.Cardinal, bool)

func (ArraySet[Obj]) Clone

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

func (ArraySet[Obj]) Contains

func (s ArraySet[Obj]) Contains(obj Obj) bool

func (*ArraySet[Obj]) Exclude

func (s *ArraySet[Obj]) Exclude(objs ...Obj)

func (*ArraySet[Obj]) ExcludeAll added in v0.6.0

func (s *ArraySet[Obj]) ExcludeAll(seq iter.Seq[Obj])

ExcludeAll removes all objects from the set that are found in the specified sequence.

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

func (*ArraySet[Obj]) ExcludeSeq

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

ExcludeSeq removes all objects 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[Obj]) ExcludeSet

func (s *ArraySet[Obj]) ExcludeSet(set core.SetOf[Obj])

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

func (ArraySet[Obj]) ForEachUntil

func (s ArraySet[Obj]) ForEachUntil(yield func(Obj) bool)

func (*ArraySet[Obj]) Include

func (s *ArraySet[Obj]) Include(objs ...Obj)

func (*ArraySet[Obj]) IncludeAll added in v0.6.0

func (s *ArraySet[Obj]) IncludeAll(seq iter.Seq[Obj])

func (*ArraySet[Obj]) IncludeSeq

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

func (ArraySet[_]) Len

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

func (ArraySet[Obj]) Values added in v0.6.0

func (s ArraySet[Obj]) Values(yield func(Obj) bool)

func (ArraySet[Obj]) WithEq

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

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

func (ArraySet[Obj]) WithItems

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

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

type Builder

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

func WithEq

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

func (Builder[Obj]) FromIter added in v0.6.0

func (b Builder[Obj]) FromIter(seq iter.Seq[Obj]) ArraySet[Obj]

func (Builder[Obj]) FromSeq

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

func (Builder[Obj]) FromSlice

func (b Builder[Obj]) FromSlice(objs []Obj) ArraySet[Obj]

func (Builder[Obj]) FromValues

func (b Builder[Obj]) FromValues(objs ...Obj) ArraySet[Obj]

Jump to

Keyboard shortcuts

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