Add adds one or multiple items to the set.
()
| 37 | |
| 38 | // Add adds one or multiple items to the set. |
| 39 | func ExampleIntSet_Add() { |
| 40 | intSet := gset.NewIntSetFrom([]int{1, 2, 3}) |
| 41 | intSet.Add(1) |
| 42 | fmt.Println(intSet.Slice()) |
| 43 | fmt.Println(intSet.AddIfNotExist(1)) |
| 44 | |
| 45 | // May Output: |
| 46 | // [1 2 3] |
| 47 | // false |
| 48 | } |
| 49 | |
| 50 | // AddIfNotExist checks whether item exists in the set, |
| 51 | // it adds the item to set and returns true if it does not exists in the set, |
nothing calls this directly
no test coverage detected
searching dependent graphs…