code: public static <T> List<T> toSorted(Iterable<T> self, Comparator<T> comparator) {
          List<T> list = toList(self);
          Collections.sort(list, comparator);
          return list;
      }
docs: Sorts the Iterable using the given Comparator. The elements are first placed
  into a new list which is then sorted and returned - leaving the original Iterable unchanged.
  <pre class="groovyTestCase">
  def orig = ["hello","hi","Hey"]
  def sorted = orig.toSorted(String.CASE_INSENSITIVE_ORDER)
  assert orig == ["hello","hi","Hey"]
  assert sorted == ["hello","Hey","hi"]
  </pre>
  
  @param self       the Iterable to be sorted
  @param comparator a Comparator used for the comparison
  @return a sorted List
  @since 2.4.0