[
https://issues.apache.org/jira/browse/STORM-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14983262#comment-14983262
]
ASF GitHub Bot commented on STORM-1152:
---------------------------------------
Github user hmcl commented on a diff in the pull request:
https://github.com/apache/storm/pull/836#discussion_r43549404
--- Diff:
storm-core/src/jvm/storm/trident/topology/TridentTopologyBuilder.java ---
@@ -233,8 +234,9 @@ public StormTopology buildTopology() {
}
Map<String, Set<String>> batchToComponents =
getBoltBatchToComponentSubscriptions(id);
- for(String b: batchToComponents.keySet()) {
- for(String comp: batchToComponents.get(b)) {
+ for(Map.Entry<String, Set<String>> entry:
batchToComponents.entrySet()) {
+ String b = entry.getKey();
+ for(String comp: entry.getValue()) {
d.directGrouping(comp,
TridentBoltExecutor.COORD_STREAM(b));
--- End diff --
Unless the variable is created to make the code easier to read, this could
be simplified to
d.directGrouping(comp, TridentBoltExecutor.COORD_STREAM(entry.getKey()));
> Change map keySet iteration to entrySet iteration for efficiency
> ----------------------------------------------------------------
>
> Key: STORM-1152
> URL: https://issues.apache.org/jira/browse/STORM-1152
> Project: Apache Storm
> Issue Type: Improvement
> Components: storm-core
> Reporter: Suresh Srinivas
> Assignee: Suresh Srinivas
> Priority: Minor
>
> Many places keySet iteration is used where entrySet iteration would avoid
> unnecessary key lookup.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)