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

Function ExampleSet_intSet

pkg/set/example_test.go:51–71  ·  view source on GitHub ↗

ExampleSet_intSet demonstrates set operations with integers

()

Source from the content-addressed store, hash-verified

49
50// ExampleSet_intSet demonstrates set operations with integers
51func ExampleSet_intSet() {
52 setA := set.Create(1, 2, 3, 4)
53 setB := set.Create(3, 4, 5, 6)
54
55 // Union
56 union := setA.Union(setB)
57 fmt.Println("Union:", set.ToSliceOrdered(union))
58
59 // Intersection
60 intersection := setA.Intersection(setB)
61 fmt.Println("Intersection:", set.ToSliceOrdered(intersection))
62
63 // Difference
64 difference := setA.Difference(setB)
65 fmt.Println("Difference:", set.ToSliceOrdered(difference))
66
67 // Output:
68 // Union: [1 2 3 4 5 6]
69 // Intersection: [3 4]
70 // Difference: [1 2]
71}
72
73// ExampleSet_stringSet demonstrates using generic Set with strings
74func ExampleSet_stringSet() {

Callers

nothing calls this directly

Calls 5

CreateFunction · 0.92
ToSliceOrderedFunction · 0.92
UnionMethod · 0.45
IntersectionMethod · 0.45
DifferenceMethod · 0.45

Tested by

no test coverage detected