public class ClosureComparator
extends java.lang.Object
implements java.util.Comparator<java.lang.Object>
Constructor and Description |
---|
ClosureComparator(Closure closure)
Constructs a ClosureComparator object.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(java.lang.Object o1,
java.lang.Object o2) |
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
void |
setCompareClosure(Closure closure)
Sets the closure to be used to compare objects.
|
public ClosureComparator(Closure closure)
closure
- a Closure objectpublic void setCompareClosure(Closure closure)
closure
- the closure should be of arity two.
The closure takes as its arguments the two objects being compared,
and returns an integer according to the logic of the Comparator
class.public int compare(java.lang.Object o1, java.lang.Object o2)
compare
in interface java.util.Comparator<java.lang.Object>
public boolean equals(java.lang.Object o)
equals
in interface java.util.Comparator<java.lang.Object>
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object