title: Language Tricks to Shorten My Java Code?
body: <p>I am currently rediscovering Java (working with Ruby a lot recently), and I love the compilation-time checking of everything. It makes refactoring so easy. However, I miss playing fast-and-loose with types to do an <code>each</code> loop. This is my worst code. </p>
  
  <p><strong>Is this as short as it can be?</strong> I have a collection called <code>looperTracks</code>, which has instances that implement <code>Looper</code>. I don't want to modify that collection, but I want to iterate through its members PLUS the <code>this</code> (which also implements <code>Looper</code>). </p>
  
  <pre><code>List&lt;Looper&gt; allLoopers = new ArrayList&lt;Looper&gt;(looperTracks.length + 1);
  for (LooperTrack track : looperTracks) {
      allLoopers.add(track);
  }
  allLoopers.add(this);
  
  for (Looper looper : allLoopers) {
      // Finally! I have a looper
  </code></pre>
  
  <p><strong>I'm particularly concerned about any features that are new to Java from 1.5 on that I may have missed.</strong> For this question I am <strong>not</strong> asking about JRuby nor Groovy, though I know that they would work for this.</p>
  
  <p><strong>Edit:</strong> Sorry (too much Ruby!)... <code>looperTracks</code> is of  type <code>LooperTrack[]</code> and <code>LooperTrack</code> implements <code>Looper</code>.</p>