vehicles-api/src/main/java/com/udacity/vehicles/service/CarService.java
public Car findById(Long id) {
    // Attempt to grab the car from the database
    Optional<Car> optionalCar = repository.findById(id);
    Car car = optionalCar.orElseThrow(CarNotFoundException::new);

    // Set the price received from the price client.
    car.setPrice(priceClient.getPrice(id));

    // Get the updated car location from the map client.
    Location loc = car.getLocation();
    car.setLocation(mapsClient.getAddress(loc));

    return car;
  }
/**
   * Gets car information by ID (or throws exception if non-existent)
   *
   * @param id the ID number of the car to gather information on
   * @return the requested car's information, including location and price
   */
Gets car information by ID (or throws exception if non-existent)
@param id the ID number of the car to gather information on
@return the requested car's information, including location and price
Gets car information by ID ( or throws exception if non - existent ) @param id the ID number of the car to gather information on @return the requested car ' s information including location and price
public Car findById(Long id) {
    Optional<Car> optionalCar = repository.findById(id);
    Car car = optionalCar.orElseThrow(CarNotFoundException::new);
    car.setPrice(priceClient.getPrice(id));
    Location loc = car.getLocation();
    car.setLocation(mapsClient.getAddress(loc));
    return car;
  }
public Car findById ( Long id ) { Optional < Car > optionalCar = repository . findById ( id ) ; Car car = optionalCar . orElseThrow ( CarNotFoundException :: new ) ; car . setPrice ( priceClient . getPrice ( id ) ) ; Location loc = car . getLocation ( ) ; car . setLocation ( mapsClient . getAddress ( loc ) ) ; return car ; }
Gets car information by ID (or throws exception if non-existent)
 @param id the ID number of the car to gather information on
 @return the requested car's information, including location and price
Gets car information by ID ( or throws exception if non - existent ) @param id the ID number of the car to gather information on @return the requested car ' s information including location and price
// Attempt to grab the car from the database // Set the price received from the price client. // Get the updated car location from the map client.