Is it possible for us to implement a HashMap with one key and two values. Just as HashMap?
Please do help me, also by telling (if there is no way) any other way to
You can do it implicitly.
// Create the map. There is no restriction to the size that the array String can have
HashMap map = new HashMap();
//initialize a key chosing the array of String you want for your values
map.put(1, new String[] { "name1", "name2" });
//edit value of a key
map.get(1)[0] = "othername";
This is very simple and effective. If you want values of diferent classes instead, you can do the following:
HashMap map = new HashMap();