code: @SuppressWarnings("unchecked")
      public static <T> T[] toUnique(T[] self, Comparator<T> comparator) {
          Collection<T> items = toUnique(toList(self), comparator);
          T[] result = createSimilarArray(self, items.size());
          return items.toArray(result);
      }
docs: Returns a new Array containing the items from the original Array but with duplicates removed with the supplied
  comparator determining which items are unique.
  <p>
  <pre class="groovyTestCase">
  String[] letters = ['c', 'a', 't', 's', 'A', 't', 'h', 'a', 'T']
  String[] lower = ['c', 'a', 't', 's', 'h']
  class LowerComparator implements Comparator {
  int compare(let1, let2) { let1.toLowerCase() {@code <=>} let2.toLowerCase() }
  }
  assert letters.toUnique(new LowerComparator()) == lower
  </pre>
  
  @param self an array
  @param comparator a Comparator used to determine unique (equal) items
  If {@code null}, the Comparable natural ordering of the elements will be used.
  @return the unique items from the array