@Override public int compareTo(Car car) { Preconditions.checkNotNull(car); Preconditions.checkState(timeElapsed != 0L, "Car didn't join the race."); Preconditions.checkState(car.getTimeElapsed() != 0L, "Car didn't join the race."); return ComparisonChain.start().compare(timeElapsed, car.getTimeElapsed()).result(); }
public void run() { try { while (!Thread.interrupted()) { car.waitForWaxing(); printnb("Wax Off! "); TimeUnit.MILLISECONDS.sleep(200); car.buffed(); } } catch (InterruptedException e) { print("Exiting via interrupt"); } print("Ending Wax Off task"); }