Merge branch '1.5.x' into 2.0.x

This commit is contained in:
Phillip Webb
2018-05-25 18:45:37 -07:00
94 changed files with 401 additions and 341 deletions

View File

@@ -34,8 +34,7 @@ class CityServiceImpl implements CityService {
private final HotelRepository hotelRepository;
public CityServiceImpl(CityRepository cityRepository,
HotelRepository hotelRepository) {
CityServiceImpl(CityRepository cityRepository, HotelRepository hotelRepository) {
this.cityRepository = cityRepository;
this.hotelRepository = hotelRepository;
}

View File

@@ -41,8 +41,7 @@ class HotelServiceImpl implements HotelService {
private final ReviewRepository reviewRepository;
public HotelServiceImpl(HotelRepository hotelRepository,
ReviewRepository reviewRepository) {
HotelServiceImpl(HotelRepository hotelRepository, ReviewRepository reviewRepository) {
this.hotelRepository = hotelRepository;
this.reviewRepository = reviewRepository;
}
@@ -82,7 +81,7 @@ class HotelServiceImpl implements HotelService {
private final Map<Rating, Long> ratingCount;
public ReviewsSummaryImpl(List<RatingCount> ratingCounts) {
ReviewsSummaryImpl(List<RatingCount> ratingCounts) {
this.ratingCount = new HashMap<>();
for (RatingCount ratingCount : ratingCounts) {
this.ratingCount.put(ratingCount.getRating(), ratingCount.getCount());
@@ -92,7 +91,7 @@ class HotelServiceImpl implements HotelService {
@Override
public long getNumberOfReviewsWithRating(Rating rating) {
Long count = this.ratingCount.get(rating);
return count == null ? 0 : count;
return (count != null ? count : 0);
}
}