com.spun.util.MultiSorter Maven / Gradle / Ivy
package com.spun.util;
import java.util.Comparator;
public class MultiSorter implements java.util.Comparator
{
private Comparator[] comparators = null;
public MultiSorter(Comparator... comparators)
{
this.comparators = comparators;
}
public int compare(T o1, T o2)
{
for (Comparator comp : comparators)
{
int value = comp.compare(o1, o2);
if (value != 0)
{ return value; }
}
return 0;
}
}