MCPcopy
hub / github.com/minio/minio-go / ToSliceOrdered

Function ToSliceOrdered

pkg/set/set.go:57–64  ·  view source on GitHub ↗

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])

Source from the content-addressed store, hash-verified

55// This is a convenience method for types that implement cmp.Ordered.
56// The result is deterministic and always sorted in ascending order.
57func 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.
67func (set Set[T]) IsEmpty() bool {

Callers 13

ExampleFunction · 0.92
ExampleSet_intSetFunction · 0.92
ExampleSet_stringSetFunction · 0.92
ExampleSet_float64SetFunction · 0.92
ExampleSet_ApplyFuncFunction · 0.92
ExampleSet_FuncMatchFunction · 0.92
ExampleCopyFunction · 0.92
ExampleSet_customTypeFunction · 0.92
ExampleToSliceOrderedFunction · 0.92
ExampleNewFunction · 0.92
ToSliceMethod · 0.85
TestToSliceOrderedFunction · 0.85

Calls

no outgoing calls

Tested by 11

ExampleFunction · 0.74
ExampleSet_intSetFunction · 0.74
ExampleSet_stringSetFunction · 0.74
ExampleSet_float64SetFunction · 0.74
ExampleSet_ApplyFuncFunction · 0.74
ExampleSet_FuncMatchFunction · 0.74
ExampleCopyFunction · 0.74
ExampleSet_customTypeFunction · 0.74
ExampleToSliceOrderedFunction · 0.74
ExampleNewFunction · 0.74
TestToSliceOrderedFunction · 0.68