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_r288215083
##########
File path:
sql/src/test/java/org/apache/druid/sql/calcite/util/SpecificSegmentsQuerySegmentWalker.java
##########
@@ -78,9 +78,7 @@ public SpecificSegmentsQuerySegmentWalker add(
)
{
final Segment segment = new QueryableIndexSegment(index,
descriptor.getId());
- if (!timelines.containsKey(descriptor.getDataSource())) {
- timelines.put(descriptor.getDataSource(), new
VersionedIntervalTimeline<>(Ordering.natural()));
- }
+ timelines.putIfAbsent(descriptor.getDataSource(), new
VersionedIntervalTimeline<>(Ordering.natural()));
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]