All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.mosip.pms.common.util.MultiFieldComparator Maven / Gradle / Ivy

There is a newer version: 1.3.0-dp.1
Show newest version
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