Androider - 9 months ago 49
Java Question

Is there any data structure similar to HashMap where I can add duplicate keys

HashMap roleRightsID = new HashMap();

is there any data structure similar to HashMap where I can add duplicated keys

For Example

USA, New York
USA, Los Angeles
USA, Chicago
Pakistan, Lahore
Pakistan, Karachi

etc

What you need is called a multimap, but it is does not exist in standard Java. It can be simulated with a Map<String, List<String>> in your case.