toolbox.app
Class AppBeanComparator
java.lang.Object
toolbox.app.MapComparator
toolbox.app.AppBeanComparator
- All Implemented Interfaces:
- java.util.Comparator
public class AppBeanComparator
- extends MapComparator
- implements java.util.Comparator
Comparator implementation to compare the values contained within AppBean
implementations.
It can be used to sort Lists that store instances of AppBean implementations.
Constructor Summary |
AppBeanComparator(java.lang.Object key,
java.lang.String order)
Construct a new instance. |
Method Summary |
int |
compare(java.lang.Object obj1,
java.lang.Object obj2)
Compare the values mapped to the specified key. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
equals |
AppBeanComparator
public AppBeanComparator(java.lang.Object key,
java.lang.String order)
- Construct a new instance.
- Parameters:
key
- Key that must be used to obtain values from the Map
contained in the AppBeanorder
- String indicating the sort order. Specify "asc" for
ascending order and "desc" for descending order.
compare
public int compare(java.lang.Object obj1,
java.lang.Object obj2)
- Compare the values mapped to the specified key.
- Specified by:
compare
in interface java.util.Comparator
- Overrides:
compare
in class MapComparator
- Parameters:
obj1
- First AppBeanobj2
- Second AppBean
- Returns:
- int indicating the result of the comparison.