Golang container/list.List.Front() function example

package container/list

Front returns the first element of list l or nil.

Golang container/list.List.Front() function usage example

 package main

  import (
 "container/list"
 "fmt"
  )

  func main() {
 alist := list.New()
 alist.PushBack("a")
 alist.PushBack("b")
 alist.PushBack("c")

 e := alist.Front()
 fmt.Println(e.Value)
 }

Output :

a

Reference :

http://golang.org/pkg/container/list/#List.Front

Advertisement