1 Map<String, String> map = new HashMap<>();
2
3 map.put("1", "Foo");
4 //search for the entry with key==1, since present, returns foo
5 System.out.println(map.getOrDefault("1", "dumnba"));
6 //search for the entry with key==2, since not present, returns dumnba
7 System.out.println(map.getOrDefault("2", "dumnba"));