Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRUNK-4230 SonarQube - Inefficient use of keySet iterator instead of ent... #560

Merged
merged 1 commit into from Jan 20, 2014

Conversation

kkaczmarczyk
Copy link
Contributor

...rySet iterator

@@ -1013,7 +1013,8 @@ public static void checkCoreDataset() {
currentRoleNames.add(role.getRole().toUpperCase());
}
Map<String, String> map = OpenmrsUtil.getCoreRoles();
for (String roleName : map.keySet()) {
for (Map.Entry<String, String> entry : map.entrySet()) {
String roleName = entry.getKey();
if (!currentRoleNames.contains(roleName.toUpperCase())) {
Role role = new Role();
role.setRole(roleName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

rkorytkowski added a commit that referenced this pull request Jan 20, 2014
TRUNK-4230 SonarQube - Inefficient use of keySet iterator instead of entrySet iterator
@rkorytkowski rkorytkowski merged commit 47250ec into openmrs:master Jan 20, 2014
RandilaP pushed a commit to RandilaP/openmrs-core that referenced this pull request Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants