ordered

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map[K comparable, V any] struct {
	// contains filtered or unexported fields
}

Map is the Collection implementation that provides element access by an unique key.

func ConvertKVsToMap

func ConvertKVsToMap[K comparable, V any](elements []c.KV[K, V]) Map[K, V]

ConvertKVsToMap converts a slice of key/value pairs to the Map.

func NewMap

func NewMap[K comparable, V any](elements map[K]V) Map[K, V]

NewMap instantiates Map and copies elements to it.

func WrapMap

func WrapMap[K comparable, V any](order []K, elements map[K]V) Map[K, V]

WrapMap instantiates ordered Map using a map and an order slice as internal storage.

func (Map[K, V]) Begin

func (s Map[K, V]) Begin() c.KVIterator[K, V]

func (Map[K, V]) Collect

func (s Map[K, V]) Collect() map[K]V

func (Map[K, V]) Contains

func (s Map[K, V]) Contains(key K) bool

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]) FilterKey

func (s Map[K, V]) FilterKey(fit c.Predicate[K]) c.MapPipe[K, V, map[K]V]

func (Map[K, V]) FilterValue

func (s Map[K, V]) FilterValue(fit c.Predicate[V]) c.MapPipe[K, V, map[K]V]

func (Map[K, V]) First

func (s Map[K, V]) First() (it.OrderedEmbedMapKVIter[K, V], K, V, bool)

func (Map[K, V]) For

func (s Map[K, V]) For(walker func(c.KV[K, V]) error) error

func (Map[K, V]) ForEach

func (s Map[K, V]) ForEach(walker func(c.KV[K, V]))

func (Map[K, V]) Get

func (s Map[K, V]) Get(key K) (V, bool)

func (Map[K, V]) Head

func (s Map[K, V]) Head() it.OrderedEmbedMapKVIter[K, V]

func (Map[K, V]) IsEmpty

func (s Map[K, V]) IsEmpty() bool

func (Map[K, V]) K

func (s Map[K, V]) K() MapKeys[K]

func (Map[K, V]) Keys

func (s Map[K, V]) Keys() c.Collection[K, []K, c.Iterator[K]]

func (Map[K, V]) Len

func (s Map[K, V]) Len() int

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]) MapKey

func (s Map[K, V]) MapKey(by c.Converter[K, K]) c.MapPipe[K, V, map[K]V]

func (Map[K, V]) MapValue

func (s Map[K, V]) MapValue(by c.Converter[V, 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)

func (Map[K, V]) Sort

func (s Map[K, V]) Sort(less slice.Less[K]) Map[K, V]

func (Map[K, V]) StableSort added in v0.0.5

func (s Map[K, V]) StableSort(less slice.Less[K]) Map[K, V]

func (Map[K, V]) String

func (s Map[K, V]) String() string

func (Map[K, V]) Tail

func (s Map[K, V]) Tail() it.OrderedEmbedMapKVIter[K, V]

func (Map[K, V]) Track

func (s Map[K, V]) Track(tracker func(K, V) error) error

func (Map[K, V]) TrackEach

func (s Map[K, V]) TrackEach(tracker func(K, V))

func (Map[K, V]) V

func (s Map[K, V]) V() MapValues[K, V]

func (Map[K, V]) Values

func (s Map[K, V]) Values() c.Collection[V, []V, c.Iterator[V]]

type MapKeys

type MapKeys[T comparable] struct {
	// contains filtered or unexported fields
}

MapKeys is the wrapper for Map's keys

func WrapKeys

func WrapKeys[T comparable](elements []T) MapKeys[T]

WrapKeys instantiates MapKeys using elements as internal storage

func (MapKeys[T]) Begin

func (s MapKeys[T]) Begin() c.Iterator[T]

func (MapKeys[T]) Collect

func (s MapKeys[T]) Collect() []T

func (MapKeys[T]) Filter

func (s MapKeys[T]) Filter(filter c.Predicate[T]) c.Pipe[T, []T]

func (MapKeys[T]) First

func (s MapKeys[T]) First() (it.ArrayIter[T], T, bool)

func (MapKeys[T]) For

func (s MapKeys[T]) For(walker func(T) error) error

func (MapKeys[T]) ForEach

func (s MapKeys[T]) ForEach(walker func(T))

func (MapKeys[T]) Get

func (s MapKeys[T]) Get(index int) (T, bool)

func (MapKeys[T]) Head

func (s MapKeys[T]) Head() it.ArrayIter[T]

func (MapKeys[T]) IsEmpty

func (s MapKeys[T]) IsEmpty() bool

func (MapKeys[T]) Len

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

func (MapKeys[T]) Map

func (s MapKeys[T]) Map(by c.Converter[T, T]) c.Pipe[T, []T]

func (MapKeys[T]) Reduce

func (s MapKeys[T]) Reduce(by c.Binary[T]) T

func (MapKeys[T]) String

func (s MapKeys[T]) String() string

type MapValues

type MapValues[K comparable, V any] struct {
	// contains filtered or unexported fields
}

MapValues is the wrapper for Map's values.

func WrapVal

func WrapVal[K comparable, V any](order []K, elements map[K]V) MapValues[K, V]

WrapVal instantiates MapValues using elements as internal storage.

func (MapValues[K, V]) Begin

func (s MapValues[K, V]) Begin() c.Iterator[V]

func (MapValues[K, V]) Collect

func (s MapValues[K, V]) Collect() []V

func (MapValues[K, V]) Filter

func (s MapValues[K, V]) Filter(filter c.Predicate[V]) c.Pipe[V, []V]

func (MapValues[K, V]) First

func (s MapValues[K, V]) First() (*ValIter[K, V], V, bool)

func (MapValues[K, V]) For

func (s MapValues[K, V]) For(walker func(V) error) error

func (MapValues[K, V]) ForEach

func (s MapValues[K, V]) ForEach(walker func(V))

func (MapValues[K, V]) Get

func (s MapValues[K, V]) Get(index int) (V, bool)

func (MapValues[K, V]) Head

func (s MapValues[K, V]) Head() *ValIter[K, V]

func (MapValues[K, V]) IsEmpty

func (s MapValues[K, V]) IsEmpty() bool

func (MapValues[K, V]) Len

func (s MapValues[K, V]) Len() int

func (MapValues[K, V]) Map

func (s MapValues[K, V]) Map(by c.Converter[V, V]) c.Pipe[V, []V]

func (MapValues[K, V]) Reduce

func (s MapValues[K, V]) Reduce(by c.Binary[V]) V

func (MapValues[K, V]) String

func (s MapValues[K, V]) String() string

type Set

type Set[T comparable] struct {
	// contains filtered or unexported fields
}

Set is the Collection implementation that provides element uniqueness and access order. The elements must be comparable.

func NewSet

func NewSet[T comparable](elements []T) Set[T]

NewSet instantiates Set and copies elements to it.

func WrapSet

func WrapSet[T comparable](order []T, elements map[T]struct{}) Set[T]

WrapSet creates a set using a map and an order slice as the internal storage.

func (Set[T]) Begin

func (s Set[T]) Begin() c.Iterator[T]

func (Set[T]) Collect

func (s Set[T]) Collect() []T

func (Set[T]) Contains

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

func (Set[T]) Filter

func (s Set[T]) Filter(filter c.Predicate[T]) c.Pipe[T, []T]

func (Set[T]) First

func (s Set[T]) First() (it.ArrayIter[T], T, bool)

func (Set[T]) For

func (s Set[T]) For(walker func(T) error) error

func (Set[T]) ForEach

func (s Set[T]) ForEach(walker func(T))

func (Set[T]) Head

func (s Set[T]) Head() it.ArrayIter[T]

func (Set[T]) IsEmpty

func (s Set[T]) IsEmpty() bool

func (Set[T]) Last

func (s Set[T]) Last() (it.ArrayIter[T], T, bool)

func (Set[T]) Len

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

func (Set[T]) Map

func (s Set[T]) Map(by c.Converter[T, T]) c.Pipe[T, []T]

func (Set[T]) Reduce

func (s Set[T]) Reduce(by c.Binary[T]) T

func (Set[T]) Revert

func (s Set[T]) Revert() it.ArrayIter[T]

func (Set[T]) Sort

func (s Set[T]) Sort(less slice.Less[T]) Set[T]

func (Set[T]) StableSort added in v0.0.5

func (s Set[T]) StableSort(less slice.Less[T]) Set[T]

func (Set[T]) String

func (s Set[T]) String() string

type ValIter

type ValIter[K comparable, V any] struct {
	// contains filtered or unexported fields
}

ValIter is the Iteratoc over Map values

func NewValIter

func NewValIter[K comparable, V any](elements []K, uniques map[K]V) *ValIter[K, V]

NewValIter is default ValIter constructor

func (*ValIter[K, V]) Cap

func (s *ValIter[K, V]) Cap() int

func (*ValIter[K, V]) Next

func (s *ValIter[K, V]) Next() (V, bool)

Jump to

Keyboard shortcuts

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