Hi Jim!

Why a new line is always added to the result of indent(int):

return stream.collect(Collectors.joining("\n", "", *"\n"*));

Because of this, a call to str.indent(0) depends on whether the string is single-line or multi-line: In the former case it is unchanged, while in the later case it gets a newline appended. Moreover, if a multi-line string already ends with a new line, then a new new-line is not appended, which seems inconsistent.

I think, it may be better to always preserve the number of existing trailing new lines.

With kind regards,
Ivan


On 8/29/18 7:00 AM, Jim Laskey wrote:
Please review the code  for  String::align and String::indent at the link below.

Notes:
        Includes a private version of String::isMultiline() which may be made 
into a public method at some future date
        Includes minor correctness clean up of StringLatin1.java, 
StringUTF16.java

webrev: http://cr.openjdk.java.net/~jlaskey/8200434/webrev/index.html
jbs: https://bugs.openjdk.java.net/browse/JDK-8200434

Cheers,

— Jim



--
With kind regards,
Ivan Gerasimov

Reply via email to