title: How do I refactor this loop?
body: <p>I've got an application where I use primitive arrays and Lists for a class called <em>Item</em>. These are used interchangeably for legacy reasons (I also wish this was just one type, but it's the way it is).</p>
  
  <p>Now I have to add a new method like this that works via a for-each loop:</p>
  
  <pre><code>public void something(Item... items) {
      for (Item i : items) {
          doStuff();
      }
  }
  
  public void something(List&lt;Item&gt; items) {
      for (Item i : items) {
          doStuff();
      }
  }
  </code></pre>
  
  <p>In other words, exactly the same method twice for both primitive Arrays and Lists. Is there any way to nicely refactor this into a single method?</p>