本文整理了Java中java.util.function.Predicate.test()
方法的一些代码示例,展示了Predicate.test()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Predicate.test()
方法的具体详情如下:
包路径:java.util.function.Predicate
类名称:Predicate
方法名:test
[英]Evaluates this predicate on the given argument.
[中]根据给定的参数计算该谓词。
代码示例来源:origin: SonarSource/sonarqube
@Override
public boolean test(@Nonnull ComponentDto input) {
return predicate.test(input);
}
代码示例来源:origin: jooby-project/jooby
/**
* Setup a route error handler. The error handler will be executed if current status code matches
* the one provided.
*
* All headers are reset while generating the error response.
*
* @param predicate Apply the error handler if the predicate evaluates to <code>true</code>.
* @param handler A route error handler.
* @return This router.
*/
@Nonnull
default Router err(final Predicate<Status> predicate, final Err.Handler handler) {
return err((req, rsp, err) -> {
if (predicate.test(Status.valueOf(err.statusCode()))) {
handler.handle(req, rsp, err);
}
});
}
代码示例来源:origin: sinkillerj/ProjectE
@Override
public boolean isItemValid(@Nonnull ItemStack stack)
{
return SlotPredicates.RELAY_INV.test(stack);
}
代码示例来源:origin: com.github.bloodshura/shurax
default boolean all(@Nonnull Predicate<E> predicate) {
for (E object : this) {
if (!predicate.test(object)) {
return false;
}
}
return true;
}
代码示例来源:origin: com.github.bloodshura/ignitium-core
default int count(@Nonnull Predicate<E> predicate) {
int count = 0;
for (E object : this) {
if (predicate.test(object)) {
count++;
}
}
return count;
}
代码示例来源:origin: sinkillerj/ProjectE
@Override
public boolean isItemValid(@Nonnull ItemStack stack)
{
return SlotPredicates.RELAY_INV.test(stack);
}
代码示例来源:origin: com.github.bloodshura/shurax
default boolean any(@Nonnull Predicate<E> predicate) {
for (E object : this) {
if (predicate.test(object)) {
return true;
}
}
return false;
}
代码示例来源:origin: com.github.bloodshura/shurax
default int count(@Nonnull Predicate<E> predicate) {
int count = 0;
for (E object : this) {
if (predicate.test(object)) {
count++;
}
}
return count;
}
代码示例来源:origin: com.github.bloodshura/ignitium-core
default boolean any(@Nonnull Predicate<E> predicate) {
for (E object : this) {
if (predicate.test(object)) {
return true;
}
}
return false;
}
代码示例来源:origin: zolyfarkas/spf4j
/**
* Is this Throwable a JVM non-recoverable exception. (Oom, VMError, etc...)
* @param t
* @return
*/
public static boolean isNonRecoverable(@Nonnull final Throwable t) {
return nonRecoverableClassificationPredicate.test(t);
}
代码示例来源:origin: com.github.bloodshura/ignitium-core
default boolean all(@Nonnull Predicate<E> predicate) {
for (E object : this) {
if (!predicate.test(object)) {
return false;
}
}
return true;
}
代码示例来源:origin: zolyfarkas/spf4j
/**
* Is this Throwable a JVM non-recoverable exception. (Oom, VMError, etc...)
* @param t
* @return
*/
public static boolean isNonRecoverable(@Nonnull final Throwable t) {
return nonRecoverableClassificationPredicate.test(t);
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-server
@Override
public boolean test(@Nonnull ComponentDto input) {
return predicate.test(input);
}
代码示例来源:origin: com.github.bloodshura/shurax
@Nullable
default E selectLast(@Nonnull Predicate<E> predicate) {
E result = null;
for (E object : this) {
if (predicate.test(object)) {
result = object;
}
}
return result;
}
代码示例来源:origin: com.github.bloodshura/ignitium-core
public static <E> boolean all(@Nonnull E[] array, @Nonnull Predicate<? super E> predicate) {
for (E object : array) {
if (!predicate.test(object)) {
return false;
}
}
return true;
}
代码示例来源:origin: com.github.bloodshura/ignitium-core
public static <E> boolean any(@Nonnull E[] array, @Nonnull Predicate<? super E> predicate) {
for (E object : array) {
if (predicate.test(object)) {
return true;
}
}
return false;
}
代码示例来源:origin: com.github.bloodshura/shurax
public static <E> boolean all(@Nonnull E[] array, @Nonnull Predicate<? super E> predicate) {
for (E object : array) {
if (!predicate.test(object)) {
return false;
}
}
return true;
}
代码示例来源:origin: com.github.bloodshura/ignitium-core
@Nullable
default E selectFirst(@Nonnull Predicate<E> predicate) {
for (E object : this) {
if (predicate.test(object)) {
return object;
}
}
return null;
}
代码示例来源:origin: com.github.bloodshura/ignitium-core
@Nullable
default E selectLast(@Nonnull Predicate<E> predicate) {
E result = null;
for (E object : this) {
if (predicate.test(object)) {
result = object;
}
}
return result;
}
代码示例来源:origin: com.github.bloodshura/shurax
@Nullable
default E selectFirst(@Nonnull Predicate<E> predicate) {
for (E object : this) {
if (predicate.test(object)) {
return object;
}
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!