How to compare equality of lists of arrays with modern Java?
<p>I have two lists of arrays. </p>

<p>How do I easily compare equality of these <em>with Java 8 and its features</em>, without using external libraries? I am looking for a "better" (higher-level, shorter, more efficient) solution than brute-force code like this (untested code, may contain typos etc, not the point of the question):</p>

<pre><code>boolean compare(List&lt;String[]&gt; list1, List&lt;String[]&gt; list2) 
{
    // tests for nulls etc omitted
    if(list1.size() != list2.size()) {
       return false;
    }
    for(i=0; i&lt;list1.size(); ++i) {
        if(!Arrays.equals(list1.get(i), list2.get(i))) {
            return false;
        }
    }
    return true;
}
</code></pre>

<p>Or, if there isn't any nicer way, that's a valid answer too.</p>

<p>Bonus: If Java 9 offers an even better way what whaterver Java 8 can offer, feel free to mention it as well.</p>

<p><strong>Edit:</strong> After looking at the comments, and seeing how this question has become moderately hot, I think <strong>the "<em>better</em>" should include first checking lengths of all arrays, before checking array contents</strong>, because that has potential to find inequality much quicker, if inner arrays are long.</p>