title: How to make Groovy arrays comparable?
body: <p>Tried like this:  </p>
  
  <pre><code>   ArrayList.metaClass.compareTo = {arg -&gt; this?.size() &lt;=&gt; arg?.size() }  
     [1]&lt;=&gt;[2]
  </code></pre>
  
  <p>It doesn't work.</p>
  
  <p>There is still exception rises <code>groovy.lang.GroovyRuntimeException: Cannot compare java.util.ArrayList with value '[1]' and java.util.ArrayList with value '[2]'</code></p>