ToSliceOrdered - returns Set as a sorted slice for ordered types. This is a convenience method for types that implement cmp.Ordered. The result is deterministic and always sorted in ascending order.
(set Set[T])
| 55 | // This is a convenience method for types that implement cmp.Ordered. |
| 56 | // The result is deterministic and always sorted in ascending order. |
| 57 | func ToSliceOrdered[T cmp.Ordered](set Set[T]) []T { |
| 58 | keys := make([]T, 0, len(set)) |
| 59 | for k := range set { |
| 60 | keys = append(keys, k) |
| 61 | } |
| 62 | slices.Sort(keys) |
| 63 | return keys |
| 64 | } |
| 65 | |
| 66 | // IsEmpty - returns whether the set is empty or not. |
| 67 | func (set Set[T]) IsEmpty() bool { |
no outgoing calls