Hi, Jim

I have a few comments on the webrev.

src/java.base/share/classes/java/lang/String.java

2982     private static int outdent(List<String> lines) {

Can you please add a doc comment for what this method does?


2973  .map(line -> {
2974      int firstNonWhitespace = line.indexOfNonWhitespace();
2975      int lastNonWhitespace = line.lastIndexOfNonWhitespace();
2976      return firstNonWhitespace > lastNonWhitespace
2977 ? "" : line.substring(Math.min(outdent, firstNonWhitespace), lastNonWhitespace);
2978  })
2979  .collect(Collectors.joining("\n", "", optOut ? "\n" : ""));


Like Vicente mentioned, it would be nice if less of this work were done when 'optOut' is true.


test/jdk/java/lang/String/StripIndent.java


I'd like for the test to be made easier to read, so it's clear which edge cases are covered (the last line determines a non-0 outdent, the last line opts out of all outdenting, etc).

Splitting the test data onto multiple lines would be a good start (though ironic, for this feature :). And maybe even add a description of the case being tested, where not obvious.

Thanks,
-Brent

Reply via email to