Skip to content

Commit

Permalink
feat: add GetOrSet
Browse files Browse the repository at this point in the history
  • Loading branch information
duke-git committed Jun 24, 2024
1 parent a220220 commit ca373b0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion maputil/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ func ToSortedSlicesWithComparator[K comparable, V any](m map[K]V, comparator fun
return keys, sortedValues
}

// GetOrSet returns value of the given key or set the given value value if not present
// GetOrSet returns value of the given key or set the given value value if not present.
// Play: todo
func GetOrSet[K comparable, V any](m map[K]V, key K, value V) V {
if v, ok := m[key]; ok {
Expand Down

0 comments on commit ca373b0

Please sign in to comment.