Java Comparator

Java Comparator is an interface for sorting Java objects. Invoked by “java.util.comparator,” Java Comparator compares two Java objects in a “compare(Object 01, Object 02)” format.

Using configurable methods, Java Comparator can compare objects to return an integer based on a positive, equal or negative comparison. Since it is not limited to comparing numbers, this can allow Java Comparator to be set up to order lists alphabetically or numerically. With, Java comparator can also be used to successfully order serialized data structures.

Java Comparator is similar to the Comparable interface but is intended for defining alternate sort orders where Comparable sorts by natural ordering such as lexicographic sorting.

This was last updated in July 2016

Continue Reading About Java Comparator

Dig Deeper on Development tools for continuous software delivery

App Architecture
Software Quality
  • How to test a predictive model

    Strategies for testing predictive models and analytics emphasize data quality, real-time testing and code redundancy, as well as ...

  • The dos and don'ts of visual testing

    The visual aspect of an application is an important part of UX. Defects can potentially result in lost sales and damaged ...

  • 3 QA testing tools to consider

    QA testers need to be able to put applications and APIs through their paces. Here are some examples of tools that can help with ...

Cloud Computing