Perhaps premature optimization (and also the above was my suggestion, sorry for that), but consider really long strings. Previously we did an `O(1)` operation to figure out emptiness. Now it's a regular expression, possibly replacing a lot of white spaces inside the long string.
What about 
```java
.replaceAll("^\\s*", "")
```
In that way, we're only removing leading white space and not all of them.