Example usage for java.util.function DoublePredicate test

List of usage examples for java.util.function DoublePredicate test

Introduction

In this page you can find the example usage for java.util.function DoublePredicate test.

Prototype

boolean test(double value);

Source Link

Document

Evaluates this predicate on the given argument.

Usage

From source file:at.gridtec.lambda4j.predicate.tri.obj.ObjBiDoublePredicate.java

/**
 * Creates a {@link ObjBiDoublePredicate} which uses the {@code second} parameter of this one as argument for the
 * given {@link DoublePredicate}.//from  w w  w.  jav  a  2 s .  c om
 *
 * @param <T> The type of the first argument to the predicate
 * @param predicate The predicate which accepts the {@code second} parameter of this one
 * @return Creates a {@code ObjBiDoublePredicate} which uses the {@code second} parameter of this one as argument
 * for the given {@code DoublePredicate}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T> ObjBiDoublePredicate<T> onlySecond(@Nonnull final DoublePredicate predicate) {
    Objects.requireNonNull(predicate);
    return (t, value1, value2) -> predicate.test(value1);
}

From source file:at.gridtec.lambda4j.predicate.tri.obj.ObjBiDoublePredicate.java

/**
 * Creates a {@link ObjBiDoublePredicate} which uses the {@code third} parameter of this one as argument for the
 * given {@link DoublePredicate}./*from  w w  w  .ja va  2s  .  c o  m*/
 *
 * @param <T> The type of the first argument to the predicate
 * @param predicate The predicate which accepts the {@code third} parameter of this one
 * @return Creates a {@code ObjBiDoublePredicate} which uses the {@code third} parameter of this one as argument for
 * the given {@code DoublePredicate}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T> ObjBiDoublePredicate<T> onlyThird(@Nonnull final DoublePredicate predicate) {
    Objects.requireNonNull(predicate);
    return (t, value1, value2) -> predicate.test(value2);
}

From source file:at.gridtec.lambda4j.predicate.tri.obj.BiObjDoublePredicate.java

/**
 * Creates a {@link BiObjDoublePredicate} which uses the {@code third} parameter of this one as argument for the
 * given {@link DoublePredicate}./* w ww .  j  a v  a  2  s  .c  o m*/
 *
 * @param <T> The type of the first argument to the predicate
 * @param <U> The type of the second argument to the predicate
 * @param predicate The predicate which accepts the {@code third} parameter of this one
 * @return Creates a {@code BiObjDoublePredicate} which uses the {@code third} parameter of this one as argument for
 * the given {@code DoublePredicate}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U> BiObjDoublePredicate<T, U> onlyThird(@Nonnull final DoublePredicate predicate) {
    Objects.requireNonNull(predicate);
    return (t, u, value) -> predicate.test(value);
}

From source file:at.gridtec.lambda4j.function.bi.to.ToDoubleBiFunction2.java

/**
 * Returns a composed {@link BiPredicate2} that first applies this function to its input, and then applies the
 * {@code after} predicate to the result. If evaluation of either operation throws an exception, it is relayed to
 * the caller of the composed operation. This method is just convenience, to provide the ability to transform this
 * primitive function to an operation returning {@code boolean}.
 *
 * @param after The predicate to apply after this function is applied
 * @return A composed {@code BiPredicate2} that first applies this function to its input, and then applies the
 * {@code after} predicate to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * boolean}.//from  w  w  w.  j a va 2s . c o  m
 */
@Nonnull
default BiPredicate2<T, U> andThenToBoolean(@Nonnull final DoublePredicate after) {
    Objects.requireNonNull(after);
    return (t, u) -> after.test(applyAsDouble(t, u));
}

From source file:at.gridtec.lambda4j.function.tri.to.ToDoubleTriFunction.java

/**
 * Returns a composed {@link TriPredicate} that first applies this function to its input, and then applies the
 * {@code after} predicate to the result. If evaluation of either operation throws an exception, it is relayed to
 * the caller of the composed operation. This method is just convenience, to provide the ability to transform this
 * primitive function to an operation returning {@code boolean}.
 *
 * @param after The predicate to apply after this function is applied
 * @return A composed {@code TriPredicate} that first applies this function to its input, and then applies the
 * {@code after} predicate to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * boolean}.//from  w  w w . j a v  a  2s  .  c  om
 */
@Nonnull
default TriPredicate<T, U, V> andThenToBoolean(@Nonnull final DoublePredicate after) {
    Objects.requireNonNull(after);
    return (t, u, v) -> after.test(applyAsDouble(t, u, v));
}

From source file:at.gridtec.lambda4j.function.bi.BiBooleanFunction.java

