Is there a performance cost to autobox a primitive literal?
<p>Say I have the following code:</p>

<pre><code>Map&lt;String, Boolean&gt; map = ...
map.put("foo", true);
</code></pre>

<p>Theoretically, <code>true</code> will have to be autoboxed, resulting in a slight performance hit versus inserting <code>Boolean.TRUE</code>. But since we're dealing with a literal value, is it possible for the compiler to replace the primitive literal with a boxed literal so there's no extra runtime overhead?</p>

<p>Before anyone attacks me, I would generally opt for the primitive literal for the sake of code clarity, even if there was a tiny performance cost. This question is mostly theoretical.</p>