sashidhar commented on a change in pull request #7764: #7316 Use
map.putIfAbsent() or map.computeIfAbsent() as appropriate instead of
containsKey() + put()
URL: https://github.com/apache/incubator-druid/pull/7764#discussion_r288214895
##########
File path:
indexing-service/src/main/java/org/apache/druid/indexing/firehose/IngestSegmentFirehoseFactory.java
##########
@@ -512,9 +510,7 @@ public int getNumSplits()
for (TimelineObjectHolder<String, DataSegment> timelineHolder :
Lists.reverse(timelineSegments)) {
for (PartitionChunk<DataSegment> chunk : timelineHolder.getObject()) {
for (String metric : chunk.getObject().getMetrics()) {
- if (!uniqueMetrics.containsKey(metric)) {
- uniqueMetrics.put(metric, index++);
- }
+ uniqueMetrics.putIfAbsent(metric, index++);
Review comment:
Done.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]