Java's ByteBuffer compareTo: Comparing a byte to itself "For float and double"?
<p>Inside of <a href="http://download.oracle.com/javase/6/docs/api/java/nio/ByteBuffer.html" rel="nofollow">Java's ByteBuffer</a> is the method compareTo for implementing Comparable&lt;ByteBuffer&gt;...</p>

<pre><code>public int compareTo(ByteBuffer that) {
    int n = this.position() + Math.min(this.remaining(), that.remaining());
    for (int i = this.position(), j = that.position(); i &lt; n; i++, j++) {
        byte v1 = this.get(i);
        byte v2 = that.get(j);
        if (v1 == v2)
            continue;
        if ((v1 != v1) &amp;&amp; (v2 != v2)) // For float and double
            continue;
        if (v1 &lt; v2)
            return -1;
        return +1;
    }
    return this.remaining() - that.remaining();
}
</code></pre>

<p>What is the point of <code>if ((v1 != v1) &amp;&amp; (v2 != v2)) // For float and double</code>?</p>

<p>If I write this kind of code, I'm warned about comparing identical expressions.</p>
