This commit is contained in:
Looly 2022-08-16 11:32:26 +08:00
parent fcb12d19e1
commit ff38207bbe
2 changed files with 10 additions and 8 deletions

View File

@ -2560,13 +2560,13 @@ public class CollUtil {
/** /**
* 一个对象不为空且不存在于该集合中时加入到该集合中<br> * 一个对象不为空且不存在于该集合中时加入到该集合中<br>
* <pre> * <pre>
* null, null => false * null, null -&gt; false
* [], null => false * [], null -&gt; false
* null, "123" => false * null, "123" -&gt; false
* ["123"], "123" => false * ["123"], "123" -&gt; false
* [], "123" => true * [], "123" -&gt; true
* ["456"], "123" => true * ["456"], "123" -&gt; true
* [Animal{"name": "jack"}], Dog{"name": "jack"} => true * [Animal{"name": "jack"}], Dog{"name": "jack"} -&gt; true
* </pre> * </pre>
* *
* @param collection 被加入的集合 * @param collection 被加入的集合
@ -2576,7 +2576,7 @@ public class CollUtil {
* @return 是否添加成功 * @return 是否添加成功
* @author Cloud-Style * @author Cloud-Style
*/ */
public static <T, S extends T> boolean addIfAbsent(Collection<T> collection, S object) { public static <T, S extends T> boolean addIfAbsent(final Collection<T> collection, final S object) {
if (object == null || collection == null || collection.contains(object)) { if (object == null || collection == null || collection.contains(object)) {
return false; return false;
} }

View File

@ -56,6 +56,7 @@ public class CharSequenceUtil extends StrChecker {
/** /**
* 当给定字符串为空字符串时转换为{@code null} * 当给定字符串为空字符串时转换为{@code null}
* *
* @param <T> 字符串类型
* @param str 被转换的字符串 * @param str 被转换的字符串
* @return 转换后的字符串 * @return 转换后的字符串
*/ */
@ -129,6 +130,7 @@ public class CharSequenceUtil extends StrChecker {
* @param handler 非blank的处理方法 * @param handler 非blank的处理方法
* @param defaultSupplier 默认值提供者 * @param defaultSupplier 默认值提供者
* @param <T> 对象类型必须实现CharSequence接口 * @param <T> 对象类型必须实现CharSequence接口
* @param <V> 结果类型
* @return 被检查对象为{@code null}返回默认值否则返回自定义handle处理后的返回值 * @return 被检查对象为{@code null}返回默认值否则返回自定义handle处理后的返回值
* @throws NullPointerException {@code defaultValueSupplier == null} 抛出 * @throws NullPointerException {@code defaultValueSupplier == null} 抛出
* @since 5.7.20 * @since 5.7.20