DamnedElric commented on code in PR #984:
URL: https://github.com/apache/commons-lang/pull/984#discussion_r1027288942


##########
src/main/java/org/apache/commons/lang3/text/StrBuilder.java:
##########
@@ -1844,12 +1845,7 @@ public StrBuilder deleteAll(final char ch) {
      * @return this, to enable chaining
      */
     public StrBuilder deleteFirst(final char ch) {
-        for (int i = 0; i < size; i++) {
-            if (buffer[i] == ch) {
-                deleteImpl(i, i + 1, 1);
-                break;
-            }
-        }
+        IntStream.range(0, size).filter(i -> buffer[i] == 
ch).findFirst().ifPresent(i -> deleteImpl(i, i + 1, 1));

Review Comment:
   The previous implementation was a lot easier to read and created less 
garbage. This one introduces a bunch of unnecessary objects at seemingly no 
benefit?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to