Top "Comparator" questions

A Common interface to create an object that specifies the way of comparing other objects.

Sort ArrayList of custom Objects by property

I read about sorting ArrayLists using a Comparator but in all of the examples people used compareTo which according to …

java sorting date comparator
How to use Comparator in Java to sort

I learned how to use the comparable but I'm having difficulty with the Comparator. I am having a error in …

java sorting comparator
When should a class be Comparable and/or Comparator?

I have seen classes which implement both Comparable and Comparator. What does this mean? Why would I use one over …

java comparator comparable
Android-java- How to sort a list of objects by a certain value within the object

Im trying to sort through an arraylist of objects by a particular value within the object. What would be the …

java android sorting collections comparator
"Comparison method violates its general contract!"

Can someone explain me in simple terms, why does this code throw an exception, "Comparison method violates its general contract!", …

java comparator
java comparator, how to sort by integer?

Im trying to learn comparator in java and I have found this great example online, my question is how would …

java android sql-order-by comparator
Java : Comparable vs Comparator

Possible Duplicates: difference between compare() and compareTo() Java: What is the difference between implementing Comparable and Comparator? What are the …

java comparator comparable
Java get String CompareTo as a comparator object

I would like to sort and binary search a static array of strings via the String.CompareTo comparator. The problem …

java string object comparator
Java error: Comparison method violates its general contract

I saw many questions about this, and tried to solve the problem, but after one hour of googling and a …

java compare migration java-7 comparator
Simple way to sort strings in the (case sensitive) alphabetical order

I need to sort list of strings in the alphabetical order: List<String> list = new ArrayList(); list.add("…

java string comparator alphabetical