title: How can I wrap a Java enum and still iterate over it?
body: <p>How can I have an abstract enum, or some kind of base enum?</p>
  
  <p>In my common code I'd like a notion of an enum placeholder, MyItems, without tying myself to a concrete enum.  Then in each of my projects I would have a concrete implementation.</p>
  
  <p>E.g. 
  Common Code</p>
  
  <pre><code>public interface MyItems {
      // Marker interface
  }
  </code></pre>
  
  <p>Project A</p>
  
  <pre><code>public enum Items implements MyItems {
       RED_CAR, BLUE_CAR, GREEN_CAR;
  }
  </code></pre>
  
  <p>Project B</p>
  
  <pre><code>public enum Items implements MyItems {
      BROWN_TREE, GREEN_TREE;
  }
  </code></pre>
  
  <p>This seems to work, but in my common code I can't write a loop over my interface enum, since it's not an enum.  In my common code I'd like to write</p>
  
  <pre><code>for (MyItems item : MyItems.values())
      doSomething(item);
  </code></pre>
  
  <p>but I can't because my interface is just a marker interface, and it doesn't have a .values(). </p>
  
  <p>Any suggestions greatly appreciated.  I don't know if I'm trying in completely the wrong way.</p>