title: How to print a list of maps with each map entry in a seperate line
body: <p>I want to print a array list, in that array list it contains hash map and I print in a text file. while trying to print the text file it print in single line. I need in a separate line
  Example:</p>
  
  <pre><code>ArrayList&lt;Object&gt; mainlist= new ArrayList&lt;&gt;();
  LinkedHashMap&lt;String, String&gt; hmap = new LinkedHashMap&lt;&gt;();
  for (int i=0;i&lt;5;i++) 
  {   
      hmap.put("key1", "03-08-2018");
      hmap.put("key2", "xyz";
      hmap.put("key3", "123");
      //ArrayList USed:::
      mainlist.add(hmap);
      mainlist.add("\n");
  }
  return mainlist;
  </code></pre>
  
  <p>I return in text file. It generates a single line but I need separate lines in my output text file.</p>
  
  <p>Expected output in text file:</p>
  
  <pre><code>[{key1=03-08-2018,key2=xyz,key3=123}
   {key1=03-08-2018,key2=xyz,key3=123}
  {key1=03-08-2018,key2=xyz,key3=123}
  ]
  </code></pre>
  
  <p>Actual output in text file:</p>
  
  <pre><code>[{key1=03-08-2018,key2=xyz,key3=123},{key1=03-08-2018,key2=xyz,key3=123},{key1=03-08-2018,key2=xyz,key3=123}]
  </code></pre>
  
  <p>Can any one help me to out of this?<br>
  Thanks for ur reply</p>