title: Parsing a String into a Map in Java
body: <p>have a string like;</p>
  
  <pre><code>{uniqueKey=test20745,content={acostumbrado={tf=1,df=1},al={tf=1,df=6945},ante={tf=1,df=42},co={tf=1,df=9187},ello={tf=1,df=2},está={tf=2,df=21},falcao={tf=1,df=105},guardia={tf=1,df=2},http={tf=1,df=9893},nada={tf=1,df=24},no={tf=1,df=2493},osa={tf=1,df=429},para={tf=1,df=6382},partido={tf=1,df=50},pretorian={tf=1,df=1},que={tf=1,df=358},sebcfkeı={tf=1,df=1},su={tf=1,df=7368},t={tf=1,df=14423},tuvo={tf=1,df=3},un={tf=1,df=8511}}}
  </code></pre>
  
  <p>how to parse this string to a map(key, list) like below;</p>
  
  <pre><code>acostumbrado-&gt;tf=1,df=1
  al -&gt;tf=1,df=6945
  ante -&gt;tf=1,df=42
  ...
  </code></pre>
  
  <p>edit:</p>
  
  <p>so what I have done up to now;</p>
  
  <pre><code>    String delims = "[{},]";
      HashMap&lt;String, List&lt;String&gt;&gt; valueMap = new HashMap&lt;String, List&lt;String&gt;&gt;();
      for (int i = 0; i &lt; text.size(); i++) {
          String[] tokens = val.toString().split(delims);
          ArrayList&lt;String&gt; tfAndDfValues = new ArrayList&lt;String&gt;();
          tfAndDfValues.add(tokens[4].substring(3));
          tfAndDfValues.add(tokens[5].substring(3));
          if (valueMap.containsKey(removeLastChar(tokens[3]))) {
              valueMap.get(removeLastChar(tokens[3])).addAll(tfAndDfValues);
          } else {
              valueMap.put(removeLastChar(tokens[3]), tfAndDfValues);
          }
      }
  </code></pre>