title: Calling equals on string literal
body: <p>I just was tidying my code a bit and there was this piece:</p>
  
  <pre><code>String saving = getValue();
  if(saving != null &amp;&amp; saving.equals("true")){
     // do something
  }
  </code></pre>
  
  <p>Then I thought of doing it the other way around to get rid of the checking for <code>null</code>:</p>
  
  <pre><code>if("true".equals(saving)){
     // do something
  }
  </code></pre>
  
  <p>It definitely works, but <strong>is this safe</strong> to do so? I mean string literals are stored in a common pool, while string object create by <code>new</code> are on the heap. But strings in the constant pool are also objects, right?</p>
  
  <p>But still it doesn't seem like the right thing to do, even though it makes the code shorter.</p>