迭代器示例集合增加切片批量添加功能
This commit is contained in:
parent
9c8037fc96
commit
a2ac2bf94e
@ -24,14 +24,14 @@ func NewOrderedSet[T comparable]() *OrderedSet[T] {
|
||||
return &OrderedSet[T]{make([]T, 0), NewSet[T]()}
|
||||
}
|
||||
|
||||
func (s Set[T]) FromSlice(data []T) {
|
||||
for v := range slices.Values(data) {
|
||||
func (s Set[T]) FromSlice(slice []T) {
|
||||
for v := range slices.Values(slice) {
|
||||
s.Add(v)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *OrderedSet[T]) FromSlice(data []T) {
|
||||
for v := range slices.Values(data) {
|
||||
func (s *OrderedSet[T]) FromSlice(slice []T) {
|
||||
for v := range slices.Values(slice) {
|
||||
s.Add(v)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user