Determine if a list composed of anagram elements in Java 8 : <p>I want to determine if a list is anagram or not using Java 8.</p>

<p>Example input:</p>

<pre><code>"cat", "cta", "act", "atc", "tac", "tca"
</code></pre>

<p>I have written the following function that does the job but I am wondering if there is a better and elegant way to do this.</p>

<pre><code>boolean isAnagram(String[] list) {
    long count = Stream.of(list)
            .map(String::toCharArray)
            .map(arr -&gt; {
                Arrays.sort(arr);
                return arr;
            })
            .map(String::valueOf)
            .distinct()
            .count();
    return count == 1;

}
</code></pre>

<p>It seems I can't sort char array with <code>Stream.sorted()</code> method so that's why I used a second map operator. If there is some way that I can operate directly on char stream instead of Stream of char array, that would also help.</p>
