Java 11 introduced six new methods into the String class. 1️⃣ isBlank() 2️⃣ lines() 3️⃣ repeat() 4️⃣ strip() 5️⃣ stripLeading() 6️⃣ stripTrailing()

Mar 30, 2022 · 7:00 AM UTC

💡Tip: use strip() instead of trim()
1
Wow! So advanced to have those 1950s functionality back in 2018!! Such a crazy time
1
What if my String is null? they should provide null handling with isBlank() method.
1
These aren’t static methods. So if your String reference is null, then calling isBlank() will be an NPE.
1
3
Absolutely. What I am looking for is a static method within the String class itself similar to StringUtils.isBlank.
1