diff --git a/src/main/java/xyz/zhouxy/plusone/commons/function/Predicates.java b/src/main/java/xyz/zhouxy/plusone/commons/function/PredicateTools.java similarity index 87% rename from src/main/java/xyz/zhouxy/plusone/commons/function/Predicates.java rename to src/main/java/xyz/zhouxy/plusone/commons/function/PredicateTools.java index 5cb83a6..f28c770 100644 --- a/src/main/java/xyz/zhouxy/plusone/commons/function/Predicates.java +++ b/src/main/java/xyz/zhouxy/plusone/commons/function/PredicateTools.java @@ -29,7 +29,7 @@ import java.util.function.Predicate; * @since 0.1.0 * @see Predicate */ -public class Predicates { +public class PredicateTools { /** * 将 lambda 表达式或者方法引用指明为对应类型的 {@link Predicate} 对象。 @@ -38,7 +38,7 @@ public class Predicates { * 等方法,连接其它 {@code Predicate} 对象。 * *
-     * Predicate<String> predicate = Predicates.<String>of(Objects::nonNull)
+     * Predicate<String> predicate = PredicateTools.<String>from(Objects::nonNull)
      *         .and(StringUtils::isNotEmpty);
      * 
* @@ -46,11 +46,11 @@ public class Predicates { * @param predicate Lambda 表达式 * @return 传入的表达式自动成为 {@link Predicate} 实例 */ - public static Predicate of(Predicate predicate) { + public static Predicate from(Predicate predicate) { return predicate; } - private Predicates() { + private PredicateTools() { throw new IllegalStateException("Utility class"); } } diff --git a/src/test/java/xyz/zhouxy/plusone/commons/function/FunctionTests.java b/src/test/java/xyz/zhouxy/plusone/commons/function/FunctionTests.java index 2f5eade..e021238 100644 --- a/src/test/java/xyz/zhouxy/plusone/commons/function/FunctionTests.java +++ b/src/test/java/xyz/zhouxy/plusone/commons/function/FunctionTests.java @@ -13,7 +13,7 @@ class FunctionTests { @Test void test() { String str = ""; - Predicate predicate = Predicates.of(Objects::nonNull) + Predicate predicate = PredicateTools.from(Objects::nonNull) .and(StringUtils::isNotBlank); assertFalse(predicate.test(str), "校验应是不通过"); }