I have stuck up with an issue of retrieving data using java. Can any one guide me how to find the solution of it.
Map<String,String> map = new HashMap<String,String>();
map.put("8004","Lead");
map.put("8004","Opportunity");
map.put("8004","Quote");
map.put("8004","Contract");
map.put("8005","CreatContract" );
map.put("8005","ManageContract" );
map.put("8005","SelectContract" );
//System.out.println(map);
Iterator<Entry<String, String>> it = map.entrySet().iterator();
while(it.hasNext()){
Map.Entry pair = (Map.Entry)it.next();
//boolean blnExists = map.containsValue(pair.getValue());
System.out.println(pair.getKey() + " = " + pair.getValue());
}
Output:
8004 = Contract
8005 = SelectContract
Expected Ouput:
8004 = lead,opportunity,Quote
8005 = CreateContracr,ManageContract