Skip to content

Commit 0db2941

Browse files
committed
Fix ObjectId compareTo for Java 6
JAVA-1785
1 parent 651e53b commit 0db2941

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bson/src/main/org/bson/types/ObjectId.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ public int compareTo(final ObjectId other) {
409409
byte[] otherByteArray = other.toByteArray();
410410
for (int i = 0; i < 12; i++) {
411411
if (byteArray[i] != otherByteArray[i]) {
412-
return Integer.compare(byteArray[i] & 0xff, otherByteArray[i] & 0xff);
412+
return ((byteArray[i] & 0xff) < (otherByteArray[i] & 0xff)) ? -1 : 1;
413413
}
414414
}
415415
return 0;

0 commit comments

Comments
 (0)