Reverse Order Comparator
>> Tuesday, May 24, 2011
import java.util.Comparator;
public class ReverseOrder<T> implements Comparator<T>
{
private Comparator<T> m_comparator;
public ReverseOrder(Comparator<T> comp)
{
m_comparator = comp;
}
public int compare(T arg0, T arg1)
{
return -1 * m_comparator.compare(arg0, arg1);
}
}
0 comments:
Post a Comment