public int compareTo(Delayed other) { if (other instanceof SkillXpGain) { // Use more efficient method if possible (private fields) return this.compareTo((SkillXpGain) other); } return (int) (getDelay(TimeUnit.MILLISECONDS) - other.getDelay(TimeUnit.MILLISECONDS)); } @Override public long getDelay(TimeUnit arg0) { return arg0.convert(expiryTime - System.currentTimeMillis(), TimeUnit.MILLISECONDS); } }