Fix DataWord compareTo in convention with Comparable interface

This commit is contained in:
nicksavers 2014-10-20 12:39:14 +02:00
parent 7065c33487
commit a2e8b18126
1 changed files with 3 additions and 2 deletions

View File

@ -282,9 +282,10 @@ public class DataWord implements Comparable<DataWord> {
@Override
public int compareTo(DataWord o) {
if (o == null || o.getData() == null) return -1;
return FastByteComparisons.compareTo(
int result = FastByteComparisons.compareTo(
data, 0, data.length,
o.getData(), 0, o.getData().length);
// Convert result into -1, 0 or 1 as is the convention
return (int) Math.signum(result);
}
}