I have the following Map:
HashMap<String, String> map1= new HashMap<String, String>();
map1.put("1", "One");
map1.put("2", "Two");
map1.put("3", "Three");
I have a list numbers which contains ["1","2","3"]
I have to perform the following operations:
List<String> spelling= new ArrayList<>();
for (String num: numbers) {
if (map1.containsKey(num)){
spelling.add(map1.get(num))
}
}
How can I write the above code using lambda Expressions?