What can be reason of this exception:
java.lang.IllegalArgumentException: Comparison method violates its general contract!
        at java.util.TimSort.mergeLo(TimSort.java:747)
        at java.util.TimSort.mergeAt(TimSort.java:483)
        at java.util.TimSort.mergeForceCollapse(TimSort.java:426)
        at java.util.TimSort.sort(TimSort.java:223)
        at java.util.TimSort.sort(TimSort.java:173)
        at java.util.Arrays.sort(Arrays.java:659)
        at java.util.Collections.sort(Collections.java:217)
        ...
i use comparator like this:
private Comparator<SomeObject> comporator = new Comparator<SomeObject>() {
    public int compare(SomeObject o1, SomeObject o2) {
        return Double.compare(o2.getValue(), o1.getValue());
    }
};
public double getValue() {
    double value = 0;
    for (Parameter parameter : parametrs()) {
        value = value + (parameter.getWeight() * parameter.getSomeValue(this));
    }
    return value;//20.0, 23.0 ...
}
where parameter.getSomeValue:
public int getSomeValue(SomeObject process) {
    return (int) ((System.currentTimeMillis() - process.getPutTime()) / 1000);
}
in:
public void sort() {
    synchronized (list) {
        Collections.sort(list, comporator);
    }
}
where:
List<SomeObject> list = new ArrayList<SomeObject>();
I can't reproduce this exception, but it arises sometimes. Also, can you give code example where this issue appear in 100% of cases?
 
    