Skip to content

Commit 48498c3

Browse files
Use isEmpty and polish diamond operator
1 parent e531134 commit 48498c3

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ public void customize(TransactionManager transactionManager) {
5959
* @since 3.2.0
6060
*/
6161
public static TransactionManagerCustomizers of(Collection<? extends TransactionManagerCustomizer<?>> customizers) {
62-
return new TransactionManagerCustomizers((customizers != null) ? new ArrayList<>(customizers)
63-
: Collections.<TransactionManagerCustomizer<?>>emptyList());
62+
return new TransactionManagerCustomizers(
63+
(customizers != null) ? new ArrayList<>(customizers) : Collections.emptyList());
6464
}
6565

6666
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletPath.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ default String getPrefix() {
7474
* @return the path as a servlet URL mapping
7575
*/
7676
default String getServletUrlMapping() {
77-
if (getPath().equals("") || getPath().equals("/")) {
77+
if (getPath().isEmpty() || getPath().equals("/")) {
7878
return "/";
7979
}
8080
if (getPath().contains("*")) {

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public void setLoadOnStartup(int loadOnStartup) {
237237
}
238238

239239
public String getServletMapping() {
240-
if (this.path.equals("") || this.path.equals("/")) {
240+
if (this.path.isEmpty() || this.path.equals("/")) {
241241
return "/";
242242
}
243243
if (this.path.endsWith("/")) {

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ private String getContextPath() {
416416
.map(TomcatEmbeddedContext.class::cast)
417417
.filter(this::imperative)
418418
.map(TomcatEmbeddedContext::getPath)
419-
.map((path) -> path.equals("") ? "/" : path)
419+
.map((path) -> path.isEmpty() ? "/" : path)
420420
.collect(Collectors.joining(" "));
421421
return StringUtils.hasText(contextPath) ? contextPath : null;
422422
}

0 commit comments

Comments
 (0)