In this post, we’ll see the best practice and optimize way to check empty String in Java. Every developer know how to check empty String but here we’ll look into the optimized method of checking empty String.
Most of us always prefer to use equals() method to check for empty String such as
However, this equals() method is overkill to test for an empty String. It is quicker to test if the length of the String is 0. So, the best way to check for empty String is