Documentation ¶
Index ¶
- type OrderedMap
- func (self *OrderedMap[K, V]) Delete(k K) (value V, exists bool)
- func (self *OrderedMap[K, V]) DeleteAt(i int) (value V, exists bool)
- func (self *OrderedMap[K, V]) EnumKeys(f func(k K) bool)
- func (self *OrderedMap[K, V]) EnumValues(f func(v V) bool)
- func (self *OrderedMap[K, V]) Exists(k K) (b bool)
- func (self *OrderedMap[K, V]) Get(k K) (v V, b bool)
- func (self *OrderedMap[K, V]) GetAt(i int) (v V, b bool)
- func (self *OrderedMap[K, V]) Keys() (out []K)
- func (self *OrderedMap[K, V]) Len() int
- func (self *OrderedMap[K, V]) Put(k K, v V) (old V, found bool)
- func (self *OrderedMap[K, V]) Values() (out []V)
- type OrderedSyncMap
- func (self *OrderedSyncMap[K, V]) DeleteAt(i int) (v V, b bool)
- func (self *OrderedSyncMap[K, V]) EnumKeys(f func(k K) bool)
- func (self *OrderedSyncMap[K, V]) EnumValues(f func(v V) bool)
- func (self *OrderedSyncMap[K, V]) Exists(k K) (b bool)
- func (self *OrderedSyncMap[K, V]) Get(k K) (v V, b bool)
- func (self *OrderedSyncMap[K, V]) GetAt(i int) (v V, b bool)
- func (self *OrderedSyncMap[K, V]) Keys() (out []K)
- func (self *OrderedSyncMap[K, V]) Len() (l int)
- func (self *OrderedSyncMap[K, V]) Put(k K, v V)
- func (self *OrderedSyncMap[K, V]) Values() (out []V)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OrderedMap ¶
type OrderedMap[K comparable, V any] struct { // contains filtered or unexported fields }
OrderedMap is a generic ordered map which supports comparable keys and any type of value.
func MakeOrderedMap ¶
func MakeOrderedMap[K comparable, V any]() *OrderedMap[K, V]
MakeOrderedMap returns a new OrderedMap of key K and value V.
func (*OrderedMap[K, V]) Delete ¶
func (self *OrderedMap[K, V]) Delete(k K) (value V, exists bool)
Delete deletes an entry by key and returns value that was at that key and truth if item was found and deleted.
func (*OrderedMap[K, V]) DeleteAt ¶
func (self *OrderedMap[K, V]) DeleteAt(i int) (value V, exists bool)
Delete deletes entry at index i and returns value that was at that index and truth if item was found and deleted.
func (*OrderedMap[K, V]) EnumKeys ¶
func (self *OrderedMap[K, V]) EnumKeys(f func(k K) bool)
EnumKeys enumerates all keys in the map in order as added.
func (*OrderedMap[K, V]) EnumValues ¶
func (self *OrderedMap[K, V]) EnumValues(f func(v V) bool)
EnumValues enumerates all values in the map in order as added.
func (*OrderedMap[K, V]) Exists ¶
func (self *OrderedMap[K, V]) Exists(k K) (b bool)
Exists returns truth if an entry under key k exists.
func (*OrderedMap[K, V]) Get ¶
func (self *OrderedMap[K, V]) Get(k K) (v V, b bool)
Get returns the entry value under key k and a truth if found. if not found a zero value of entry value under key k is rturned.
func (*OrderedMap[K, V]) GetAt ¶
func (self *OrderedMap[K, V]) GetAt(i int) (v V, b bool)
GetAt returns value at index i and a truth if found/index is within range.
func (*OrderedMap[K, V]) Keys ¶
func (self *OrderedMap[K, V]) Keys() (out []K)
Keys returns all keys.
func (*OrderedMap[K, V]) Len ¶
func (self *OrderedMap[K, V]) Len() int
Len returns number of entries in the map.
func (*OrderedMap[K, V]) Put ¶
func (self *OrderedMap[K, V]) Put(k K, v V) (old V, found bool)
Put stores value v under key k and returns a value that was replaced and a truth if value existed under key k and was replaced.
func (*OrderedMap[K, V]) Values ¶
func (self *OrderedMap[K, V]) Values() (out []V)
Values returns all values.
type OrderedSyncMap ¶
type OrderedSyncMap[K comparable, V any] struct { // contains filtered or unexported fields }
OrderedSyncMap is a OrderedMap with a mutext that protects all operations.
func MakeOrderedSyncMap ¶
func MakeOrderedSyncMap[K comparable, V any]() *OrderedSyncMap[K, V]
MakeOrderedSyncMap returns a new OrderedSyncMap of key K and value V.
func (*OrderedSyncMap[K, V]) DeleteAt ¶
func (self *OrderedSyncMap[K, V]) DeleteAt(i int) (v V, b bool)
func (*OrderedSyncMap[K, V]) EnumKeys ¶
func (self *OrderedSyncMap[K, V]) EnumKeys(f func(k K) bool)
EnumKeys enumerates all keys in the map in order as added.
func (*OrderedSyncMap[K, V]) EnumValues ¶
func (self *OrderedSyncMap[K, V]) EnumValues(f func(v V) bool)
EnumValues enumerates all values in the map in order as added.
func (*OrderedSyncMap[K, V]) Exists ¶
func (self *OrderedSyncMap[K, V]) Exists(k K) (b bool)
func (*OrderedSyncMap[K, V]) Get ¶
func (self *OrderedSyncMap[K, V]) Get(k K) (v V, b bool)
func (*OrderedSyncMap[K, V]) GetAt ¶
func (self *OrderedSyncMap[K, V]) GetAt(i int) (v V, b bool)
func (*OrderedSyncMap[K, V]) Keys ¶
func (self *OrderedSyncMap[K, V]) Keys() (out []K)
Keys returns all keys.
func (*OrderedSyncMap[K, V]) Len ¶
func (self *OrderedSyncMap[K, V]) Len() (l int)
func (*OrderedSyncMap[K, V]) Put ¶
func (self *OrderedSyncMap[K, V]) Put(k K, v V)
func (*OrderedSyncMap[K, V]) Values ¶
func (self *OrderedSyncMap[K, V]) Values() (out []V)
Values returns all values.