title: How to access map in velocity template file
body: <p>when I passed a <code>Map&lt;String,String&gt;</code> in velocity template file, and when try to print the values of map it get sorted (on the basis of ASCII values).</p>
  
  <p>I am doing as follows:</p>
  
  <p>this is my velocity template file::</p>
  
  <pre><code>#set($tocList=${mapReference.mapValue})
  #set($tocEntry="")
  
  &lt;div &gt;
   #foreach($tocEntry in $tocList.keySet())
    &lt;a href="#$tocEntry"&gt;$tocList.get($tocEntry)&lt;/a&gt;&lt;br/&gt;
   #end
  &lt;/div&gt;
  </code></pre>
  
  <p>My Java code is :</p>
  
  <pre><code> Map&lt;String, String&gt; map=new HashMap&lt;String, String&gt;();
   Map&lt;String,HashMap&gt; m1=new HashMap&lt;String, HashMap&gt;();
  
     \\values that we want to print in template file
  
     map.put("sdfhfg", "Df lm"); 
     map.put("chdgfhd", "gBc Jk");
     map.put("dghjdhdf", "gI Ml");
  
     m1.put("mapValue", (HashMap) map);
  
    VelocityEngine velocityEngine = VelocityEngineFactory.getVelocityEngine();
    VelocityContext context = new VelocityContext();
    context.put("img",model);
    context.put("mapReference",m1);
    context.put("iterator", new IteratorTool());
  
  
    Template t = velocityEngine.getTemplate("tocTemplate.vm");
    StringWriter writer = new StringWriter();
      t.merge(context , writer);
      System.out.println(writer);
  </code></pre>
  
  <p>Output is:</p>
  
  <pre><code> &lt;div&gt;
     &lt;a href="#dghjdhdf"&gt;gI Ml&lt;/a&gt;&lt;br/&gt;
     &lt;a href="#chdgfhd"&gt;gBc Jk&lt;/a&gt;&lt;br/&gt;
     &lt;a href="#sdfhfg"&gt;Df lm&lt;/a&gt;&lt;br/&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>Why these values get sorted? I want to print map as it is.</p>