ARTEMIS-2320 'compare()' method can be used to compare numbers
This commit is contained in:
parent
d076d1ca59
commit
34e5d607ef
|
@ -239,13 +239,7 @@ public final class XmlDataImporter extends ActionAbstract {
|
||||||
messages = new TreeSet<XMLMessageImporter.MessageInfo>(new Comparator<XMLMessageImporter.MessageInfo>() {
|
messages = new TreeSet<XMLMessageImporter.MessageInfo>(new Comparator<XMLMessageImporter.MessageInfo>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(XMLMessageImporter.MessageInfo o1, XMLMessageImporter.MessageInfo o2) {
|
public int compare(XMLMessageImporter.MessageInfo o1, XMLMessageImporter.MessageInfo o2) {
|
||||||
if (o1.id == o2.id) {
|
return Long.compare(o1.id, o2.id);
|
||||||
return 0;
|
|
||||||
} else if (o1.id > o2.id) {
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,13 +110,7 @@ public class PagePositionImpl implements PagePosition {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (pageNr < o.getPageNr()) {
|
} else if (pageNr < o.getPageNr()) {
|
||||||
return -1;
|
return -1;
|
||||||
} else if (recordID > o.getRecordID()) {
|
} else return Long.compare(recordID, o.getRecordID());
|
||||||
return 1;
|
|
||||||
} else if (recordID < o.getRecordID()) {
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1106,7 +1106,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase {
|
||||||
public int compareTo(final OrderedConsumerHolder o) {
|
public int compareTo(final OrderedConsumerHolder o) {
|
||||||
int thisOrder = order;
|
int thisOrder = order;
|
||||||
int otherOrder = o.order;
|
int otherOrder = o.order;
|
||||||
return thisOrder < otherOrder ? -1 : thisOrder == otherOrder ? 0 : 1;
|
return Integer.compare(thisOrder, otherOrder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue