title: Literal declaration of HashMap in Java
body: <p>In <code>JavaScript</code>, you can declare all the keys and value combinations for a <code>JSON</code> object in one go as follows...</p>
  
  <pre><code>var myJSON = {
      'key1' : 'value 1',
      'key2' : 'value 2',
      'key3' : 'value 3',
      'key4' : 'value 4',
      'key5' : 'value 5',
      'key6' : 'value 6'
  };
  </code></pre>
  
  <p>I was wondering whether we can do something similar in <code>Java</code> for <code>HashMaps</code>.</p>
  
  <pre><code>HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(
      "Key 1", "Value 1",
      "Key 2", "Value 2",
      "Key 3", "Value 3"
  );
  </code></pre>
  
  <p>Basically, I need this as a one time read only thing as Config for the other parts of my code. I searched and tried a few solutions, but was not able to make them work. Or is there a better approach that I can do?</p>