public static <T> Collection<T> unique(Collection<T> self, @ClosureParams(value=FromString.class, options={"T","T,T"}) Closure closure) {
        return unique(self, true, closure);
    }
public static < T > Collection < T > unique ( Collection < T > self , @ ClosureParams ( value = FromString . class , options = { "T" , "T,T" } ) Closure closure ) { return unique ( self , true , closure ) ; }
A convenience method for making a collection unique using a Closure
to determine duplicate (equal) items.
<p>
If the 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 collection
will be passed as arguments, and the closure should return an
int value (with 0 indicating the items are not unique).
<pre class="groovyTestCase">assert [1,4] == [1,3,4,5].unique { it % 2 }</pre>
<pre class="groovyTestCase">assert [2,3,4] == [2,3,3,4].unique { a, b {@code ->} a {@code <=>} b }</pre>

@param self    a Collection
@param closure a 1 or 2 arg Closure used to determine unique items
@return self   without any duplicates
@see #unique(Collection, boolean, Closure)
@since 1.0