@ Override public int compareTo ( IntsRef other ) { if ( this == other ) return 0 ; final int [ ] aInts = this . ints ; int aUpto = this . offset ; final int [ ] bInts = other . ints ; int bUpto = other . offset ; final int aStop = aUpto + Math . min ( this . length , other . length ) ; while ( aUpto < aStop ) { int aInt = aInts [ aUpto ++ ] ; int bInt = bInts [ bUpto ++ ] ; if ( aInt > bInt ) { return 1 ; } else if ( aInt < bInt ) { return - 1 ; } } // One is a prefix of the other, or, they are equal: return this . length - other . length ; }
Signed int order comparison