Example usage for java.util.function Predicate test

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

Introduction

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

Prototype

boolean test(T t);

Source Link

Document

Evaluates this predicate on the given argument.

Usage

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

/**
 * Creates a {@link ObjBiLongPredicate} which uses the {@code first} parameter of this one as argument for the given
 * {@link Predicate}.// ww  w  . ja va2s  . c om
 *
 * @param <T> The type of the first argument to the predicate
 * @param predicate The predicate which accepts the {@code first} parameter of this one
 * @return Creates a {@code ObjBiLongPredicate} which uses the {@code first} parameter of this one as argument for
 * the given {@code Predicate}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T> ObjBiLongPredicate<T> onlyFirst(@Nonnull final Predicate<? super T> predicate) {
    Objects.requireNonNull(predicate);
    return (t, value1, value2) -> predicate.test(t);
}

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

/**
 * Creates a {@link ObjBiShortPredicate} which uses the {@code first} parameter of this one as argument for the
 * given {@link Predicate}./*from w w  w.  j a v a2  s .c o m*/
 *
 * @param <T> The type of the first argument to the predicate
 * @param predicate The predicate which accepts the {@code first} parameter of this one
 * @return Creates a {@code ObjBiShortPredicate} which uses the {@code first} parameter of this one as argument for
 * the given {@code Predicate}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T> ObjBiShortPredicate<T> onlyFirst(@Nonnull final Predicate<? super T> predicate) {
    Objects.requireNonNull(predicate);
    return (t, value1, value2) -> predicate.test(t);
}

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

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

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

/**
 * Creates a {@link BiObjBooleanPredicate} which uses the {@code first} parameter of this one as argument for the
 * given {@link Predicate}./*w ww .  j ava2 s  .  co  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 first} parameter of this one
 * @return Creates a {@code BiObjBooleanPredicate} which uses the {@code first} parameter of this one as argument
 * for the given {@code Predicate}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U> BiObjBooleanPredicate<T, U> onlyFirst(@Nonnull final Predicate<? super T> predicate) {
    Objects.requireNonNull(predicate);
    return (t, u, value) -> predicate.test(t);
}

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

/**
 * Creates a {@link BiObjBooleanPredicate} which uses the {@code second} parameter of this one as argument for the
 * given {@link Predicate}.// w  w w. j  a  v  a2 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 second} parameter of this one
 * @return Creates a {@code BiObjBooleanPredicate} which uses the {@code second} parameter of this one as argument
 * for the given {@code Predicate}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U> BiObjBooleanPredicate<T, U> onlySecond(@Nonnull final Predicate<? super U> predicate) {
    Objects.requireNonNull(predicate);
    return (t, u, value) -> predicate.test(u);
}

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

/**
 * Creates a {@link BiObjBytePredicate} which uses the {@code first} parameter of this one as argument for the given
 * {@link Predicate}./*w w w. ja v  a2s .  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 first} parameter of this one
 * @return Creates a {@code BiObjBytePredicate} which uses the {@code first} parameter of this one as argument for
 * the given {@code Predicate}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U> BiObjBytePredicate<T, U> onlyFirst(@Nonnull final Predicate<? super T> predicate) {
    Objects.requireNonNull(predicate);
    return (t, u, value) -> predicate.test(t);
}

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

/**
 * Creates a {@link BiObjBytePredicate} which uses the {@code second} parameter of this one as argument for the
 * given {@link Predicate}.//  w ww .  j  a  v  a2s  .com
 *
 * @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 second} parameter of this one
 * @return Creates a {@code BiObjBytePredicate} which uses the {@code second} parameter of this one as argument for
 * the given {@code Predicate}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U> BiObjBytePredicate<T, U> onlySecond(@Nonnull final Predicate<? super U> predicate) {
    Objects.requireNonNull(predicate);
    return (t, u, value) -> predicate.test(u);
}

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

/**
 * Creates a {@link BiObjCharPredicate} which uses the {@code first} parameter of this one as argument for the given
 * {@link Predicate}./*w ww  . j a  va 2s . co 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 first} parameter of this one
 * @return Creates a {@code BiObjCharPredicate} which uses the {@code first} parameter of this one as argument for
 * the given {@code Predicate}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U> BiObjCharPredicate<T, U> onlyFirst(@Nonnull final Predicate<? super T> predicate) {
    Objects.requireNonNull(predicate);
    return (t, u, value) -> predicate.test(t);
}

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

/**
 * Creates a {@link BiObjCharPredicate} which uses the {@code second} parameter of this one as argument for the
 * given {@link Predicate}.//from   w ww. j ava2 s.  co 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 second} parameter of this one
 * @return Creates a {@code BiObjCharPredicate} which uses the {@code second} parameter of this one as argument for
 * the given {@code Predicate}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U> BiObjCharPredicate<T, U> onlySecond(@Nonnull final Predicate<? super U> predicate) {
    Objects.requireNonNull(predicate);
    return (t, u, value) -> predicate.test(u);
}

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

/**
 * Creates a {@link BiObjFloatPredicate} which uses the {@code first} parameter of this one as argument for the
 * given {@link Predicate}./*  w  w w  .  j  av  a  2 s . c om*/
 *
 * @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 first} parameter of this one
 * @return Creates a {@code BiObjFloatPredicate} which uses the {@code first} parameter of this one as argument for
 * the given {@code Predicate}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U> BiObjFloatPredicate<T, U> onlyFirst(@Nonnull final Predicate<? super T> predicate) {
    Objects.requireNonNull(predicate);
    return (t, u, value) -> predicate.test(t);
}