diff --git a/src/main/java/org/apache/commons/math3/genetics/Chromosome.java b/src/main/java/org/apache/commons/math3/genetics/Chromosome.java index f12f5bd72..83c38153b 100644 --- a/src/main/java/org/apache/commons/math3/genetics/Chromosome.java +++ b/src/main/java/org/apache/commons/math3/genetics/Chromosome.java @@ -59,7 +59,7 @@ public abstract class Chromosome implements Comparable,Fitness { * */ public int compareTo(final Chromosome another) { - return ((Double)this.getFitness()).compareTo(another.getFitness()); + return Double.compare(getFitness(), another.getFitness()); } /**