Lambda Expression in Java
Following code loops through the array and if the input is not null then convert it into different Map.
private Map<String,Object> fun(Map<String,Object> inputEvent){ return Array.stream().filter(key -> inputEvent.get(key) != null) .collect(Collectors.toMap(Function.identity(), inputEvent::get)); }