Class InverseComparator<T>

    • Constructor Detail

      • InverseComparator

        public InverseComparator()
        Default constructor (for ExternalizableLite and PortableObject).
      • InverseComparator

        public InverseComparator​(Comparator<? super T> comparator)
        Construct an InverseComparator.
        Parameters:
        comparator - the comparator whose results are inverted by this Comparator
    • Method Detail

      • compare

        public int compare​(T o1,
                           T o2)
        Use the wrapped Comparator to compare the two arguments for order and negate the result.
        Specified by:
        compare in interface Comparator<T>
        Overrides:
        compare in class SafeComparator<T>
        Parameters:
        o1 - the first object to be compared
        o2 - the second object to be compared
        Returns:
        a positive integer, zero, or a negative integer as the first argument is less than, equal to, or greater than the second
      • compareEntries

        public int compareEntries​(QueryMap.Entry entry1,
                                  QueryMap.Entry entry2)
        Compare two entries using the underlying comparator and negate the result.
        Specified by:
        compareEntries in interface QueryMapComparator<T>
        Overrides:
        compareEntries in class SafeComparator<T>
        Parameters:
        entry1 - the first entry to compare values from; read-only
        entry2 - the second entry to compare values from; read-only
        Returns:
        a negative integer, zero, or a positive integer as the first entry denotes a value that is is less than, equal to, or greater than the value denoted by the second entry
      • equals

        public boolean equals​(Object o)
        Compare the InverseComparator with another object to determine equality.
        Specified by:
        equals in interface Comparator<T>
        Overrides:
        equals in class SafeComparator<T>
        Parameters:
        o - the other comparator
        Returns:
        true iff this InverseComparator and the passed object are equivalent InverseComparator