From ca373b00a7f18586af445728ec82a11ce0220688 Mon Sep 17 00:00:00 2001 From: dudaodong Date: Mon, 24 Jun 2024 17:29:12 +0800 Subject: [PATCH] feat: add GetOrSet --- maputil/map.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maputil/map.go b/maputil/map.go index b622be6..bd2a73d 100644 --- a/maputil/map.go +++ b/maputil/map.go @@ -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 {