Documentation ¶
Index ¶
- type LinkedMap
- func (lm *LinkedMap[K, V]) Capacity() int
- func (lm *LinkedMap[K, V]) Clear()
- func (lm *LinkedMap[K, V]) Empty() bool
- func (lm *LinkedMap[K, V]) Full() bool
- func (lm *LinkedMap[K, V]) GetNode(key K) *ll.Element[Pair[K, V]]
- func (lm *LinkedMap[K, V]) Has(key K) bool
- func (lm *LinkedMap[K, V]) HeadNode() *ll.Element[Pair[K, V]]
- func (lm *LinkedMap[K, V]) PushBack(key K, value V)
- func (lm *LinkedMap[K, V]) PushFront(key K, value V)
- func (lm *LinkedMap[K, V]) Remove(key K) bool
- func (lm *LinkedMap[K, V]) RemoveHead()
- func (lm *LinkedMap[K, V]) RemoveTail()
- func (lm *LinkedMap[K, V]) SetCapacity(capacity int)
- func (lm *LinkedMap[K, V]) Size() int
- func (lm *LinkedMap[K, V]) TailNode() *ll.Element[Pair[K, V]]
- type Pair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LinkedMap ¶
type LinkedMap[K comparable, V any] struct { // contains filtered or unexported fields }
func New ¶ added in v0.19.0
func New[K comparable, V any](capacity int) *LinkedMap[K, V]
New creates a new LinkedMap with the specified capacity.
func (*LinkedMap[K, V]) Clear ¶
func (lm *LinkedMap[K, V]) Clear()
Clear removes all key-value pairs from the LinkedMap, making it empty.
func (*LinkedMap[K, V]) Empty ¶
Empty checks if the LinkedMap is empty (contains no key-value pairs).
func (*LinkedMap[K, V]) GetNode ¶ added in v0.12.0
GetNode returns the LinkNode corresponding to the specified key.
func (*LinkedMap[K, V]) HeadNode ¶ added in v0.12.0
HeadNode returns the LinkNode at the beginning (head) of the LinkedMap.
func (*LinkedMap[K, V]) PushBack ¶
func (lm *LinkedMap[K, V]) PushBack(key K, value V)
PushBack adds a new key-value pair to the end of the LinkedMap.
func (*LinkedMap[K, V]) PushFront ¶
func (lm *LinkedMap[K, V]) PushFront(key K, value V)
PushFront adds a new key-value pair to the beginning of the LinkedMap.
func (*LinkedMap[K, V]) Remove ¶
Remove removes the key-value pair with the specified key from the LinkedMap. It returns true if the key was found and removed, otherwise false.
func (*LinkedMap[K, V]) RemoveHead ¶ added in v0.19.0
func (lm *LinkedMap[K, V]) RemoveHead()
func (*LinkedMap[K, V]) RemoveTail ¶ added in v0.19.0
func (lm *LinkedMap[K, V]) RemoveTail()
func (*LinkedMap[K, V]) SetCapacity ¶
SetCapacity sets the capacity of the LinkedMap and prunes the excess elements if needed.
type Pair ¶
type Pair[K comparable, V any] struct { Key K Value V }