Repository navigation
[SHRINKWRAP-538] Resolving verbose or redundant code constructs - #181
Conversation
| for (Package pack : packages) { | ||
| classExpression.append("|"); | ||
| classExpression.append("(.*" + pack.getName().replaceAll("\\.", "\\.") + ".*)"); | ||
| classExpression.append("(.*").append(pack.getName().replaceAll("\\.", ".")).append(".*)"); |
There was a problem hiding this comment.
Why the change of + to .append? In other instances in this PR you're doing the opposite.
Wouldn't it be also better to have just a single line of classExpression.append("|(.*" + pack.getName().replaceAll("\\.", ".")) + ".*)");?
There was a problem hiding this comment.
.append() is the recommended way how to work with StringBuilder. It avoids creating unnecessary intermediate String objects. On the other hand, the recommended way to work with String is to use "+".
There was a problem hiding this comment.
True, missed that. My comment regarding the single line append still stands though
There was a problem hiding this comment.
That happens and I understand, but it's not a single line since it's inside the for loop.
af1930c to
8f8d6bd
Compare
| for (Package pack : packages) { | ||
| classExpression.append("|"); | ||
| classExpression.append("(.*" + pack.getName().replaceAll("\\.", "\\.") + ".*)"); | ||
| classExpression.append("|").append("(.*").append(pack.getName().replaceAll("\\.", ".")).append(".*)"); |
There was a problem hiding this comment.
Still would very much prefer .append("|(.*") over .append("|").append("(.*")
8f8d6bd to
f2cd18b
Compare
Issue: https://issues.redhat.com/browse/SHRINKWRAP-538