Golang container/list.List.InsertAfter() function example
package container/list
InsertAfter inserts a new element with given value immediately after mark and returns the new element. If mark is not an element of the list, the list is not modified.
Golang container/list.List.InsertAfter() function usage example
package main
import (
"container/list"
"fmt"
)
func main() {
alist := list.New()
insertelem := alist.PushBack("a")
alist.PushBack("c")
alist.InsertAfter("b",insertelem)
for e := alist.Front(); e != nil; e = e.Next() {
fmt.Println(e.Value) // print out the elements
}
}
Output :
a
b
c
Reference :
Advertisement
Something interesting
Tutorials
+25.4k Golang : Generate MD5 checksum of a file
+8.7k Golang : Find duplicate files with filepath.Walk
+7.4k Golang : Accessing dataframe-go element by row, column and name example
+8.4k Golang : Generate Datamatrix barcode
+7.4k Golang : Scanf function weird error in Windows
+41.9k Golang : How do I convert int to uint8?
+29.9k Golang : Get and Set User-Agent examples
+11.7k How to tell if a binary(executable) file or web application is built with Golang?
+30.5k Get client IP Address in Go
+10.5k Golang : Select region of interest with mouse click and crop from image
+22.6k Generate checksum for a file in Go
+4.3k Golang : Converting individual Jawi alphabet to Rumi(Romanized) alphabet example