In Java 7 I have
Map<String, List<String>> m = new HashMap<String, List<String>>();
boolean result = false;
m.put("Name1", Arrays.asList("abc*1"));
m.put("Name2", Arrays.asList("abc@*1"));
for (Map.Entry<String, List<String>> me : m.entrySet()) {
String key = me.getKey();
List<String> valueList = me.getValue();
if (key.equals("Name2"){
System.out.print("Values: ");
for (String s : valueList) {
if(s.contains("@"){
result = true;
}
}
}
}
How can I get în a bool result for Name2 if it contains @ using any match?
I tried using The following Code but I Don t know how to use IT for specific key
result = m.values().stream().anyMatch(v -> v.contains("@"))
if(s.contains("@"))? (Double quotes, not doubled apostrophes)Ifforifand''(two apostrophes) instead of". Is this code supposed to be compilable?