修改类名,与 guava 的 Predicates 区分。

dev
ZhouXY108 2024-03-14 23:18:44 +08:00
parent dc9e0d1b53
commit 7f80a411db
2 changed files with 5 additions and 5 deletions

View File

@ -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<? super T>}
*
* <pre>
* Predicate&lt;String&gt; predicate = Predicates.&lt;String&gt;of(Objects::nonNull)
* Predicate&lt;String&gt; predicate = PredicateTools.&lt;String&gt;from(Objects::nonNull)
* .and(StringUtils::isNotEmpty);
* </pre>
*
@ -46,11 +46,11 @@ public class Predicates {
* @param predicate Lambda
* @return {@link Predicate}
*/
public static <T> Predicate<T> of(Predicate<T> predicate) {
public static <T> Predicate<T> from(Predicate<T> predicate) {
return predicate;
}
private Predicates() {
private PredicateTools() {
throw new IllegalStateException("Utility class");
}
}

View File

@ -13,7 +13,7 @@ class FunctionTests {
@Test
void test() {
String str = "";
Predicate<String> predicate = Predicates.<String>of(Objects::nonNull)
Predicate<String> predicate = PredicateTools.<String>from(Objects::nonNull)
.and(StringUtils::isNotBlank);
assertFalse(predicate.test(str), "校验应是不通过");
}