In Java, I am implementing this:
Map<String, List<String >> mdaps = new HashMap<String, List<String >>();
I want to display the list that contains the word "Scored" like this:
Scored [Profile]
Scored [Applicability]
But how to search in entry.getkey()
?
as it does not work with: if(entry.getKey().contrains("Scored"))
Here is my code: Edit1
Map<String, List<String >> mdaps = new HashMap<String, List<String >>();
List<String > List1 = new ArrayList<String>();
List<String > List2 = new ArrayList<String>();
List<String > List3 = new ArrayList<String>();
List1.add("Profile");
List2.add("Applicability");
List3.add("Level 1");
mdaps.put("(Scored)", List1 );
mdaps.put("(Scored)", List2 );
mdaps.put("Not Scored", List3 );
for(Map.Entry<String, List<String>> entry : mdaps.entrySet()){
if(entry.getKey().contains("(Scored)")) // not Working
System.out.println(entry.getKey()+" "+ entry.getValue());
}
}
thanks in advance.