get string value from HashMap depending on key name

前端 未结 10 2037
误落风尘
误落风尘 2020-11-28 21:39

I have a HashMap with various keys and values, how can I get one value out?

I have a key in the map called my_code, it should contain a str

10条回答
  •  孤街浪徒
    2020-11-28 22:02

    Your question isn't at all clear I'm afraid. A key doesn't have a "name"; it's not "called" anything as far as the map is concerned - it's just a key, and will be compared with other keys. If you have lots of different kinds of keys, I strongly suggest you put them in different maps for the sake of sanity.

    If this doesn't help, please clarify the question - preferrably with some code to show what you mean.

提交回复
热议问题