title: Maps with multiple types of values in java
body: <p>I have to accomplish a strange peculiar scenario. Its described as follows:</p>
  
  <p>I have to design a Map where the '<strong>Keys</strong>' are always of <strong>String</strong> type. However, the '<strong>Value</strong>' for one of the key may be a <strong>String or a List</strong>(depends on the number of values a particular key can have. 'Value' will be a String if that particular key has only one value and it has to be a List if the key contains many values). How to accomplish this scenario?</p>
  
  <p>For Example: there are 2 keys in a map namely "Name" and "Phone Nos". A person can have only one name and multiple phone numbers. So here the first key i.e. "Name" should have 'String' type for Value, whereas for the second key i.e. "Phone Nos" should have 'List' type for Value. How to declare such a Map. Is it possible?</p>