|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.util.comparator.InvertibleComparator
public class InvertibleComparator
A decorator for a comparator, with an "ascending" flag denoting whether comparison results should be treated in forward (standard ascending) order or flipped for reverse (descending) order.
Constructor Summary | |
---|---|
InvertibleComparator(Comparator comparator)
Create an InvertibleComparator that sorts ascending by default. |
|
InvertibleComparator(Comparator comparator,
boolean ascending)
Create an InvertibleComparator that sorts based on the provided order. |
Method Summary | |
---|---|
int |
compare(Object o1,
Object o2)
|
boolean |
equals(Object obj)
|
int |
hashCode()
|
void |
invertOrder()
Invert the sort order: ascending -> descending or descending -> ascending. |
boolean |
isAscending()
Return the sort order: ascending (true) or descending (false). |
void |
setAscending(boolean ascending)
Specify the sort order: ascending (true) or descending (false). |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public InvertibleComparator(Comparator comparator)
comparator
- the comparator to decoratepublic InvertibleComparator(Comparator comparator, boolean ascending)
comparator
- the comparator to decorateascending
- the sort order: ascending (true) or descending (false)Method Detail |
---|
public void setAscending(boolean ascending)
public boolean isAscending()
public void invertOrder()
public int compare(Object o1, Object o2)
compare
in interface Comparator
public boolean equals(Object obj)
equals
in interface Comparator
equals
in class Object
public int hashCode()
public String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |