Documentation
¶
Overview ¶
Package hashablemaps offers tools for handling and manipulating map data structures with hashable keys.
Index ¶
- func Add[H godash.Hashable](m *HashableMap[H], v H)
- func AddAll[H godash.Hashable](m *HashableMap[H], v ...H)
- func Contains[H godash.Hashable](m HashableMap[H], key string) bool
- func FromHashableMap[H godash.Hashable](m HashableMap[H]) (ps []godash.Pair[string, H])
- func Keys[H godash.Hashable](m HashableMap[H]) []string
- func Remove[H godash.Hashable](m *HashableMap[H], key string)
- func RemoveAll[H godash.Hashable](m *HashableMap[H], ks ...string)
- func Values[H godash.Hashable](m HashableMap[H]) []H
- type HashableMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Add ¶
func Add[H godash.Hashable](m *HashableMap[H], v H)
Add adds the key value pair to the HashableMap. Modifies the map in place, does not return a new HashableMap.
func AddAll ¶
func AddAll[H godash.Hashable](m *HashableMap[H], v ...H)
AddAll adds a new element to the HashableMap. Modifies the map in place, does not return a new HashableMap.
func Contains ¶
func Contains[H godash.Hashable](m HashableMap[H], key string) bool
Contains returns true if the hashmap contains the key.
func FromHashableMap ¶
FromHashableMap returns an array of the key value pairs in the map.
func Keys ¶
func Keys[H godash.Hashable](m HashableMap[H]) []string
Keys returns a slice of the keys in the HashableMap.
func Remove ¶
func Remove[H godash.Hashable](m *HashableMap[H], key string)
Remove removes the key and associated value from the HashableMap.
func RemoveAll ¶
func RemoveAll[H godash.Hashable](m *HashableMap[H], ks ...string)
RemoveAll removes the keys with the associated values from the HashableMap.
func Values ¶
func Values[H godash.Hashable](m HashableMap[H]) []H
Values returns a slice of the values in the HashableMap.
Types ¶
type HashableMap ¶
HashableMap is a map of Hashable objects, where the key is the hash of the object.
func ToHashableMap ¶
func ToHashableMap[H godash.Hashable](hs []H) (m HashableMap[H])
ToHashableMap returns a map of the key value pairs passed in.