title: Initialize a hashmap in a more compact way without external libraries
body: <p>Is there a way to make this code more compact? With less lines without using libraries?<br>
  I am using Java 7</p>
  
  <pre><code>public enum CustomType {
      TYPE_A,
      TYPE_B,
      TYPE_C,
  }
  
  private static final Map&lt;Integer, CustomType&gt; typeMappings = new HashMap&lt;&gt;();
  
  static {
      typeMappings.put(513, CustomType.TYPE_A);
      typeMappings.put(520, CustomType.TYPE_A);
      typeMappings.put(528, CustomType.TYPE_A);
      typeMappings.put(530, CustomType.TYPE_A);
      typeMappings.put(532, CustomType.TYPE_A);
      typeMappings.put(501, CustomType.TYPE_B);
      typeMappings.put(519, CustomType.TYPE_B);
      typeMappings.put(529, CustomType.TYPE_B);
  }
  </code></pre>