Documentation ¶
Index ¶
- type BitIterator
- type IntIterator
- type IntLess
- type IntSet
- func (s IntSet[I]) Any() I
- func (s IntSet[I]) Count() int
- func (s IntSet[I]) Elements() []I
- func (s IntSet[I]) EqualSet(t IntSet[I]) bool
- func (s IntSet[I]) Format(f fmt.State, verb rune)
- func (s IntSet[I]) Has(val I) bool
- func (s IntSet[I]) Intersection(t IntSet[I]) IntSet[I]
- func (s IntSet[I]) IsEmpty() bool
- func (s IntSet[I]) IsSubsetOf(t IntSet[I]) bool
- func (s IntSet[I]) Map(f func(elem I) I) IntSet[I]
- func (s IntSet[I]) Range() IntIterator[I]
- func (s IntSet[I]) String() string
- func (s IntSet[I]) Union(t IntSet[I]) IntSet[I]
- func (s IntSet[I]) Where(pred func(elem I) bool) IntSet[I]
- func (s IntSet[I]) With(is ...I) IntSet[I]
- func (s IntSet[I]) Without(is ...I) IntSet[I]
- type Map
- func (m Map[K, V]) Any() (key K, value V)
- func (m Map[K, V]) Count() int
- func (m Map[K, V]) DebugReport(debug.Tag) string
- func (m Map[K, V]) EqArgs() *tree.EqArgs[kv.KeyValue[K, V]]
- func (m Map[K, V]) Equal(n Map[K, V]) bool
- func (m Map[K, V]) Format(f fmt.State, verb rune)
- func (m Map[K, V]) Get(key K) (V, bool)
- func (m Map[K, V]) GetElse(key K, deflt V) V
- func (m Map[K, V]) GetElseFunc(key K, deflt func() V) V
- func (m Map[K, V]) Has(key K) bool
- func (m Map[K, V]) Hash(seed uintptr) uintptr
- func (m Map[K, V]) IsEmpty() bool
- func (m Map[K, V]) Keys() Set[K]
- func (m Map[K, V]) Merge(n Map[K, V], resolve func(key K, a, b V) V) Map[K, V]
- func (m Map[K, V]) MustGet(key K) V
- func (m Map[K, V]) Project(keys Set[K]) Map[K, V]
- func (m Map[K, V]) Range() *MapIterator[K, V]
- func (m Map[K, V]) String() string
- func (m Map[K, V]) Update(n Map[K, V]) Map[K, V]
- func (m Map[K, V]) Values() Set[V]
- func (m Map[K, V]) Where(pred func(key K, val V) bool) Map[K, V]
- func (m Map[K, V]) With(key K, val V) Map[K, V]
- func (m Map[K, V]) Without(keys Set[K]) Map[K, V]
- func (m Map[K, V]) Without2(keys ...K) Map[K, V]
- type MapBuilder
- type MapIterator
- type Set
- func (s Set[T]) Any() T
- func (s Set[T]) AnyN(n int) Set[T]
- func (s Set[T]) Count() int
- func (s Set[T]) Difference(t Set[T]) Set[T]
- func (s Set[T]) Elements() []T
- func (s Set[T]) Equal(t Set[T]) bool
- func (s Set[T]) First(less tree.Less[T]) interface{}
- func (s Set[T]) FirstN(n int, less tree.Less[T]) Set[T]
- func (s Set[T]) Format(f fmt.State, verb rune)
- func (s Set[T]) Has(val T) bool
- func (s Set[T]) Hash(seed uintptr) uintptr
- func (s Set[T]) Intersection(t Set[T]) Set[T]
- func (s Set[T]) IsEmpty() bool
- func (s Set[T]) IsSubsetOf(t Set[T]) bool
- func (s Set[T]) MarshalJSON() ([]byte, error)
- func (s Set[T]) OrderedElements(less tree.Less[T]) []T
- func (s Set[T]) OrderedFirstN(n int, less tree.Less[T]) []T
- func (s Set[T]) OrderedRange(less tree.Less[T]) iterator.Iterator[T]
- func (s Set[T]) Range() iterator.Iterator[T]
- func (s Set[T]) String() string
- func (s Set[T]) SymmetricDifference(t Set[T]) Set[T]
- func (s Set[T]) Union(t Set[T]) Set[T]
- func (s Set[T]) Where(pred func(elem T) bool) Set[T]
- func (s Set[T]) With(values ...T) Set[T]
- func (s Set[T]) Without(values ...T) Set[T]
- type SetBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BitIterator ¶
type BitIterator uintptr
BitIterator represents a set of one-bits and the ability to enumerate them.
func (BitIterator) Count ¶
func (b BitIterator) Count() int
func (BitIterator) Has ¶
func (b BitIterator) Has(i int) bool
func (BitIterator) Index ¶
func (b BitIterator) Index() int
func (BitIterator) Next ¶
func (b BitIterator) Next() BitIterator
func (BitIterator) String ¶
func (b BitIterator) String() string
func (BitIterator) With ¶
func (b BitIterator) With(i int) BitIterator
func (BitIterator) Without ¶
func (b BitIterator) Without(i int) BitIterator
type IntIterator ¶
type IntIterator[T integer] interface { Next() bool Value() T }
type IntLess ¶
type IntLess[T integer] func(a, b T) bool
IntLess dictates the order of two elements.
type IntSet ¶
type IntSet[I integer] struct {
// contains filtered or unexported fields
}
func NewIntSet ¶
func NewIntSet[I integer](is ...I) IntSet[I]
NewIntSet returns an IntSet with the values provided.
func (IntSet[I]) Elements ¶
func (s IntSet[I]) Elements() []I
Elements returns all the values of IntSet.
func (IntSet[I]) Intersection ¶
Intersection returns an IntSet whose values exists in s and t.
func (IntSet[I]) IsSubsetOf ¶
IsSubsetOf returns true if s is a subset of t and false otherwise.
func (IntSet[I]) Range ¶
func (s IntSet[I]) Range() IntIterator[I]
Range returns the iterator for IntSet.
type Map ¶
Map maps keys to values. The zero value is the empty Map.
func NewMapFromGoMap ¶
func NewMapFromGoMap[K comparable, V any](m map[K]V) Map[K, V]
NewMapFromGoMap takes a map[K]V and returns a frozen Map from it.
func NewMapFromKeys ¶
NewMapFromKeys creates a new Map in which values are computed from keys.
func (Map[K, V]) Any ¶
func (m Map[K, V]) Any() (key K, value V)
Any returns an arbitrary entry from the Map.
func (Map[K, V]) DebugReport ¶
DebugReport is for internal use.
func (Map[K, V]) Equal ¶
Equal returns true iff i is a Map with all the same key-value pairs as this Map.
func (Map[K, V]) Get ¶
Get returns the value associated with key in m and true iff the key is found.
func (Map[K, V]) GetElse ¶
func (m Map[K, V]) GetElse(key K, deflt V) V
GetElse returns the value associated with key in m or deflt if the key is not found.
func (Map[K, V]) GetElseFunc ¶
func (m Map[K, V]) GetElseFunc(key K, deflt func() V) V
GetElseFunc returns the value associated with key in m or the result of calling deflt if the key is not found.
func (Map[K, V]) Merge ¶
Merge returns a map from the merging between two maps, should there be a key overlap, the value that corresponds to key will be replaced by the value resulted from the provided resolve function.
func (Map[K, V]) MustGet ¶
func (m Map[K, V]) MustGet(key K) V
MustGet returns the value associated with key in m or panics if the key is not found.
func (Map[K, V]) Range ¶
func (m Map[K, V]) Range() *MapIterator[K, V]
Range returns a MapIterator over the Map.
func (Map[K, V]) Update ¶
Update returns a Map with key-value pairs from n added or replacing existing keys.
func (Map[K, V]) With ¶
With returns a new Map with key associated with val and all other keys retained from m.
type MapBuilder ¶
MapBuilder[K, V] provides a more efficient way to build Maps incrementally.
func NewMapBuilder ¶
func NewMapBuilder[K any, V any](capacity int) *MapBuilder[K, V]
func (*MapBuilder[K, V]) Count ¶
func (b *MapBuilder[K, V]) Count() int
Count returns the number of entries in the Map under construction.
func (*MapBuilder[K, V]) Finish ¶
func (b *MapBuilder[K, V]) Finish() Map[K, V]
Finish returns a Map containing all entries added since the MapBuilder[K, V] was initialised or the last call to Finish.
func (*MapBuilder[K, V]) Get ¶
func (b *MapBuilder[K, V]) Get(key K) (V, bool)
Get returns the value for key from the Map under construction or false if not found.
func (*MapBuilder[K, V]) Has ¶
func (b *MapBuilder[K, V]) Has(key K) bool
func (*MapBuilder[K, V]) Put ¶
func (b *MapBuilder[K, V]) Put(key K, value V)
Put adds or changes an entry into the Map under construction.
func (*MapBuilder[K, V]) Remove ¶
func (b *MapBuilder[K, V]) Remove(key K)
Remove removes an entry from the Map under construction.
type MapIterator ¶
MapIterator provides for iterating over a Map.
func (*MapIterator[K, V]) Entry ¶
func (i *MapIterator[K, V]) Entry() (key K, value V)
Entry returns the current key-value pair as two return values.
func (*MapIterator[K, V]) Key ¶
func (i *MapIterator[K, V]) Key() K
Key returns the key for the current entry.
func (*MapIterator[K, V]) Next ¶
func (i *MapIterator[K, V]) Next() bool
Next moves to the next key-value pair or returns false if there are no more.
func (*MapIterator[K, V]) Value ¶
func (i *MapIterator[K, V]) Value() V
Value returns the value for the current entry.
type Set ¶
type Set[T any] struct { // contains filtered or unexported fields }
Set holds a set of values of type T. The zero value is the empty Set.
func Iota3 ¶
Iota3 returns a Set with elements {start, start+step, start+2*step, ...} up to but not including stop. Negative steps are allowed.
func NewSetFromMask64 ¶
NewSetFromMask64 returns a Set containing all elements 2**i such that bit i of mask is set.
func (Set[T]) Difference ¶
Difference returns a Set with all elements that are s but not in t.
func (Set[T]) Intersection ¶
Intersection returns a Set with all elements that are in both s and t.
func (Set[T]) IsSubsetOf ¶
IsSubsetOf returns true iff no element in s is not in t.
func (Set[T]) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Set[T]) OrderedElements ¶
OrderedElements takes elements in a defined order.
func (Set[T]) OrderedFirstN ¶
OrderedFirstN returns a list of elements in a defined order.
func (Set[T]) OrderedRange ¶
OrderedRange returns a SetIterator for the Set that iterates over the elements in a specified order.
func (Set[T]) SymmetricDifference ¶
SymmetricDifference returns a Set with all elements that are s or t, but not both.
type SetBuilder ¶
type SetBuilder[T any] struct { // contains filtered or unexported fields }
SetBuilder[T] provides a more efficient way to build sets incrementally.
func NewSetBuilder ¶
func NewSetBuilder[T any](capacity int) *SetBuilder[T]
func (*SetBuilder[T]) Add ¶
func (b *SetBuilder[T]) Add(v T)
Add adds el to the Set under construction.
func (*SetBuilder[T]) Count ¶
func (b *SetBuilder[T]) Count() int
Count returns the count of the Set that will be returned from Finish().
func (*SetBuilder[T]) Finish ¶
func (b *SetBuilder[T]) Finish() Set[T]
Finish returns a Set containing all elements added since the SetBuilder[T] was initialised or the last call to Finish.
func (*SetBuilder[T]) Has ¶
func (b *SetBuilder[T]) Has(v T) bool
func (*SetBuilder[T]) Remove ¶
func (b *SetBuilder[T]) Remove(v T)
Remove removes el to the Set under construction.
func (SetBuilder[T]) String ¶
func (b SetBuilder[T]) String() string