title: create map in groovy
body: <p>I have the below file : </p>
  
  <pre><code>name = David 
  city = sydney
  COuntry = Australia
  </code></pre>
  
  <p>I am trying to create a hash map using groovy and split it at <code>=</code> and store it in an array such that <code>part[0]</code> contains before equal and <code>part[1]</code> contains after equal. I am then trying to create a map here . </p>
  
  <p><strong>Desired output :</strong></p>
  
  <pre><code>def mapedData = [name :david , city : sydney , country :australia ]
  </code></pre>
  
  <p><strong>My try :</strong></p>
  
  <pre><code>String s=""
  def myfile = new File("C:/Users/.............")
  BufferedReader br = new BufferedReader(new FileReader(myfile));
  
  Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
  while((s = br.readLine()) != null) {
      if(!s.startsWith("#")) {
          StringTokenizer st=new StringTokenizer(s, "=")
              while(st.hasMoreElements()) {
                  String line=st.nextElement().toString().trim()
                  print line
              }
          }
      }
  }
  </code></pre>