List of usage examples for java.util.function Predicate test
boolean test(T t);
From source file:at.gridtec.lambda4j.predicate.bi.obj.ObjBooleanPredicate.java
/** * Creates a {@link ObjBooleanPredicate} which uses the {@code first} parameter of this one as argument for the * given {@link Predicate}.//w ww .ja va 2 s .co 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 ObjBooleanPredicate} 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> ObjBooleanPredicate<T> onlyFirst(@Nonnull final Predicate<? super T> predicate) { Objects.requireNonNull(predicate); return (t, value) -> predicate.test(t); }
From source file:at.gridtec.lambda4j.predicate.bi.obj.ObjBytePredicate.java
/** * Creates a {@link ObjBytePredicate} which uses the {@code first} parameter of this one as argument for the given * {@link Predicate}./* www.j ava 2 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 ObjBytePredicate} 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> ObjBytePredicate<T> onlyFirst(@Nonnull final Predicate<? super T> predicate) { Objects.requireNonNull(predicate); return (t, value) -> predicate.test(t); }
From source file:at.gridtec.lambda4j.predicate.bi.obj.ObjCharPredicate.java
/** * Creates a {@link ObjCharPredicate} which uses the {@code first} parameter of this one as argument for the given * {@link Predicate}./*from w ww .j av 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 ObjCharPredicate} 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> ObjCharPredicate<T> onlyFirst(@Nonnull final Predicate<? super T> predicate) { Objects.requireNonNull(predicate); return (t, value) -> predicate.test(t); }
From source file:at.gridtec.lambda4j.predicate.bi.obj.ObjFloatPredicate.java
/** * Creates a {@link ObjFloatPredicate} which uses the {@code first} parameter of this one as argument for the given * {@link Predicate}.// w w w . j av 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 ObjFloatPredicate} 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> ObjFloatPredicate<T> onlyFirst(@Nonnull final Predicate<? super T> predicate) { Objects.requireNonNull(predicate); return (t, value) -> predicate.test(t); }
From source file:at.gridtec.lambda4j.predicate.bi.obj.ObjIntPredicate.java
/** * Creates a {@link ObjIntPredicate} which uses the {@code first} parameter of this one as argument for the given * {@link Predicate}./*from www . j av a 2 s . 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 ObjIntPredicate} 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> ObjIntPredicate<T> onlyFirst(@Nonnull final Predicate<? super T> predicate) { Objects.requireNonNull(predicate); return (t, value) -> predicate.test(t); }
From source file:at.gridtec.lambda4j.predicate.bi.obj.ObjShortPredicate.java
/** * Creates a {@link ObjShortPredicate} which uses the {@code first} parameter of this one as argument for the given * {@link Predicate}.//from w w w. j a v a 2 s. com * * @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 ObjShortPredicate} 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> ObjShortPredicate<T> onlyFirst(@Nonnull final Predicate<? super T> predicate) { Objects.requireNonNull(predicate); return (t, value) -> predicate.test(t); }
From source file:at.gridtec.lambda4j.predicate.bi.obj.ObjDoublePredicate.java
/** * Creates a {@link ObjDoublePredicate} which uses the {@code first} parameter of this one as argument for the given * {@link Predicate}.//w w w . j ava 2 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 ObjDoublePredicate} 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> ObjDoublePredicate<T> onlyFirst(@Nonnull final Predicate<? super T> predicate) { Objects.requireNonNull(predicate); return (t, value) -> predicate.test(t); }
From source file:at.gridtec.lambda4j.predicate.bi.obj.ObjLongPredicate.java
/** * Creates a {@link ObjLongPredicate} which uses the {@code first} parameter of this one as argument for the given * {@link Predicate}./* w w w . j a v a 2 s . 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 ObjLongPredicate} 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> ObjLongPredicate<T> onlyFirst(@Nonnull final Predicate<? super T> predicate) { Objects.requireNonNull(predicate); return (t, value) -> predicate.test(t); }
From source file:org.springframework.web.reactive.function.server.RequestPredicates.java
/** * Return a {@code RequestPredicate} that matches if the request's path matches the given * predicate.// w w w . java 2 s . com * @param extensionPredicate the predicate to test against the request path extension * @return a predicate that matches if the given predicate matches against the request's path * file extension */ public static RequestPredicate pathExtension(Predicate<String> extensionPredicate) { Assert.notNull(extensionPredicate, "'extensionPredicate' must not be null"); return request -> { String pathExtension = UriUtils.extractFileExtension(request.path()); return extensionPredicate.test(pathExtension); }; }
From source file:com.vmware.admiral.test.integration.BaseIntegrationSupportIT.java
protected static void waitForStateChange(final String documentSelfLink, Predicate<String> predicate) throws Exception { String body = null;//from www . j a v a2 s .com for (int i = 0; i < STATE_CHANGE_WAIT_POLLING_RETRY_COUNT; i++) { Thread.sleep(STATE_CHANGE_WAIT_POLLING_PERIOD_MILLIS); body = sendRequest(HttpMethod.GET, documentSelfLink, null); if (predicate.test(body)) { return; } } throw new RuntimeException(String.format("Failed waiting for state change")); }