title: How to use enumMap in java
body: <p>How do you use enumMap in java? I want to use an enumMap to get constant named values that go from 0 to n where n is size. But I don't understand the description on the oracle site > <a href="http://docs.oracle.com/javase/8/docs/api/java/util/EnumMap.html" rel="noreferrer">EnumMap</a>.</p>
  
  <p>I tried to use one here</p>
  
  <pre><code>package myPackage;
  
  import java.util.EnumMap;
  
  public class Main{
  
      public static enum Value{
          VALUE_ONE, VALUE_TWO, SIZE
      }
  
      public static EnumMap&lt;Value, Integer&gt; x;
  
      public static void main(String[] args){
          x.put(Value.VALUE_ONE, 0);
          x.put(Value.VALUE_TWO, 1);
          x.put(Value.SIZE, 2);
  
          int[] myArray = new int[SIZE];
  
      }
  
  }
  </code></pre>
  
  <p>This doesn't work. How are you supposed to use an enumMap?</p>
  
  <p>is there also a way to do without <code>x.put(Value.VALUE_ONE, 0);</code> for every single element in the enum?</p>