扑克牌堆实现

This commit is contained in:
kercylan98
2023-06-21 19:28:31 +08:00
parent f414ffe28c
commit 52d707486a
11 changed files with 379 additions and 1 deletions

17
utils/hash/hash.go Normal file
View File

@@ -0,0 +1,17 @@
package hash
// Exist 检查特定 key 是否存在
func Exist[K comparable, V any](m map[K]V, key K) bool {
_, exist := m[key]
return exist
}
// AllExist 检查多个 key 是否存在
func AllExist[K comparable, V any](m map[K]V, keys ...K) bool {
for key := range m {
if _, exist := m[key]; !exist {
return false
}
}
return true
}