コード例 #1
0
func (list *SimplyList) RemoveList() {
	var node *Node
	for list.head != nil {
		node = list.head
		list.head = list.head.next
		cleaner.Clear(node)
	}
	list.tail = nil
}
コード例 #2
0
func (list *SimplyList) RemoveHead() {
	if list.head != nil {
		var node *Node = list.head
		list.head = list.head.next
		cleaner.Clear(node)
		if list.head == nil {
			list.tail = nil
		}
	}
}
コード例 #3
0
func (list *SimplyList) RemoveAfter(node *Node) {
	if node != nil {
		var temp *Node = node.next
		if temp != nil {
			if temp == list.tail {
				list.tail = node
			}
			node.next = temp.next
			cleaner.Clear(temp)
		} else {
			list.RemoveHead()
		}
	}
}