io.mosip.pms.common.util.MultiFieldComparator Maven / Gradle / Ivy
package io.mosip.pms.common.util;
import java.io.Serializable;
import java.util.Comparator;
import java.util.List;
public class MultiFieldComparator implements Comparator,Serializable {
/**
*
*/
private static final long serialVersionUID = 721977042013245480L;
private List> listComparators;
public MultiFieldComparator(List> listComparators) {
this.listComparators = listComparators;
}
@Override
public int compare(T o1, T o2) {
for (FieldComparator comparator : listComparators) {
int result = comparator.compare(o1, o2);
if (result != 0) {
return result;
}
}
return 0;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy