Comparison method violates its general contract
<p>I am getting the Comparison method violates its general contract exception with this compareTo method, but I can't track down what is exactly causing the issue.  I am trying to sort files by their extension in a particular way.  Mind you this doesn't happen for all phones, just ones that I don't have access to which makes it harder to test out.</p>

<pre><code>public int compareTo(NzbFile another) 
{
    if (this.getFileName() != null &amp;&amp; another.getFileName() != null)
    {
        if (this.getFileName().toLowerCase().endsWith(".nfo"))
            return -1000;
        else if (another.getFileName().toLowerCase().endsWith(".nfo"))
            return 1000;
        else if (this.getFileName().toLowerCase().endsWith(".sfv"))
            return -999;
        else if (another.getFileName().toLowerCase().endsWith(".sfv"))
            return 1001;
        else if (this.getFileName().toLowerCase().endsWith(".srr"))
            return -998;
        else if (another.getFileName().toLowerCase().endsWith(".srr"))
            return 1002;
        else if (this.getFileName().toLowerCase().endsWith(".nzb"))
            return -997;
        else if (another.getFileName().toLowerCase().endsWith(".nzb"))
            return 1003;
        else if (this.getFileName().toLowerCase().endsWith(".srt"))
            return -996;
        else if (another.getFileName().toLowerCase().endsWith(".srt"))
            return 1004;
        else
            return this.getFileName().compareTo(another.getFileName());
    }
    else if (this.getFileName() != null &amp;&amp; another.getFileName() == null)
    {
        return -995;
    }
    else if (this.getFileName() == null &amp;&amp; another.getFileName() != null)
    {
        return 1005;
    }
    else
    {
        return this.getSubject().compareTo(another.getSubject());
    }

}
</code></pre>
