Top "Comparator" questions

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

Sorting Java objects using multiple keys

I've got a collection of Duck objects and I'd like to sort them using multiple keys. class Duck { DuckAge age; //…

java sorting comparator comparable
When catch doesn't actually catch anything

I had a program crash because of bad data stored in a database recently. This confused me, because I thought …

java exception try-catch comparator
TreeSet Custom Comparator Algo .. String Comparision

From the input string provided: { "200,400,7,1", "100,0,1,1", "200,200,3,1", "0,400,11,1", "407,308,5,1","100,600,9,1" } , I am adding the same in a TreeSet and want it to be sorted with …

java comparator treeset
Java TreeMap (comparator) and get method ignoring the comparator

public final Comparator<String> ID_IGN_CASE_COMP = new Comparator<String>() { public int compare(String s1, …

java comparator treemap
What does comparison being consistent with equals mean ? What can possibly happen if my class doesn't follow this principle?

From the JavaDoc of TreeMap : Note that the ordering maintained by a sorted map (whether or not an explicit comparator …

java comparison equals comparator comparable
Comparator<String> must override super class method

I'm making a TreeMap<String, String> and want to order it in a descending fashion. I created the …

java generics map comparator treemap
Comparator vs Apache BeanComparator

Consider a simple class: class Employee { String name; int sal; ....//getters and setters } I can create a Comparator to sort …

java performance apache comparison comparator
Compare method throw exception: Comparison method violates its general contract

Possible Duplicate: why does my compare method throw exception — Comparison method violates its general contract! I've this code: class TimeComparatorTipo0 …

java exception comparator contract
Java Collections.sort - help me remove the unchecked warning

List<Question> questions = new ArrayList<Question>(); questions.addAll(getAllQuestions()); //returns a set of Questions Collections.sort(…

java generics comparator apache-commons-beanutils
4 bit magnitude comparator VHDL

I have to make a 4bit magnitude comparator in VHDL with only concurrent statements (no if/else or case/when). …

vhdl comparator magnitude