Print each array items from arraylist in single line
<p>I am getting output from my java program in below format. </p>

<blockquote>
  <p>[race, care, acre][act, cat]</p>
</blockquote>

<p>Expected: Each array elements in different line. </p>

<blockquote>
  <p>race care acre<br>
    act cat</p>
</blockquote>

<p>I already tried to print but getting. </p>

<blockquote>
  <p>race care acre act cat</p>
</blockquote>

<p>Is there any way around so i can get expected results. Below is the gist of my code. Thanks</p>

<pre><code>    public static void main(String args[]) {

        try {
            Scanner sc = readWords();
            Map&lt;String, List&lt;String&gt;&gt; wordAnagramPairs = new HashMap&lt;&gt;();
            wordAnagramPairs = mapAnagrams(sc);
            for (String anagram : wordAnagramPairs.keySet()) {
                if (wordAnagramPairs.get(anagram).size() &gt; 1) {
                    System.out.print(wordAnagramPairs.get(anagram));
//                    for(String anagrams : wordAnagramPairs.get(anagram)){
//                        System.out.print(anagrams + " ");
//                    }
                }
            }



        } catch (FileNotFoundException e) {
            System.out.println("File Not Found");
        }
    }
</code></pre>