code: public static <T> List<T> sort(Iterable<T> self, boolean mutate, Comparator<T> comparator) {
          List<T> list = mutate ? asList(self) : toList(self);
          Collections.sort(list, comparator);
          return list;
      }
docs: Sorts the Iterable using the given Comparator. 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 ["hi","hey","hello"] == ["hello","hi","hey"].sort( { a, b -> a.length() <=> b.length() } as Comparator )
  </pre>
  <pre class="groovyTestCase">
  def orig = ["hello","hi","Hey"]
  def sorted = orig.sort(false, String.CASE_INSENSITIVE_ORDER)
  assert orig == ["hello","hi","Hey"]
  assert sorted == ["hello","Hey","hi"]
  </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
  @param comparator a Comparator used for the comparison
  @return a sorted List
  @since 2.2.0