コード例 #1
0
 @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();
 }
コード例 #2
0
 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");
 }