1
0
Fork 0
forked from External/ergo

clean up force-trailing logic

This commit is contained in:
Shivaram Lingamneni 2023-06-01 06:28:02 -04:00
parent 38a6d17ee5
commit 60af8ee491
3 changed files with 25 additions and 19 deletions

View file

@ -20,6 +20,14 @@ func (s HashSet[T]) Remove(elem T) {
delete(s, elem)
}
func SetLiteral[T comparable](elems ...T) HashSet[T] {
result := make(HashSet[T], len(elems))
for _, elem := range elems {
result.Add(elem)
}
return result
}
func CopyMap[K comparable, V any](input map[K]V) (result map[K]V) {
result = make(map[K]V, len(input))
for key, value := range input {