The idea of using Entry is that in the line below instead of map.get(roleName) you will call entry.getValue() so that no additional map search is needed. Please do the same in other places.