I think my question was not clear.
I want to remove blank line from "result.txt" file which is the combination of SequenceInputStream.
Can someone show me sample how to remove empty line in case of SequenceInputStream, i.e. int temp.
Tai Yo wrote:I think my question was not clear.
I want to remove blank line from "result.txt" file which is the combination of SequenceInputStream.
Can someone show me sample how to remove empty line in case of SequenceInputStream, i.e. int temp.
Maneesh Godbole wrote:. . . isEmpty() considers white space to be a legal character. Thats why always trim before using isEmpty()
That is normal. A String containing a space is not empty. If you want to eliminate lines containing whitespace only, you need trim, so you need trim() too. You will get faster performance with a short‑circuit operator however.
Winston Gutkowski wrote:. . . on version 8, it seems to me that something like this might work . . .
Yes, it would. You might not want to print the individual lines. You can consider collecting all the lines into a List and writing the entire contents of that List to a new file.
Maneesh Godbole wrote:. . . isEmpty() considers white space to be a legal character. Thats why always trim before using isEmpty()
I forgot to say yesterday that trim() has a rather strange definition of whitespace. It does say it returns an empty String if you call it on all whitespace (by its definition).