title: Apache's StringUtils.isBlank(str) vs. Guava's Strings.isNullOrEmpty(str): Should you routinely check for whitespace?
body: <p>Is there any advantage in using </p>
  
  <pre><code>StringUtils.isBlank(str) 
  </code></pre>
  
  <p>from Apache commons-lang.</p>
  
  <p>vs </p>
  
  <pre><code>Strings.isNullOrEmpty(String string)
  </code></pre>
  
  <p>from Google Guava?</p>
  
  <p>I want to replace hundreds of cases of they following usage in a Java project:</p>
  
  <pre><code>if(str == null || str.isEmpty())
  </code></pre>
  
  <p>Guava's <a href="https://google.github.io/guava/releases/22.0/api/docs/com/google/common/base/Strings.html#isNullOrEmpty-java.lang.String-" rel="noreferrer">isNullOrEmpty</a> seems to be a direct replacement for the usage above in my project.</p>
  
  <p>But more people seem to use Apache's <a href="https://commons.apache.org/proper/commons-lang/javadocs/api-3.6/org/apache/commons/lang3/StringUtils.html#isBlank-java.lang.CharSequence-" rel="noreferrer">isBlank</a> method based on my reading of S.O. questions.</p>
  
  <p>The only difference seems to be that <code>StringUtils.isBlank(str)</code> <strong>also checks for whitespace</strong> in addition to checking whether the string is null or empty.</p>
  
  <p><strong>Normally is it a good idea to check a String for whitespace or could that produce a different result in your code than Guava's simpler check?</strong></p>