
com.jidesoft.comparator.FastComparableComparator Maven / Gradle / Ivy
/*
* @(#)FastComparableComparator.java 2/27/2007
*
* Copyright 2002 - 2007 JIDE Software Inc. All rights reserved.
*/
package com.jidesoft.comparator;
import java.io.Serializable;
import java.util.Comparator;
/**
* A Comparator that compares Comparable objects. Throws ClassCastExceptions if the objects are not Comparable, or if
* they are null. Different from {@link ComparableComparator}, it will not throw exception when the two compareTo
* methods don't provide an inverse result of each other as per the Comparable javadoc. We do so mainly to reduce one
* call to compareTo.
If both objects are null, they will be treated as equal. If one is null and the other is not,
* the null value will be treated as smaller then non-null value.
*
* @author [email protected]
* @author JIDE Software
*/
public class FastComparableComparator implements Comparator
© 2015 - 2025 Weber Informatics LLC | Privacy Policy