Documentation
¶
Overview ¶
Package mutable provides implementations of mutable containers.
Index ¶
- type Iter
- func (i *Iter[T, TS]) Cap() int
- func (i *Iter[T, TS]) Delete() bool
- func (i *Iter[T, TS]) DeleteNext() bool
- func (i *Iter[T, TS]) DeletePrev() bool
- func (i *Iter[T, TS]) Get() (T, bool)
- func (i *Iter[T, TS]) GetNext() T
- func (i *Iter[T, TS]) GetPrev() T
- func (i *Iter[T, TS]) HasNext() bool
- func (i *Iter[T, TS]) HasPrev() bool
- func (i *Iter[T, TS]) Next() (T, bool)
- func (i *Iter[T, TS]) Prev() (T, bool)
- type Map
- func (s Map[K, V]) Begin() c.KVIterator[K, V]
- func (s Map[K, V]) Collect() map[K]V
- func (s Map[K, V]) Contains(key K) bool
- func (s Map[K, V]) Filter(filter c.BiPredicate[K, V]) c.MapPipe[K, V, map[K]V]
- func (s Map[K, V]) FilterKey(fit c.Predicate[K]) c.MapPipe[K, V, map[K]V]
- func (s Map[K, V]) FilterValue(fit c.Predicate[V]) c.MapPipe[K, V, map[K]V]
- func (s Map[K, V]) First() (it.KV[K, V], K, V, bool)
- func (s Map[K, V]) For(walker func(c.KV[K, V]) error) error
- func (s Map[K, V]) ForEach(walker func(c.KV[K, V]))
- func (s Map[K, V]) Get(key K) (V, bool)
- func (s Map[K, V]) Head() it.KV[K, V]
- func (s Map[K, V]) IsEmpty() bool
- func (s Map[K, V]) K() immutable.MapKeys[K, V]
- func (s Map[K, V]) Keys() c.Collection[K, []K, c.Iterator[K]]
- func (s Map[K, V]) Len() int
- func (s Map[K, V]) Map(by c.BiConverter[K, V, K, V]) c.MapPipe[K, V, map[K]V]
- func (s Map[K, V]) MapKey(by c.Converter[K, K]) c.MapPipe[K, V, map[K]V]
- func (s Map[K, V]) MapValue(by c.Converter[V, V]) c.MapPipe[K, V, map[K]V]
- func (s Map[K, V]) Reduce(by c.Quaternary[K, V]) (K, V)
- func (s Map[K, V]) Set(key K, value V) bool
- func (s Map[K, V]) String() string
- func (s Map[K, V]) Track(tracker func(K, V) error) error
- func (s Map[K, V]) TrackEach(tracker func(K, V))
- func (s Map[K, V]) V() immutable.MapValues[K, V]
- func (s Map[K, V]) Values() c.Collection[V, []V, c.Iterator[V]]
- type Set
- func (s Set[K]) Add(elements ...K) bool
- func (s Set[K]) AddAll(elements []K) bool
- func (s Set[K]) AddOne(element K) bool
- func (s Set[K]) Begin() c.Iterator[K]
- func (s Set[K]) BeginEdit() c.DelIterator[K]
- func (s Set[K]) Collect() []K
- func (s Set[K]) Contains(val K) bool
- func (s Set[T]) Copy() Set[T]
- func (s Set[K]) Delete(elements ...K) bool
- func (s Set[K]) DeleteOne(element K) bool
- func (s Set[K]) Filter(filter c.Predicate[K]) c.Pipe[K, []K]
- func (s Set[K]) For(walker func(K) error) error
- func (s Set[K]) ForEach(walker func(K))
- func (s Set[K]) Head() *SetIter[K]
- func (s Set[T]) IsEmpty() bool
- func (s Set[K]) Len() int
- func (s Set[K]) Map(by c.Converter[K, K]) c.Pipe[K, []K]
- func (s Set[K]) Reduce(by c.Binary[K]) K
- func (s Set[T]) Sort(less func(e1, e2 T) bool) *ordered.Set[T]
- func (s Set[K]) String() string
- type SetIter
- type Vector
- func (v *Vector[T]) Add(elements ...T) bool
- func (v *Vector[T]) AddAll(elements []T) bool
- func (v *Vector[T]) AddOne(element T) bool
- func (v *Vector[T]) Begin() c.Iterator[T]
- func (v *Vector[T]) BeginEdit() c.DelIterator[T]
- func (v *Vector[T]) Collect() []T
- func (v *Vector[T]) Copy() *Vector[T]
- func (v *Vector[T]) Delete(indexes ...int) bool
- func (v *Vector[T]) DeleteOne(index int) bool
- func (v *Vector[T]) Filter(filter c.Predicate[T]) c.Pipe[T, []T]
- func (v *Vector[T]) First() (Iter[T, Vector[T]], T, bool)
- func (v *Vector[T]) For(walker func(T) error) error
- func (v *Vector[T]) ForEach(walker func(T))
- func (v *Vector[T]) Get(index int) (T, bool)
- func (v *Vector[T]) Head() Iter[T, Vector[T]]
- func (v *Vector[T]) IsEmpty() bool
- func (v *Vector[T]) Last() (Iter[T, Vector[T]], T, bool)
- func (v *Vector[T]) Len() int
- func (v *Vector[T]) Map(by c.Converter[T, T]) c.Pipe[T, []T]
- func (v *Vector[T]) Reduce(by c.Binary[T]) T
- func (v *Vector[T]) Remove(index int) (T, bool)
- func (v *Vector[T]) Set(index int, value T) bool
- func (v *Vector[t]) Sort(less func(e1, e2 t) bool) *Vector[t]
- func (v *Vector[T]) String() string
- func (v *Vector[T]) Tail() Iter[T, Vector[T]]
- func (v *Vector[T]) Track(tracker func(int, T) error) error
- func (v *Vector[T]) TrackEach(tracker func(int, T))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Iter ¶
type Iter[T any, TS ~[]T] struct { // contains filtered or unexported fields }
Iter is the Iterator implementation for mutable containers.
func (*Iter[T, TS]) DeleteNext ¶
func (*Iter[T, TS]) DeletePrev ¶
type Map ¶
type Map[K comparable, V any] map[K]V
Map is the Collection implementation based on the embedded map.
func AsMap ¶
func AsMap[K comparable, V any](elements []c.KV[K, V]) Map[K, V]
AsMap converts a slice of key/value pairs to teh Map.
func NewMap ¶
func NewMap[K comparable, V any](capacity int) Map[K, V]
NewMap instantiates Map with a predefined capacity.
func ToMap ¶
func ToMap[K comparable, V any](elements map[K]V) Map[K, V]
ToMap instantiates Map and copies elements to it.
func WrapMap ¶
func WrapMap[K comparable, V any](elements map[K]V) Map[K, V]
WrapMap instantiates Map using a map as internal storage.
func (Map[K, V]) Begin ¶
func (s Map[K, V]) Begin() c.KVIterator[K, V]
func (Map[K, V]) Filter ¶
func (s Map[K, V]) Filter(filter c.BiPredicate[K, V]) c.MapPipe[K, V, map[K]V]
func (Map[K, V]) FilterValue ¶
func (Map[K, V]) Map ¶
func (s Map[K, V]) Map(by c.BiConverter[K, V, K, V]) c.MapPipe[K, V, map[K]V]
func (Map[K, V]) Reduce ¶
func (s Map[K, V]) Reduce(by c.Quaternary[K, V]) (K, V)
type Set ¶
type Set[K comparable] struct { // contains filtered or unexported fields }
Set is the Collection implementation that provides element uniqueness. The elements must be comparable.
func NewSet ¶
func NewSet[T comparable](capacity int) Set[T]
NewSet creates a set with a predefined capacity.
func ToSet ¶
func ToSet[T comparable](elements []T) Set[T]
ToSet converts an elements slice to the set containing them.
func WrapSet ¶
func WrapSet[K comparable](elements map[K]struct{}) Set[K]
WrapSet creates a set using a map as the internal storage.
func (Set[K]) BeginEdit ¶
func (s Set[K]) BeginEdit() c.DelIterator[K]
type SetIter ¶
type SetIter[K comparable] struct { it.Key[K, struct{}] // contains filtered or unexported fields }
SetIter is the Set Iterator implementation.
func NewSetIter ¶
func NewSetIter[K comparable](uniques map[K]struct{}, del func(element K) bool) *SetIter[K]
NewSetIter creates SetIter instance.
type Vector ¶
type Vector[T any] []T
Vector is the Collection implementation that provides elements order and index access.
func WrapVector ¶
WrapVector instantiates Vector using a slise as internal storage.
func (*Vector[T]) BeginEdit ¶
func (v *Vector[T]) BeginEdit() c.DelIterator[T]