/**
 * Returns a composed {@link BiDoubleFunction} that first applies the {@code before} predicates to its input, and
 * then applies this function to the result. If evaluation of either operation throws an exception, it is relayed to
 * the caller of the composed operation. This method is just convenience, to provide the ability to execute an
 * operation which accepts {@code double} input, before this primitive function is executed.
 *
 * @param before1 The first predicate to apply before this function is applied
 * @param before2 The second predicate to apply before this function is applied
 * @return A composed {@code BiDoubleFunction} that first applies the {@code before} predicates to its input, and
 * then applies this function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to handle primitive values. In this case this is {@code
 * double}./* w w  w  . ja v  a 2s.  c o m*/
 */
@Nonnull
default BiDoubleFunction<R> composeFromDouble(@Nonnull final DoublePredicate before1,
        @Nonnull final DoublePredicate before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.test(value1), before2.test(value2));
}

From source file:at.gridtec.lambda4j.function.bi.obj.ObjBooleanFunction.java

/**
 * Returns a composed {@link BiDoubleFunction} that first applies the {@code before} functions to its input, and
 * then applies this function to the result. If evaluation of either operation throws an exception, it is relayed to
 * the caller of the composed operation. This method is just convenience, to provide the ability to execute an
 * operation which accepts {@code double} input, before this primitive function is executed.
 *
 * @param before1 The first function to apply before this function is applied
 * @param before2 The second predicate to apply before this function is applied
 * @return A composed {@code BiDoubleFunction} that first applies the {@code before} functions to its input, and
 * then applies this function to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to handle primitive values. In this case this is {@code
 * double}.//w w w  . java 2s  .  c  o m
 */
@Nonnull
default BiDoubleFunction<R> composeFromDouble(@Nonnull final DoubleFunction<? extends T> before1,
        @Nonnull final DoublePredicate before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.apply(value1), before2.test(value2));
}

From source file:at.gridtec.lambda4j.function.bi.conversion.BiBooleanToDoubleFunction.java

/**
 * Returns a composed {@link BooleanBinaryOperator} that first applies this function to its input, and then applies
 * the {@code after} predicate to the result. If evaluation of either operation throws an exception, it is relayed
 * to the caller of the composed operation. This method is just convenience, to provide the ability to transform
 * this primitive function to an operation returning {@code boolean}.
 *
 * @param after The predicate to apply after this function is applied
 * @return A composed {@code BooleanBinaryOperator} that first applies this function to its input, and then applies
 * the {@code after} predicate to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * boolean}.//from  www  . j a  v a2 s  .  c o  m
 */
@Nonnull
default BooleanBinaryOperator andThenToBoolean(@Nonnull final DoublePredicate after) {
    Objects.requireNonNull(after);
    return (value1, value2) -> after.test(applyAsDouble(value1, value2));
}

From source file:at.gridtec.lambda4j.function.bi.conversion.BiByteToDoubleFunction.java

/**
 * Returns a composed {@link BiBytePredicate} that first applies this function to its input, and then applies the
 * {@code after} predicate to the result. If evaluation of either operation throws an exception, it is relayed to
 * the caller of the composed operation. This method is just convenience, to provide the ability to transform this
 * primitive function to an operation returning {@code boolean}.
 *
 * @param after The predicate to apply after this function is applied
 * @return A composed {@code BiBytePredicate} that first applies this function to its input, and then applies the
 * {@code after} predicate to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * boolean}.//w w  w .j a va  2  s.  c  o m
 */
@Nonnull
default BiBytePredicate andThenToBoolean(@Nonnull final DoublePredicate after) {
    Objects.requireNonNull(after);
    return (value1, value2) -> after.test(applyAsDouble(value1, value2));
}

From source file:at.gridtec.lambda4j.function.bi.conversion.BiCharToDoubleFunction.java

/**
 * Returns a composed {@link BiCharPredicate} that first applies this function to its input, and then applies the
 * {@code after} predicate to the result. If evaluation of either operation throws an exception, it is relayed to
 * the caller of the composed operation. This method is just convenience, to provide the ability to transform this
 * primitive function to an operation returning {@code boolean}.
 *
 * @param after The predicate to apply after this function is applied
 * @return A composed {@code BiCharPredicate} that first applies this function to its input, and then applies the
 * {@code after} predicate to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * boolean}.//  w  w  w .j a  v a2 s.  c  o  m
 */
@Nonnull
default BiCharPredicate andThenToBoolean(@Nonnull final DoublePredicate after) {
    Objects.requireNonNull(after);
    return (value1, value2) -> after.test(applyAsDouble(value1, value2));
}