AddIfNotExist checks whether item exists in the set, it adds the item to set and returns true if it does not exists in the set, or else it does nothing and returns false.
()
| 51 | // it adds the item to set and returns true if it does not exists in the set, |
| 52 | // or else it does nothing and returns false. |
| 53 | func ExampleIntSet_AddIfNotExist() { |
| 54 | intSet := gset.NewIntSetFrom([]int{1, 2, 3}) |
| 55 | intSet.Add(1) |
| 56 | fmt.Println(intSet.Slice()) |
| 57 | fmt.Println(intSet.AddIfNotExist(1)) |
| 58 | |
| 59 | // May Output: |
| 60 | // [1 2 3] |
| 61 | // false |
| 62 | } |
| 63 | |
| 64 | // AddIfNotExistFunc checks whether item exists in the set, |
| 65 | // it adds the item to set and returns true if it does not exists in the set and function `f` returns true, |
nothing calls this directly
no test coverage detected
searching dependent graphs…