title: Java is NEVER pass-by-reference, right?...right?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/40480/is-java-pass-by-reference">Is Java “pass-by-reference”?</a>  </p>
  </blockquote>
  
  
  
  <p>I found an unusual Java method today:</p>
  
  <pre><code>private void addShortenedName(ArrayList&lt;String&gt; voiceSetList, String vsName)
  {
       if (null == vsName)
         vsName = "";
       else
         vsName = vsName.trim();
       String shortenedVoiceSetName = vsName.substring(0, Math.min(8, vsName.length()));
       //SCR10638 - Prevent export of empty rows.
       if (shortenedVoiceSetName.length() &gt; 0)
       {
         if (!voiceSetList.contains("#" + shortenedVoiceSetName))
           voiceSetList.add("#" + shortenedVoiceSetName);
       }
  }
  </code></pre>
  
  <p>According to everything I've read about Java's behavior for passing variables, complex objects or not, this code should do exactly nothing.  So um...am I missing something here?  Is there some subtlety that was lost on me, or does this code belong on thedailywtf?</p>