Create a gist now

Instantly share code, notes, and snippets.

A sample code of "container/list".
// http://golang.org/pkg/container/list/
package main
import (
"fmt"
"container/list"
)
func main() {
l := list.New()
e4 := l.PushBack(4)
e1 := l.PushFront(1)
e := l.PushFront(1)
l.Remove(e)
l.InsertBefore("e3", e4)
l.InsertAfter(nil, e1)
fmt.Println("len=", l.Len())
for e := l.Front(); e != nil; e = e.Next() {
fmt.Println(e.Value)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment