Class ComparableComparator<T>

    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        The serial version UID
        See Also:
        Constant Field Values
      • LOG

        private static final org.slf4j.Logger LOG
        A logger for this class
    • Constructor Detail

      • ComparableComparator

        public ComparableComparator​(String oid)
        The ComparableComparator constructor.
        Parameters:
        oid - the comparator OID
    • Method Detail

      • compare

        public int compare​(Comparable<T> o1,
                           Comparable<T> o2)
        Compares two objects taking into account that one may be a Comparable. If the first is a comparable then its compareTo operation is called and the result returned as is. If the first is not a Comparable but the second is then its compareTo method is called and the result is returned after being negated. If none are comparable the hashCode of o1 minus the hashCode of o2 is returned.
        Parameters:
        o1 - the first comparable
        o2 - the second comparable
        Returns: