1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 00:22:41 +08:00
This commit is contained in:
2022-11-18 16:53:59 +08:00
parent 6e24cf5bdc
commit b76be4ce6b
17 changed files with 103 additions and 180 deletions

View File

@ -27,7 +27,7 @@ func NewHashSet[T constraints.Ordered](values ...T) *hash_set[T] {
return &set
}
func (s *hash_set[T]) WithSync() *hash_set[T] {
func (s *hash_set[T]) Sync() *hash_set[T] {
s.lock = locker.NewRWLocker()
return s
}
@ -99,6 +99,10 @@ func (s hash_set[T]) copyToSorted() Set[T] {
return orderd
}
func (s *hash_set[T]) Shrink() *hash_set[T] {
return s
}
func (s *hash_set[T]) Clone() *hash_set[T] {
set := NewHashSet[T]()
set.Add(s.ToSlice()...)