Skip to content

Minor speedup with iterator#1791

Merged
lvca merged 1 commit intoArcadeData:mainfrom
gramian:main
Oct 28, 2024
Merged

Minor speedup with iterator#1791
lvca merged 1 commit intoArcadeData:mainfrom
gramian:main

Conversation

@gramian
Copy link
Copy Markdown
Collaborator

@gramian gramian commented Oct 28, 2024

What does this PR do?

This change alters an keySet iterator to an entrySet iterator, since in the loop body the value is retrieved orginally via the key and now via the iterator.

Motivation

spotbugs

Checklist

  • I have run the build using mvn clean package command
  • My unit tests cover both failure and success scenarios

@lvca
Copy link
Copy Markdown
Member

lvca commented Oct 28, 2024

Both old and new code do the same thing. What's the reason of the change?

@lvca lvca self-requested a review October 28, 2024 14:35
@lvca lvca added this to the 24.11.1 milestone Oct 28, 2024
@gramian
Copy link
Copy Markdown
Collaborator Author

gramian commented Oct 28, 2024

@lvca Yes, but in the old version the map needs to be searched by key for the value, while in the new version key and value are given via the iterator. spotbugs found that, and I think it makes sense. I shouldn't have named it fix, rather refactor, sorry.

@lvca
Copy link
Copy Markdown
Member

lvca commented Oct 28, 2024

+1 then.

@lvca lvca merged commit a5b6d58 into ArcadeData:main Oct 28, 2024
@lvca lvca changed the title Minor fix in iterator Minor speedup with iterator Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants