Use .isEmpty() where feasible

See gh-38739
This commit is contained in:
Yanming Zhou
2023-12-19 22:27:26 -08:00
committed by Phillip Webb
parent d3af5cce73
commit ac18e3015c
18 changed files with 31 additions and 31 deletions

View File

@@ -332,7 +332,7 @@ class OnBeanCondition extends FilteringSpringBootCondition implements Configurat
private void appendMessageForNoMatches(StringBuilder reason, Collection<String> unmatched, String description) {
if (!unmatched.isEmpty()) {
if (reason.length() > 0) {
if (!reason.isEmpty()) {
reason.append(" and ");
}
reason.append("did not find any beans ");
@@ -347,7 +347,7 @@ class OnBeanCondition extends FilteringSpringBootCondition implements Configurat
appendMessageForMatches(reason, matchResult.getMatchedAnnotations(), "annotated with");
appendMessageForMatches(reason, matchResult.getMatchedTypes(), "of type");
if (!matchResult.getMatchedNames().isEmpty()) {
if (reason.length() > 0) {
if (!reason.isEmpty()) {
reason.append(" and ");
}
reason.append("found beans named ");
@@ -360,7 +360,7 @@ class OnBeanCondition extends FilteringSpringBootCondition implements Configurat
String description) {
if (!matches.isEmpty()) {
matches.forEach((key, value) -> {
if (reason.length() > 0) {
if (!reason.isEmpty()) {
reason.append(" and ");
}
reason.append("found beans ");