March 2019
Intermediate to advanced
242 pages
6h 21m
English
Suppose that a file includes the following text, using [ at the beginning of a new line:
[ Talks - Java11, Amber, CleanCode [ Oceans - plastic pollution, human callousness
Now, suppose that you must remove the delimiter, [, used at the beginning of all lines. You can use the transform() method to customize the margin management, adding the String class:
<R> R transform (Function<String, R> f)
The following is an example that uses the method transform() to remove the custom margin characters from the multiline text:
String stripped = `
[ Talks - Java11, Amber, CleanCode
[ Oceans - dying, human callousness, plastic pollution `.transform({ multiLineText.stream() .map(e -> e.map(String::strip) .map(s -> s.startsWith("[ ...Read now
Unlock full access