@@ -78,7 +78,7 @@ public static boolean isCheckedException(Throwable ex) {
78
78
79
79
/**
80
80
* Check whether the given exception is compatible with the specified
81
- * exception types, as declared in a throws clause.
81
+ * exception types, as declared in a {@code throws} clause.
82
82
* @param ex the exception to check
83
83
* @param declaredExceptions the exception types declared in the throws clause
84
84
* @return whether the given exception is compatible
@@ -143,7 +143,7 @@ public static boolean isEmpty(@Nullable Object obj) {
143
143
}
144
144
145
145
if (obj instanceof Optional <?> optional ) {
146
- return ! optional .isPresent ();
146
+ return optional .isEmpty ();
147
147
}
148
148
if (obj instanceof CharSequence charSequence ) {
149
149
return charSequence .length () == 0 ;
@@ -172,7 +172,7 @@ public static boolean isEmpty(@Nullable Object obj) {
172
172
@ Nullable
173
173
public static Object unwrapOptional (@ Nullable Object obj ) {
174
174
if (obj instanceof Optional <?> optional ) {
175
- if (! optional .isPresent ()) {
175
+ if (optional .isEmpty ()) {
176
176
return null ;
177
177
}
178
178
Object result = optional .get ();
@@ -900,10 +900,10 @@ public static String nullSafeToString(@Nullable short[] array) {
900
900
* <p>Returns:
901
901
* <ul>
902
902
* <li>{@code "null"} if {@code obj} is {@code null}</li>
903
- * <li>{@code"Optional.empty"} if {@code obj} is an empty {@link Optional}</li>
904
- * <li>{@code"Optional[<concise-string>]"} if {@code obj} is a non-empty {@code Optional},
905
- * where {@code <concise-string>} is the result of invoking {@link #nullSafeConciseToString}
906
- * on the object contained in the {@code Optional}</li>
903
+ * <li>{@code "Optional.empty"} if {@code obj} is an empty {@link Optional}</li>
904
+ * <li>{@code "Optional[<concise-string>]"} if {@code obj} is a non-empty {@code Optional},
905
+ * where {@code <concise-string>} is the result of invoking this method on the object
906
+ * contained in the {@code Optional}</li>
907
907
* <li>{@code "{}"} if {@code obj} is an empty array</li>
908
908
* <li>{@code "{...}"} if {@code obj} is a {@link Map} or a non-empty array</li>
909
909
* <li>{@code "[...]"} if {@code obj} is a {@link Collection}</li>
0 commit comments