1 Star 0 Fork 0

人月神话/gods

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
hashset.go 799 Bytes
一键复制 编辑 原始数据 按行查看 历史
人月神话 提交于 2020-11-23 12:11 . add module
// Copyright (c) 2015, Emir Pasic. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import "gitee.com/lhjw9810/gods/sets/hashset"
// HashSetExample to demonstrate basic usage of HashSet
func main() {
set := hashset.New() // empty (keys are of type int)
set.Add(1) // 1
set.Add(2, 2, 3, 4, 5) // 3, 1, 2, 4, 5 (random order, duplicates ignored)
set.Remove(4) // 5, 3, 2, 1 (random order)
set.Remove(2, 3) // 1, 5 (random order)
set.Contains(1) // true
set.Contains(1, 5) // true
set.Contains(1, 6) // false
_ = set.Values() // []int{5,1} (random order)
set.Clear() // empty
set.Empty() // true
set.Size() // 0
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lhjw9810/gods.git
git@gitee.com:lhjw9810/gods.git
lhjw9810
gods
gods
v1.14.0

搜索帮助