toolbox.ldap
Class MapOfSetsComparator
java.lang.Object
toolbox.ldap.MapOfSetsComparator
- All Implemented Interfaces:
- java.util.Comparator
public class MapOfSetsComparator
- extends java.lang.Object
- implements java.util.Comparator
Comparator implementation to compare Set values contained within Maps. The
first value in the contained set will be used for the comparison.
It can be used to sort Collections that store Maps.
Constructor Summary |
MapOfSetsComparator(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 |
MapOfSetsComparator
public MapOfSetsComparator(java.lang.Object key,
java.lang.String order)
- Construct a new instance.
- Parameters:
key
- Key that must be used to obtain values from the Maporder
- 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
- Parameters:
obj1
- First Mapobj2
- Second Map
- Returns:
- int indicating the result of the comparison.