Skip to content

Commit 5087808

Browse files
authored
Optimize string concatenation in getNodeDescription() (#3262)
Replace String.join with Collectors.joining to avoid intermediate collection creation, improving performance by eliminating the unnecessary List creation step.
1 parent 966d8a9 commit 5087808

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/io/lettuce/core/cluster/NodeSelectionInvocationHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ private RedisCommandExecutionException createExecutionException(Map<RedisCluster
264264
}
265265

266266
private String getNodeDescription(List<RedisClusterNode> notFinished) {
267-
return String.join(", ", notFinished.stream().map(this::getDescriptor).collect(Collectors.toList()));
267+
return notFinished.stream().map(this::getDescriptor).collect(Collectors.joining(", "));
268268
}
269269

270270
private String getDescriptor(RedisClusterNode redisClusterNode) {

0 commit comments

Comments
 (0)