public static <T> Iterator<T> sort(Iterator<T> self, @ClosureParams(value=FromString.class, options={"T","T,T"}) Closure closure) {
        return sort((Iterable<T>) toList(self), closure).listIterator();
    }
public static < T > Iterator < T > sort ( Iterator < T > self , @ ClosureParams ( value = FromString . class , options = { "T" , "T,T" } ) Closure closure ) { return sort ( ( Iterable < T > ) toList ( self ) , closure ) . listIterator ( ) ; }
Sorts the given iterator items into a sorted iterator using the Closure to determine the correct ordering.
The original iterator will be fully processed after the method call.
<p>
If the closure has two parameters it is used like a traditional Comparator.
I.e.&#160;it should compare its two parameters for order, returning a negative integer,
zero, or a positive integer when the first parameter is less than, equal to,
or greater than the second respectively. Otherwise, the Closure is assumed
to take a single parameter and return a Comparable (typically an Integer)
which is then used for further comparison.

@param self    the Iterator to be sorted
@param closure a Closure used to determine the correct ordering
@return the sorted items as an Iterator
@since 1.5.5