Get an arbitrary key/item from a map

前端 未结 6 1473
攒了一身酷
攒了一身酷 2021-02-01 12:59

I am new to Go and now I want to get an arbitrary item from a map; what\'s the idiomatic way to do that? I can only think of something like this:

func get_some_k         


        
6条回答
  •  隐瞒了意图╮
    2021-02-01 13:22

    Maybe what you want is a array, which is easy to access randomly, especially the container is random read heavy but changed infrequently.

提交回复
热议问题