public static <T> List<T> sort(Iterable<T> self, boolean mutate) {
        List<T> answer = mutate ? asList(self) : toList(self);
        Collections.sort(answer, new NumberAwareComparator<T>());
        return answer;
    }
public static < T > List < T > sort ( Iterable < T > self , boolean mutate ) { List < T > answer = mutate ? asList ( self ) : toList ( self ) ; Collections . sort ( answer , new NumberAwareComparator < T > ( ) ) ; return answer ; }
Sorts the Iterable. Assumes that the Iterable items are
comparable and uses their natural ordering to determine the resulting order.
If the Iterable is a List and mutate is true,
it is sorted in place and returned. Otherwise, the elements are first placed
into a new list which is then sorted and returned - leaving the original Iterable unchanged.
<pre class="groovyTestCase">assert [1,2,3] == [3,1,2].sort()</pre>
<pre class="groovyTestCase">
def orig = [1, 3, 2]
def sorted = orig.sort(false)
assert orig == [1, 3, 2]
assert sorted == [1, 2, 3]
</pre>

@param self   the iterable to be sorted
@param mutate false will always cause a new list to be created, true will mutate lists in place
@return the sorted iterable as a List
@since 2.2.0