From f2e898d35de7d6bd8c24100d631dad9148edb2e8 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Fri, 25 Aug 2023 15:25:40 +0200 Subject: [PATCH] Polish --- .../java/org/springframework/util/ObjectUtils.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/util/ObjectUtils.java b/spring-core/src/main/java/org/springframework/util/ObjectUtils.java index 4ac11a32bfa..db8aa1ebeba 100644 --- a/spring-core/src/main/java/org/springframework/util/ObjectUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ObjectUtils.java @@ -78,7 +78,7 @@ public abstract class ObjectUtils { /** * Check whether the given exception is compatible with the specified - * exception types, as declared in a throws clause. + * exception types, as declared in a {@code throws} clause. * @param ex the exception to check * @param declaredExceptions the exception types declared in the throws clause * @return whether the given exception is compatible @@ -143,7 +143,7 @@ public abstract class ObjectUtils { } if (obj instanceof Optional optional) { - return !optional.isPresent(); + return optional.isEmpty(); } if (obj instanceof CharSequence charSequence) { return charSequence.length() == 0; @@ -172,7 +172,7 @@ public abstract class ObjectUtils { @Nullable public static Object unwrapOptional(@Nullable Object obj) { if (obj instanceof Optional optional) { - if (!optional.isPresent()) { + if (optional.isEmpty()) { return null; } Object result = optional.get(); @@ -900,10 +900,10 @@ public abstract class ObjectUtils { *

Returns: *