Documentation ¶
Index ¶
- func AreMapsEqual[K comparable, V comparable](a map[K]V, b map[K]V) bool
- func ArrayToMapInterface[T comparable](list []T) map[T]struct{}
- func GetSortedKeys[K constraints.Ordered, V any](m map[K]V) []K
- func InvertMustHaveDistinctValues[K comparable, V comparable](m map[K]V) map[V]K
- func MergeAllMapsMustHaveDistinctKeys[K comparable, V any](maps ...map[K]V) map[K]V
- func ShallowCopy[K comparable, V any](originalMap map[K]V) map[K]V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreMapsEqual ¶
func AreMapsEqual[K comparable, V comparable](a map[K]V, b map[K]V) bool
AreMapsEqual returns true if the two maps are equal. Two maps are equal if they have the same keys and values.
func ArrayToMapInterface ¶
func ArrayToMapInterface[T comparable](list []T) map[T]struct{}
func GetSortedKeys ¶
func GetSortedKeys[K constraints.Ordered, V any](m map[K]V) []K
GetSortedKeys returns the keys of the map in sorted order.
func InvertMustHaveDistinctValues ¶
func InvertMustHaveDistinctValues[K comparable, V comparable](m map[K]V) map[V]K
InvertMustHaveDistinctValues returns a new map with the keys and values of the input map swapped. If there are duplicate values in the input map, the method will panic.
func MergeAllMapsMustHaveDistinctKeys ¶
func MergeAllMapsMustHaveDistinctKeys[K comparable, V any](maps ...map[K]V) map[K]V
MergeAllMapsMustHaveDistinctKeys merges all the maps into a single map. Panics if there are duplicate keys.
func ShallowCopy ¶
func ShallowCopy[K comparable, V any](originalMap map[K]V) map[K]V
Copy returns a shallow copy of originalMap. Parameters:
- originalMap: The map to be copied.
Returns:
A new map containing all the keys and values from originalMap.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.