Skip to content

Commit

Permalink
runtime-field: Fix #473 compareTo-method in Comparators
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyknic committed Jun 1, 2017
1 parent 8cba8b6 commit c1183f5
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
Expand Up @@ -71,7 +71,7 @@ public int compare(ENTITY first, ENTITY second) {
requireNonNulls(first, second);
final byte a = field.getAsByte(first);
final byte b = field.getAsByte(second);
return applyReversed(a - b);
return applyReversed(Byte.compare(a, b));
}

@Override
Expand Down
Expand Up @@ -71,7 +71,7 @@ public int compare(ENTITY first, ENTITY second) {
requireNonNulls(first, second);
final char a = field.getAsChar(first);
final char b = field.getAsChar(second);
return applyReversed(a - b);
return applyReversed(Character.compare(a, b));
}

@Override
Expand Down
Expand Up @@ -71,7 +71,7 @@ public int compare(ENTITY first, ENTITY second) {
requireNonNulls(first, second);
final double a = field.getAsDouble(first);
final double b = field.getAsDouble(second);
return applyReversed(a - b);
return applyReversed(Double.compare(a, b));
}

@Override
Expand Down
Expand Up @@ -71,7 +71,7 @@ public int compare(ENTITY first, ENTITY second) {
requireNonNulls(first, second);
final float a = field.getAsFloat(first);
final float b = field.getAsFloat(second);
return applyReversed(a - b);
return applyReversed(Float.compare(a, b));
}

@Override
Expand Down
Expand Up @@ -71,7 +71,7 @@ public int compare(ENTITY first, ENTITY second) {
requireNonNulls(first, second);
final int a = field.getAsInt(first);
final int b = field.getAsInt(second);
return applyReversed(a - b);
return applyReversed(Integer.compare(a, b));
}

@Override
Expand Down
Expand Up @@ -71,7 +71,7 @@ public int compare(ENTITY first, ENTITY second) {
requireNonNulls(first, second);
final long a = field.getAsLong(first);
final long b = field.getAsLong(second);
return applyReversed(a - b);
return applyReversed(Long.compare(a, b));
}

@Override
Expand Down
Expand Up @@ -71,7 +71,7 @@ public int compare(ENTITY first, ENTITY second) {
requireNonNulls(first, second);
final short a = field.getAsShort(first);
final short b = field.getAsShort(second);
return applyReversed(a - b);
return applyReversed(Short.compare(a, b));
}

@Override
Expand Down

0 comments on commit c1183f5

Please sign in to comment.