Let consider a below HashMap
HashMap<String, String> map = new HashMap<String, String>();
I have values in map like
map.put("model", "test");
Currently, if I want to get value from map I am doing
if(map!=null){
if(map.get("model")!=null && !map.get("model").isEmpty()){
//some logic
}
}
Is there any better approach in Java 8 by using Optional
or Lambdas to achieve the above condition?