本文整理匯總了Java中java.util.function.DoublePredicate.test方法的典型用法代碼示例。如果您正苦於以下問題:Java DoublePredicate.test方法的具體用法?Java DoublePredicate.test怎麽用?Java DoublePredicate.test使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.function.DoublePredicate
的用法示例。
在下文中一共展示了DoublePredicate.test方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: filter
import java.util.function.DoublePredicate; //導入方法依賴的package包/類
@Override
public final DoubleStream filter(DoublePredicate predicate) {
Objects.requireNonNull(predicate);
return new StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
StreamOpFlag.NOT_SIZED) {
@Override
Sink<Double> opWrapSink(int flags, Sink<Double> sink) {
return new Sink.ChainedDouble<Double>(sink) {
@Override
public void begin(long size) {
downstream.begin(-1);
}
@Override
public void accept(double t) {
if (predicate.test(t))
downstream.accept(t);
}
};
}
};
}
示例2: makeDouble
import java.util.function.DoublePredicate; //導入方法依賴的package包/類
/**
* Constructs a quantified predicate matcher for a {@code DoubleStream}.
*
* @param predicate the {@code Predicate} to apply to stream elements
* @param matchKind the kind of quantified match (all, any, none)
* @return a {@code TerminalOp} implementing the desired quantified match
* criteria
*/
public static TerminalOp<Double, Boolean> makeDouble(DoublePredicate predicate,
MatchKind matchKind) {
Objects.requireNonNull(predicate);
Objects.requireNonNull(matchKind);
class MatchSink extends BooleanTerminalSink<Double> implements Sink.OfDouble {
MatchSink() {
super(matchKind);
}
@Override
public void accept(double t) {
if (!stop && predicate.test(t) == matchKind.stopOnPredicateMatches) {
stop = true;
value = matchKind.shortCircuitResult;
}
}
}
return new MatchOp<>(StreamShape.DOUBLE_VALUE, matchKind, MatchSink::new);
}
示例3: allMatch
import java.util.function.DoublePredicate; //導入方法依賴的package包/類
/**
* Test whether all elements of a double[] array satisfy a double -> boolean predicate
*/
public static boolean allMatch(final double[] array, final DoublePredicate pred) {
JointCallingUtils.nonNull(array, "array may not be null");
JointCallingUtils.nonNull(pred, "predicate may not be null");
for (final double x : array) {
if (!pred.test(x)) {
return false;
}
}
return true;
}
示例4: allMatch
import java.util.function.DoublePredicate; //導入方法依賴的package包/類
@Override
default boolean allMatch(@NonNull final DoublePredicate predicate) {
return predicate.test(this.x()) && predicate.test(this.y()) && predicate.test(this.z()) && predicate.test(this.w());
}
示例5: anyMatch
import java.util.function.DoublePredicate; //導入方法依賴的package包/類
@Override
default boolean anyMatch(@NonNull final DoublePredicate predicate) {
return predicate.test(this.x()) || predicate.test(this.y()) || predicate.test(this.z()) || predicate.test(this.w());
}
示例6: allMatch
import java.util.function.DoublePredicate; //導入方法依賴的package包/類
@Override
default boolean allMatch(@NonNull final DoublePredicate predicate) {
return predicate.test(this.x()) && predicate.test(this.y()) && predicate.test(this.z());
}
示例7: anyMatch
import java.util.function.DoublePredicate; //導入方法依賴的package包/類
@Override
default boolean anyMatch(@NonNull final DoublePredicate predicate) {
return predicate.test(this.x()) || predicate.test(this.y()) || predicate.test(this.z());
}
示例8: allMatch
import java.util.function.DoublePredicate; //導入方法依賴的package包/類
@Override
default boolean allMatch(@NonNull final DoublePredicate predicate) {
return predicate.test(this.x()) && predicate.test(this.y());
}
示例9: anyMatch
import java.util.function.DoublePredicate; //導入方法依賴的package包/類
@Override
default boolean anyMatch(@NonNull final DoublePredicate predicate) {
return predicate.test(this.x()) || predicate.test(this.y());
}
示例10: every
import java.util.function.DoublePredicate; //導入方法依賴的package包/類
@Override
public boolean every(DoublePredicate f) {
return f.test(x) && f.test(y) && f.test(z) && f.test(w);
}
示例11: any
import java.util.function.DoublePredicate; //導入方法依賴的package包/類
@Override
public boolean any(DoublePredicate f) {
return f.test(x) || f.test(y) || f.test(z) || f.test(w);
}
示例12: every
import java.util.function.DoublePredicate; //導入方法依賴的package包/類
@Override
public boolean every(DoublePredicate f) {
return f.test(x) && f.test(y);
}
示例13: any
import java.util.function.DoublePredicate; //導入方法依賴的package包/類
@Override
public boolean any(DoublePredicate f) {
return f.test(x) || f.test(y);
}
示例14: every
import java.util.function.DoublePredicate; //導入方法依賴的package包/類
@Override
public boolean every(DoublePredicate f) {
return f.test(x);
}
示例15: any
import java.util.function.DoublePredicate; //導入方法依賴的package包/類
@Override
public boolean any(DoublePredicate f) {
return f.test(x);
}