Documentation
¶
Overview ¶
Package maputil includes some functions to manipulate map.
Index ¶
- func Filter[K comparable, V any](m map[K]V, predicate func(key K, value V) bool) map[K]V
- func ForEach[K comparable, V any](m map[K]V, iteratee func(key K, value V))
- func Intersect[K comparable, V any](maps ...map[K]V) map[K]V
- func IsDisjoint[K comparable, V any](mapA, mapB map[K]V) bool
- func Keys[K comparable, V any](m map[K]V) []K
- func Merge[K comparable, V any](maps ...map[K]V) map[K]V
- func Minus[K comparable, V any](mapA, mapB map[K]V) map[K]V
- func Values[K comparable, V any](m map[K]V) []V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filter ¶
func Filter[K comparable, V any](m map[K]V, predicate func(key K, value V) bool) map[K]V
Filter iterates over map, return a new map contains all key and value pairs pass the predicate function
func ForEach ¶
func ForEach[K comparable, V any](m map[K]V, iteratee func(key K, value V))
ForEach executes iteratee funcation for every key and value pair in map
func Intersect ¶
func Intersect[K comparable, V any](maps ...map[K]V) map[K]V
Intersect iterates over maps, return a new map of key and value pairs in all given maps
func IsDisjoint ¶ added in v2.1.3
func IsDisjoint[K comparable, V any](mapA, mapB map[K]V) bool
IsDisjoint two map are disjoint if they have no keys in common
func Merge ¶
func Merge[K comparable, V any](maps ...map[K]V) map[K]V
Merge maps, next key will overwrite previous key
func Minus ¶
func Minus[K comparable, V any](mapA, mapB map[K]V) map[K]V
Minus creates an map of whose key in mapA but not in mapB
func Values ¶
func Values[K comparable, V any](m map[K]V) []V
Values returns a slice of the map's values
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.