Skip to content

Latest commit

 

History

History
37 lines (24 loc) · 524 Bytes

MoveToBack.md

File metadata and controls

37 lines (24 loc) · 524 Bytes

func (l *List) MoveToBack(e *Element)

参数列表:

  • e:链表中的节点

功能说明:

把节点e移到链表的末尾

代码实例:

	package main

	import (
		"container/list"
		"fmt"
	)

	func main() {
		l := list.New()
		e := l.PushBack("a")
		l.PushBack("b")
		l.PushBack("c")
		
		fmt.Println(l.Front().Value) // 输出:a
		fmt.Println(l.Back().Value)  // 输出:c
		
		l.MoveToBack(e)
		
		fmt.Println(l.Front().Value) // 输出:b
		fmt.Println(l.Back().Value)  // 输出:a
	}