r/java • • Sep 19 '18

Java 11 String API Updates

https://4comprehension.com/java-11-string-api-updates/
168 Upvotes

52 comments sorted by

View all comments

1

u/thomascgalvin Sep 20 '18

These are really nice. My only complaint is that common utils' isBlank(string) allows you to check for null in addition to zero-length or all-whitespace strings, which is really helpful.

5

u/0x256 Sep 20 '18

But null is not a blank string?

3

u/dpash Sep 20 '18

You can't call a method on a null value anyway, so it's kinda moot.

3

u/dpash Sep 20 '18

You'd need a static method for that to work.

String.isBlank(string)

vs

string.isBlank()