private Map<String, Object01> myMap = new HashMap<>();
myMap.computeIfAbsent("key01", this::method01);computeIfAbsentwill callmethod01if keykey01is not present in the map or if it isnull.- Above method
method01can accept the key value as parameter
private Object01 method01(String key) {
// do something ...
return object01;
}