刚接触go 请教下 类似java map嵌套list go的代码需要怎么写呢

newplayer · · 1409 次点击
<code> package main import ( "container/list" "fmt" ) type listItem struct{ id int name string } func main() { m :=make(map[string]*list.List, 10) l := list.New() item := listItem{ id:1, name:"abc", } l.PushBack(item) m["key"] = l for _, li := range m { fmt.Println("len", li.Len()) for e := li.Front(); e != nil; e = e.Next() { fmt.Print(e.Value) //输出list的值,01234 } } } </code>
#1