code: public static <T> Iterator<T> toUnique(Iterator<T> self, @ClosureParams(value=FromString.class, options={"T","T,T"}) Closure condition) {
          return new UniqueIterator<T>(self, condition.getMaximumNumberOfParameters() == 1
                  ? new OrderBy<T>(condition, true)
                  : new ClosureComparator<T>(condition));
      }
docs: Returns an iterator equivalent to this iterator but with all duplicated items
  removed where duplicate (equal) items are deduced by calling the supplied Closure condition.
  <p>
  If the supplied Closure takes a single parameter, the argument passed will be each element,
  and the closure should return a value used for comparison (either using
  {@link java.lang.Comparable#compareTo(java.lang.Object)} or {@link java.lang.Object#equals(java.lang.Object)}).
  If the closure takes two parameters, two items from the Iterator
  will be passed as arguments, and the closure should return an
  int value (with 0 indicating the items are not unique).
  <pre class="groovyTestCase">
  def items = "Hello".toList() + [null, null] + "there".toList()
  def toLower = { it == null ? null : it.toLowerCase() }
  def noDups = items.iterator().toUnique(toLower).toList()
  assert noDups == ['H', 'e', 'l', 'o', null, 't', 'r']
  </pre>
  <pre class="groovyTestCase">assert [1,4] == [1,3,4,5].toUnique { it % 2 }</pre>
  <pre class="groovyTestCase">assert [2,3,4] == [2,3,3,4].toUnique { a, b -> a <=> b }</pre>
  
  @param self an Iterator
  @param condition a Closure used to determine unique items
  @return an Iterator with no duplicate items
  @since 2.4.0