MCPcopy
hub / github.com/gogf/gf / ExampleIntSet_Complement

Function ExampleIntSet_Complement

container/gset/gset_z_example_int_test.go:113–120  ·  view source on GitHub ↗

Complement returns a new set which is the complement from `set` to `full`. Which means, all the items in `newSet` are in `full` and not in `set`. It returns the difference between `full` and `set` if the given set `full` is not the full set of `set`.

()

Source from the content-addressed store, hash-verified

111// Which means, all the items in `newSet` are in `full` and not in `set`.
112// It returns the difference between `full` and `set` if the given set `full` is not the full set of `set`.
113func ExampleIntSet_Complement() {
114 intSet := gset.NewIntSetFrom([]int{1, 2, 3, 4, 5})
115 s := gset.NewIntSetFrom([]int{1, 2, 3})
116 fmt.Println(s.Complement(intSet).Slice())
117
118 // May Output:
119 // [4 5]
120}
121
122// Contains checks whether the set contains `item`.
123func ExampleIntSet_Contains() {

Callers

nothing calls this directly

Calls 3

NewIntSetFromFunction · 0.92
SliceMethod · 0.45
ComplementMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…