A small correction. This could be rewritten as 
if (Constants.MAP_MEMORY_MB_CONF_KEY.equals(key)) {

Similarly for the reduce memory mb key.