mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 08:32:40 +08:00
17 lines
247 B
Go
17 lines
247 B
Go
package sets
|
|
|
|
type sorted_set[T comparable] struct {
|
|
sorted []T
|
|
set Set[T]
|
|
}
|
|
|
|
func NewSortedSet[T comparable]() *sorted_set[T] {
|
|
return &sorted_set[T]{
|
|
set: NewHashSet[T](),
|
|
}
|
|
}
|
|
|
|
func (s *sorted_set[T]) ToSlice() []T {
|
|
return s.sorted
|
|
}
|