How to create a static Map of String -> Array

后端 未结 6 777
我寻月下人不归
我寻月下人不归 2021-01-11 10:51

I need to create a static Map which maps a given String to an array of int\'s.

In other words, I\'d like to define something l

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-11 11:25

    static Map map = new HashMap<>();
    

    The map is static, you can access it without creating an instance of the class it's defined in. I don't know what you mean with having the keys and values static as well, because it makes no sense to me.

提交回复
热议问题