- if (isArchive.apply(this) && !isArchive.apply(result)) {
- return 1;
- }
- if (!isArchive.apply(this) && isArchive.apply(result)) {
- return -1;
- }
- /* sort by bot name. */
- return botNameComparator.compare(bot().name(), result.bot().name());
+ return ComparisonChain.start()
+ .compare(this, result, packArchiveComparator)
+ .compare(this, result, botNameComparator)
+ .compare(this, result, packNameComparator).result();