title: Using enums as List elements in Java possible?
body: <p>I have a state which could be parametrized by a some <code>variables</code> which are discret. So each <code>variable</code> could be described with a few <code>enum</code> values. But the number of <code>variables</code> may vary. </p>
  
  <p>The following code is impossible:</p>
  
  <pre><code>    public enum Var0 {
          LEFT, RIGHT;
      }
  
      public enum Var1 {
          TOP, BOTTOM;
      }
  
  
      // somewhere
      List&lt;enum&gt; vars = new ArrayList&lt;&gt;();  // this is not working 
      vars.set(0,Var0);  // put the whole enum in a list element
      vars.set(1, Var1);
  
      // somewhere else I want something like this
      for (int i = 0; i &lt; vars.get(i).values().length; i++) {
          vars.get(i).
          for (Enum var : vars.get(i).values()) {
              System.out.println(var.name())
              ..
          }
      }
     // or this ??
     System.out.println(vars.get(1).values()[1]) // 
     ...
  </code></pre>
  
  <p>Any suggestions if/ how one could use <code>enums</code> in such scenario are welcome</p>