Documentation ¶
Overview ¶
implentation of a safe concurrent generic map
Index ¶
- type HashMap
- func (s *HashMap[K, V]) Clear()
- func (s *HashMap[K, V]) Contains(key K) bool
- func (s *HashMap[K, V]) Delete(key K)
- func (s *HashMap[K, V]) Get(key K) (V, bool)
- func (s *HashMap[K, V]) IsEmpty() bool
- func (s *HashMap[K, V]) Keys() []K
- func (s *HashMap[K, V]) Len() int
- func (s *HashMap[K, V]) Set(key K, value V)
- func (s *HashMap[K, V]) Values() []V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HashMap ¶
type HashMap[K comparable, V any] struct { // contains filtered or unexported fields }
HashMap is a generic implementation of a safe map. K is the key and V is the value.
Important for multiple concurrent reads and few writes. since it's guarded by sync.RWMutex
func NewHashMap ¶
func NewHashMap[K comparable, V any]() *HashMap[K, V]
Instantiates a new AsyncMap.
func (*HashMap[K, V]) Delete ¶
func (s *HashMap[K, V]) Delete(key K)
deletes the element with the specified key
func (*HashMap[K, V]) Keys ¶
func (s *HashMap[K, V]) Keys() []K
Returns a slice of the keys in the map
Click to show internal directories.
Click to hide internal directories.