ARTEMIS-2320 'compare()' method can be used to compare numbers

This commit is contained in:
Jiri Danek 2019-04-26 22:37:45 +02:00 committed by Michael Andre Pearce
parent d076d1ca59
commit 34e5d607ef
3 changed files with 3 additions and 15 deletions

View File

@ -239,13 +239,7 @@ public final class XmlDataImporter extends ActionAbstract {
messages = new TreeSet<XMLMessageImporter.MessageInfo>(new Comparator<XMLMessageImporter.MessageInfo>() {
@Override
public int compare(XMLMessageImporter.MessageInfo o1, XMLMessageImporter.MessageInfo o2) {
if (o1.id == o2.id) {
return 0;
} else if (o1.id > o2.id) {
return 1;
} else {
return -1;
}
return Long.compare(o1.id, o2.id);
}
});
}

View File

@ -110,13 +110,7 @@ public class PagePositionImpl implements PagePosition {
return 1;
} else if (pageNr < o.getPageNr()) {
return -1;
} else if (recordID > o.getRecordID()) {
return 1;
} else if (recordID < o.getRecordID()) {
return -1;
} else {
return 0;
}
} else return Long.compare(recordID, o.getRecordID());
}
@Override

View File

@ -1106,7 +1106,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase {
public int compareTo(final OrderedConsumerHolder o) {
int thisOrder = order;
int otherOrder = o.order;
return thisOrder < otherOrder ? -1 : thisOrder == otherOrder ? 0 : 1;
return Integer.compare(thisOrder, otherOrder);
}
}