Commit 9ca9a491 authored by Phillip Webb's avatar Phillip Webb

Fix checkstyle issues in samples

Fix checkstyle issues with samples following the
spring-javaformat upgrade.

See gh-13932
parent 63b60982
...@@ -25,7 +25,7 @@ public interface HotelSummary { ...@@ -25,7 +25,7 @@ public interface HotelSummary {
Double getAverageRating(); Double getAverageRating();
default Integer getAverageRatingRounded() { default Integer getAverageRatingRounded() {
return (getAverageRating() != null ? (int) Math.round(getAverageRating()) : null); return (getAverageRating() != null) ? (int) Math.round(getAverageRating()) : null;
} }
} }
...@@ -91,7 +91,7 @@ class HotelServiceImpl implements HotelService { ...@@ -91,7 +91,7 @@ class HotelServiceImpl implements HotelService {
@Override @Override
public long getNumberOfReviewsWithRating(Rating rating) { public long getNumberOfReviewsWithRating(Rating rating) {
Long count = this.ratingCount.get(rating); Long count = this.ratingCount.get(rating);
return (count != null ? count : 0); return (count != null) ? count : 0;
} }
} }
......
...@@ -33,11 +33,6 @@ public final class VehicleIdentificationNumber { ...@@ -33,11 +33,6 @@ public final class VehicleIdentificationNumber {
this.vin = vin; this.vin = vin;
} }
@Override
public int hashCode() {
return this.vin.hashCode();
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == this) { if (obj == this) {
...@@ -49,6 +44,11 @@ public final class VehicleIdentificationNumber { ...@@ -49,6 +44,11 @@ public final class VehicleIdentificationNumber {
return this.vin.equals(((VehicleIdentificationNumber) obj).vin); return this.vin.equals(((VehicleIdentificationNumber) obj).vin);
} }
@Override
public int hashCode() {
return this.vin.hashCode();
}
@Override @Override
public String toString() { public String toString() {
return this.vin; return this.vin;
......
...@@ -49,11 +49,6 @@ public class VehicleDetails { ...@@ -49,11 +49,6 @@ public class VehicleDetails {
return this.model; return this.model;
} }
@Override
public int hashCode() {
return this.make.hashCode() * 31 + this.model.hashCode();
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == this) { if (obj == this) {
...@@ -66,4 +61,9 @@ public class VehicleDetails { ...@@ -66,4 +61,9 @@ public class VehicleDetails {
return this.make.equals(other.make) && this.model.equals(other.model); return this.make.equals(other.make) && this.model.equals(other.model);
} }
@Override
public int hashCode() {
return this.make.hashCode() * 31 + this.model.hashCode();
}
} }
...@@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService { ...@@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService {
private final String echoFormat; private final String echoFormat;
public DefaultEchoService(String echoFormat) { public DefaultEchoService(String echoFormat) {
this.echoFormat = (echoFormat != null ? echoFormat : "%s"); this.echoFormat = (echoFormat != null) ? echoFormat : "%s";
} }
@Override @Override
......
...@@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService { ...@@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService {
private final String echoFormat; private final String echoFormat;
public DefaultEchoService(String echoFormat) { public DefaultEchoService(String echoFormat) {
this.echoFormat = (echoFormat != null ? echoFormat : "%s"); this.echoFormat = (echoFormat != null) ? echoFormat : "%s";
} }
@Override @Override
......
...@@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService { ...@@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService {
private final String echoFormat; private final String echoFormat;
public DefaultEchoService(String echoFormat) { public DefaultEchoService(String echoFormat) {
this.echoFormat = (echoFormat != null ? echoFormat : "%s"); this.echoFormat = (echoFormat != null) ? echoFormat : "%s";
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment