Documentation ¶
Index ¶
- type Map
- type Number
- type OrderedMap
- func (m *OrderedMap[K, V]) Empty() bool
- func (m *OrderedMap[K, V]) Foreach(callback func(key K, value V) bool)
- func (m *OrderedMap[K, V]) Get(key K) (value V, ok bool)
- func (m *OrderedMap[K, V]) Keys() []K
- func (m *OrderedMap[K, V]) Put(key K, value V)
- func (m *OrderedMap[K, V]) Remove(key K)
- func (m *OrderedMap[K, V]) Size() int
- func (m *OrderedMap[K, V]) String() string
- func (m *OrderedMap[K, V]) Values() []V
- type OrderedSet
- func (s *OrderedSet[T]) Add(items ...T)
- func (s *OrderedSet[T]) Contains(items ...T) bool
- func (s *OrderedSet[T]) Empty() bool
- func (s *OrderedSet[T]) Foreach(callback func(i int, val T) bool)
- func (s *OrderedSet[T]) FromList(list []T)
- func (s *OrderedSet[T]) MarshalJSON() ([]byte, error)
- func (s *OrderedSet[T]) Remove(items ...T)
- func (s *OrderedSet[T]) Size() int
- func (s *OrderedSet[T]) String() string
- func (s *OrderedSet[T]) UnmarshalJSON(data []byte) error
- func (s *OrderedSet[T]) Values() []T
- type Slice
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 }
func NewMap ¶ added in v0.0.3
func NewMap[K comparable, V any]() *Map[K, V]
type OrderedMap ¶
type OrderedMap[K comparable, V any] struct { // contains filtered or unexported fields }
OrderedMap represents an associative array or map abstract data type.
func NewOrderedMap ¶
func NewOrderedMap[K comparable, V any]() *OrderedMap[K, V]
NewOrderedMap creates a new empty OrderedMap.
func (*OrderedMap[K, V]) Empty ¶
func (m *OrderedMap[K, V]) Empty() bool
Empty return if the map in empty or not.
func (*OrderedMap[K, V]) Foreach ¶
func (m *OrderedMap[K, V]) Foreach(callback func(key K, value V) bool)
Foreach iter map.
func (*OrderedMap[K, V]) Get ¶
func (m *OrderedMap[K, V]) Get(key K) (value V, ok bool)
Get returns the value of a key from the OrderedMap.
func (*OrderedMap[K, V]) Keys ¶
func (m *OrderedMap[K, V]) Keys() []K
Keys return the keys in the map in insertion order.
func (*OrderedMap[K, V]) Put ¶
func (m *OrderedMap[K, V]) Put(key K, value V)
Put adds items to the map.
If a key is found in the map it replaces it value.
func (*OrderedMap[K, V]) Remove ¶
func (m *OrderedMap[K, V]) Remove(key K)
Remove deletes a key-value pair from the OrderedMap.
If a key is not found in the map it doesn't fails, just does nothing.
func (*OrderedMap[K, V]) Size ¶
func (m *OrderedMap[K, V]) Size() int
Size return the map number of key-value pairs.
func (*OrderedMap[K, V]) String ¶
func (m *OrderedMap[K, V]) String() string
String implements Stringer interface.
Prints the map string representation, a concatenated string of all its string representation values in insertion order.
func (*OrderedMap[K, V]) Values ¶
func (m *OrderedMap[K, V]) Values() []V
Values return the values in the map in insertion order.
type OrderedSet ¶
type OrderedSet[T any] struct { // contains filtered or unexported fields }
OrderedSet represents a dynamic, insertion-ordered, set abstract data type.
func NewOrderedSet ¶
func NewOrderedSet[T comparable]() *OrderedSet[T]
NewOrderedSet creates a new empty OrderedSet.
func (*OrderedSet[T]) Add ¶
func (s *OrderedSet[T]) Add(items ...T)
Add adds items to the set.
If an item is found in the set it replaces it.
func (*OrderedSet[T]) Contains ¶
func (s *OrderedSet[T]) Contains(items ...T) bool
Contains return if set contains the specified items or not.
func (*OrderedSet[T]) Empty ¶
func (s *OrderedSet[T]) Empty() bool
Empty return if the set in empty or not.
func (*OrderedSet[T]) Foreach ¶
func (s *OrderedSet[T]) Foreach(callback func(i int, val T) bool)
Foreach iter set.
func (*OrderedSet[T]) FromList ¶ added in v0.0.6
func (s *OrderedSet[T]) FromList(list []T)
FromList converts a list to an OrderedSet.
func (*OrderedSet[T]) MarshalJSON ¶ added in v0.0.6
func (s *OrderedSet[T]) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (*OrderedSet[T]) Remove ¶
func (s *OrderedSet[T]) Remove(items ...T)
Remove deletes items from the set.
If an item is not found in the set it doesn't fails, just does nothing.
func (*OrderedSet[T]) Size ¶
func (s *OrderedSet[T]) Size() int
Size return the set number of elements.
func (*OrderedSet[T]) String ¶
func (s *OrderedSet[T]) String() string
String implements Stringer interface.
Prints the set string representation, a concatenated string of all its string representation values in insertion order.
func (*OrderedSet[T]) UnmarshalJSON ¶ added in v0.0.6
func (s *OrderedSet[T]) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
func (*OrderedSet[T]) Values ¶
func (s *OrderedSet[T]) Values() []T
Values return the set values in insertion order.