int (IteratorWrapper o1, IteratorWrapper o2) { if (o1 == null) { return 1; } if (o2 == null) { return -1; } int startDiff = Math.max(o1.iterator.getRangeStart(), myCurrentEnd) - Math.max(o2.iterator.getRangeStart(), myCurrentEnd); if (startDiff != 0) { return startDiff; } return o2.order - o1.order; }