Delete deletes the nodes from the NodeSet by ID. Delete is the only valid way to shrink a NodeSet. Delete returns the NodeSet to enable chaining.
(ids ...string)
| 59 | // Delete deletes the nodes from the NodeSet by ID. Delete is the only valid |
| 60 | // way to shrink a NodeSet. Delete returns the NodeSet to enable chaining. |
| 61 | func (n NodeSet) Delete(ids ...string) NodeSet { |
| 62 | if n.Size() == 0 { |
| 63 | return n |
| 64 | } |
| 65 | result := n.psMap |
| 66 | for _, id := range ids { |
| 67 | result = result.Delete(id) |
| 68 | } |
| 69 | if result.Size() == 0 { |
| 70 | return emptyNodeSet |
| 71 | } |
| 72 | return NodeSet{result} |
| 73 | } |
| 74 | |
| 75 | // UnsafeMerge combines the two NodeSets, altering n |
| 76 | func (n *NodeSet) UnsafeMerge(other NodeSet) { |