Avoiding nested loops using the same Map<Text, List<Text>> while resolving a bug in earlier version i.e. map.containsKey isnt sufficient you need map.containsValues check as well