Skip to content

EntrySet should be iterated when both the key and value are needed#346

Closed
apupier wants to merge 1 commit intoapache:masterfrom
apupier:entrySet_should_be_iterated_when_both_the_key_and_value_are_needed
Closed

EntrySet should be iterated when both the key and value are needed#346
apupier wants to merge 1 commit intoapache:masterfrom
apupier:entrySet_should_be_iterated_when_both_the_key_and_value_are_needed

Conversation

@apupier
Copy link
Copy Markdown
Contributor

@apupier apupier commented Sep 5, 2017

Signed-off-by: Aurélien Pupier apupier@redhat.com

Signed-off-by: Aurélien Pupier <apupier@redhat.com>
@jbonofre
Copy link
Copy Markdown
Member

jbonofre commented Sep 5, 2017

R: @jbonofre

Copy link
Copy Markdown
Member

@jbonofre jbonofre left a comment

Choose a reason for hiding this comment

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

It doesn't bring lot of value, but LGTM. I'm merging.

@asfgit asfgit closed this in 47451b0 Sep 6, 2017
@apupier
Copy link
Copy Markdown
Contributor Author

apupier commented Sep 6, 2017

it brings performance value, it avoids to access and search two times in the map. it is making a visible effect for large Maps but i don't know which ones can be big or not.

Please note that there are a lot more of this in the codebase.

@jbonofre
Copy link
Copy Markdown
Member

jbonofre commented Sep 6, 2017

FYI, the compiler (since Java 1.7 update 40) can already optimize the iteration on the map. Further more, those maps are pretty small ;) Thanks anyway !

@apupier
Copy link
Copy Markdown
Contributor Author

apupier commented Sep 6, 2017

@jbonofre do you have a reference link for that? i would like to report it to Sonar in order that they don't report it as an issue if source is requiring Java 7

@jbonofre
Copy link
Copy Markdown
Member

jbonofre commented Sep 6, 2017

Let me find it. Anyway, I prefer your approach, it's clearer ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants