Top "Comparator" questions

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

Java Comparator class to sort arrays

Say, we have the following 2-dimensional array: int camels[][] = new int[n][2]; How should Java Comparator class be declared to …

java arrays multidimensional-array comparator
Java TreeMap Comparator

I need a comparator for a TreeMap. Should I write this anonymously in the constructor for my TreeMap? How else …

java comparator treemap sortedmap
When to use Comparable and Comparator

I have a list of objects I need to sort on a field, say Score. Without giving much thought I …

java comparator comparable
Reverse a comparator in Java 8

I have an ArrayList and want sort it in descending order. I use for it java.util.stream.Stream.sorted(…

java sorting java-8 comparator java-stream
Comparator with double type

I have written the following code: public class NewClass2 implements Comparator<Point> { public int compare(Point p1, Point …

java casting double comparator
Using a comparator function to sort

So I'm working with a few pre-existing comparators that compare certain values in two tuples and return true if the …

python sorting comparator
Natural sort order string comparison in Java - is one built in?

I'd like some kind of string comparison function that preserves natural sort order1. Is there anything like this built into …

java algorithm comparator natural-sort
Implementing Java Comparator

I am trying to write an algorithm which utilizes a min-priority queue, so I looked around on google and found …

java implementation priority-queue comparator
comparator with null values

We have some code which sorts a list of addresses based on the distance between their coordinates. this is done …

java comparator
What's the difference between "LIKE" and "=" in SQL?

Is there any difference between: SELECT * FROM users WHERE username="davyjones" and SELECT * FROM users WHERE username LIKE "davyjones"

sql syntax comparator