Top "Comparable" questions

In Java, this interface is implemented by a class to indicate that it can be compared to another object and therefore ordered.

Extending comparable interface and override compareTo

I know this has propably been asked 1000 times, and i have seen 1000 answers, but i didn't see any that actually …

java interface comparable compareto
compareTo() method is not overriding default method when using Comparable interface

I am trying to overwrite the default compareTo() method in java by writing my own and using implements comparable, however …

java interface comparable compareto
Equals and Comparable with Sets

I posted some code here which correctly solved a problem the poster had. OP wanted to remove duplicates and bring …

java equals comparable compareto treeset
LINQ: Use .Except() on collections of different types by making them convertible/comparable?

Given two lists of different types, is it possible to make those types convertible between or comparable to each other (…

c# linq comparison equality comparable
C++ determine if class is comparable

I'm more or less Java programmer, so this might be a stupid question, but I didn't manage to find any …

c++ templates generics comparable
How to implement a generic `max(Comparable a, Comparable b)` function in Java?

I'm trying to write a generic max function that takes two Comparables. So far I have public static <T …

java generics comparable
Java error: "Comparison method violates its general contract!"

I have this code: package org.optimization.geneticAlgorithm; import org.optimization.geneticAlgorithm.selection.Pair; public abstract class Chromosome implements Comparable&…

java openjdk comparable
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
Comparable classes in Python 3

What is the standard way of making a class comparable in Python 3? (For example, by id.)

python class python-3.x comparable
What is Scala's Comparable trait?

I am searching for Scala counterpart of C# IComparable, and I found Comparable trait. I mean -- Comparable is mentioned, …

scala comparable traits