Skip to content

Commit

Permalink
Move null-check out of loop
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Froh <[email protected]>
  • Loading branch information
msfroh committed Jan 11, 2025
1 parent a5bc4ca commit 41d0f33
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ public GroupShardsIterator<ShardIterator> searchShards(
}
}
List<ShardIterator> allShardIterators = new ArrayList<>();
for (List<ShardIterator> indexIterators : shardIterators.values()) {
if (slice != null) {
if (slice != null) {
for (List<ShardIterator> indexIterators : shardIterators.values()) {
// Filter the returned shards for the given slice
CollectionUtil.timSort(indexIterators);
// We use the ordinal of the iterator in the group (after sorting) rather than the shard id, because
Expand All @@ -300,9 +300,9 @@ public GroupShardsIterator<ShardIterator> searchShards(
allShardIterators.add(indexIterators.get(i));
}
}
} else {
allShardIterators.addAll(indexIterators);
}
} else {
shardIterators.values().forEach(allShardIterators::addAll);
}

return GroupShardsIterator.sortAndCreate(allShardIterators);
Expand Down

0 comments on commit 41d0f33

Please sign in to comment.