Golang container/list.List.MoveToBack() function example
package container/list
MoveToBack moves element e (1st parameter) to the back of the given list. If e is not an element of the list, the list is not modified.
Golang container/list.List.MoveToBack() function usage example
package main
import (
"container/list"
"fmt"
)
func main() {
alist := list.New()
alist.PushBack("a")
alist.PushBack("b")
e := alist.PushBack("c")
alist.PushBack("d")
alist.MoveToBack(e)
for e := alist.Front(); e != nil; e = e.Next() {
fmt.Println(e.Value) // print out the elements
}
}
Output :
a
b
d
c <---- moved to the back of the list
Reference :
Advertisement
Something interesting
Tutorials
+21.8k Golang : How to reverse slice or array elements order
+13.3k Golang : Date and Time formatting
+10.6k Golang : Allow Cross-Origin Resource Sharing request
+8.9k Golang : Find network service name from given port and protocol
+22.2k Golang : Convert seconds to minutes and remainder seconds
+14k Golang : Reverse IP address for reverse DNS lookup example
+8.3k Golang : Count leading or ending zeros(any item of interest) example
+14k Golang : concatenate(combine) strings
+37.5k Golang : Converting a negative number to positive number
+21.1k Golang : Sort and reverse sort a slice of strings
+20.2k Golang : Reset or rewind io.Reader or io.Writer