I would like to have a global HashMap <String, String>
available to my whole project.
The hashmap will remain the same throughout the whole project, so it only needs to be instatiated once. My idea was to have it in a Utils
class and have a static public class like so:
public static String getValue(String key){
return map.get(key);
}
The problem is, I don't want to have to run code to fill the hashmap with the Strings everytime I call getValue
. So, where do I instantiate the code?
If I could fill the hashmap similar to:
HashMap hm = {{Key, Value}, {Key, Value}......}
It could then be global to the utils class and would possibly work.