1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-05 00:59:19 +02:00

Bump generics dependency

This commit is contained in:
Stefan Haller
2025-05-17 15:38:29 +02:00
parent 1fbfefa625
commit 5686e63af3
6 changed files with 75 additions and 12 deletions

View File

@ -11,12 +11,9 @@ func New[T comparable]() *Set[T] {
}
func NewFromSlice[T comparable](slice []T) *Set[T] {
hashMap := make(map[T]bool)
for _, value := range slice {
hashMap[value] = true
}
return &Set[T]{hashMap: hashMap}
result := &Set[T]{hashMap: make(map[T]bool, len(slice))}
result.Add(slice...)
return result
}
func (s *Set[T]) Add(values ...T) {