holmos.reflect.reflectCheck.comparator.HolmosCollectionComparator Maven / Gradle / Ivy
package holmos.reflect.reflectCheck.comparator;
import holmos.reflect.basetool.HolmosCollectionTool;
import holmos.reflect.reflectCheck.HolmosReflectionComparator;
import holmos.reflect.reflectCheck.difference.HolmosCollectionDifference;
import holmos.reflect.reflectCheck.difference.HolmosDifference;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
/**collection和Array的比较器;提供顺序比较和无序比较两种比较方式
* @author 吴银龙(15857164387)
* */
public class HolmosCollectionComparator implements HolmosComparator{
public boolean canCompare(Object leftValue, Object rightValue) {
if(leftValue==null||rightValue==null)
return false;
else if((leftValue.getClass().isArray()||leftValue instanceof Collection)&&
(rightValue.getClass().isArray()||rightValue instanceof Collection))
return true;
return false;
}
public HolmosDifference compare(Object leftValue, Object rightValue
,boolean onlyFirstDifference,HolmosReflectionComparator holmosreflectionComparator) {
List