int (@NotNull Delayed other) { if (other == this) { return 0; } if (other instanceof MyScheduledFutureTask) { MyScheduledFutureTask<?> x = (MyScheduledFutureTask<?>)other; long diff = time - x.time; if (diff < 0) { return -1; } if (diff > 0) { return 1; } if (sequenceNumber < x.sequenceNumber) { return -1; } return 1; } long diff = getDelay(TimeUnit.NANOSECONDS) - other.getDelay(TimeUnit.NANOSECONDS); return diff < 0 ? -1 : diff > 0 ? 1 : 0; }