Added reverse map
All checks were successful
ci / deploy (push) Successful in 50s

This commit is contained in:
Leon Mika 2025-02-16 11:12:43 +11:00
parent 97d4b9b4a1
commit c73e50a091

9
momap/rev.go Normal file
View file

@ -0,0 +1,9 @@
package momap
func ReverseMap[K, V comparable](m map[K]V) map[V]K {
revMap := make(map[V]K)
for k, v := range m {
revMap[v] = k
}
return revMap
}