Skip to content

Latest commit

 

History

History

hashset

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

hashset

Go Version Go Reference Build Status License

Generic hashset of Golang. Golang 泛型 hashset 实现。

Need v1.18+

Example

{
    hash := hashset.New[string, string]()
    hash.Set("name", "tom")
    hash.Set("name2", "tom")

	fmt.Println(hash.Get("name")) // "tom"
	fmt.Println(hash.Has("name")) // true
	fmt.Println(hash.Has("name2")) // false
}

Installation

go get github.com/shalldie/gog/hashset

Description

HashSet is a collection that contains no duplicate elements, the usage can refer to HashMap.

HashSet 是一个不允许有重复元素的集合,使用方式可参考 HashMap

License

MIT