diff options
Diffstat (limited to 'src/java')
3 files changed, 5 insertions, 5 deletions
diff --git a/src/java/org/apache/poi/ddf/AbstractEscherOptRecord.java b/src/java/org/apache/poi/ddf/AbstractEscherOptRecord.java index 6009b00522..ff4a3e80de 100644 --- a/src/java/org/apache/poi/ddf/AbstractEscherOptRecord.java +++ b/src/java/org/apache/poi/ddf/AbstractEscherOptRecord.java @@ -142,7 +142,7 @@ public abstract class AbstractEscherOptRecord extends EscherRecord { short s1 = p1.getPropertyNumber(); short s2 = p2.getPropertyNumber(); - return s1 < s2 ? -1 : s1 == s2 ? 0 : 1; + return Short.compare(s1, s2); } } ); } diff --git a/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java b/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java index 6c39634117..ecd61ace5e 100644 --- a/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java +++ b/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java @@ -242,16 +242,16 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon final int x = getPriority(); final int y = o.getPriority(); // logic from Integer.compare() - cmp = (x < y) ? -1 : ((x == y) ? 0 : 1); + cmp = Integer.compare(x, y); if (cmp != 0) { return cmp; } - cmp = new Integer(getFormattingIndex()).compareTo(new Integer(o.getFormattingIndex())); + cmp = Integer.compare(getFormattingIndex(), o.getFormattingIndex()); if (cmp != 0) { return cmp; } - return new Integer(getRuleIndex()).compareTo(new Integer(o.getRuleIndex())); + return Integer.compare(getRuleIndex(), o.getRuleIndex()); } @Override diff --git a/src/java/org/apache/poi/ss/util/NumberComparer.java b/src/java/org/apache/poi/ss/util/NumberComparer.java index 56648126e6..bf903ffa92 100644 --- a/src/java/org/apache/poi/ss/util/NumberComparer.java +++ b/src/java/org/apache/poi/ss/util/NumberComparer.java @@ -131,7 +131,7 @@ public final class NumberComparer { * If both numbers are subnormal, Excel seems to use standard comparison rules */ private static int compareSubnormalNumbers(long fracA, long fracB, boolean isNegative) { - int cmp = fracA > fracB ? +1 : fracA < fracB ? -1 : 0; + int cmp = Long.compare(fracA, fracB); return isNegative ? -cmp : cmp; } |