添加判空方法。

ZhouXY108 2024-03-14 19:15:50 +08:00
parent 5cad71ed34
commit e4f18d5d89
1 changed files with 5 additions and 1 deletions

View File

@ -14,8 +14,12 @@ public class PredicateTools {
return predicate; return predicate;
} }
public static <T> boolean notNull(T obj) {
return obj != null;
}
public static <T> Predicate<T> notNull() { public static <T> Predicate<T> notNull() {
return obj -> obj != null; return PredicateTools::notNull;
} }
public static int length(CharSequence cs) { public static int length(CharSequence cs) {