use of java.util.function.IntPredicate in project j2objc by google.
the class IntPredicateTest method testOr_null.
public void testOr_null() throws Exception {
IntPredicate alwaysTrue = x -> true;
try {
alwaysTrue.or(null);
fail();
} catch (NullPointerException expected) {
}
}
use of java.util.function.IntPredicate in project j2objc by google.
the class IntPredicateTest method testOr.
public void testOr() throws Exception {
int arg = 5;
AtomicBoolean alwaysTrueInvoked = new AtomicBoolean(false);
AtomicBoolean alwaysTrue2Invoked = new AtomicBoolean(false);
AtomicBoolean alwaysFalseInvoked = new AtomicBoolean(false);
AtomicBoolean alwaysFalse2Invoked = new AtomicBoolean(false);
AtomicBoolean[] invocationState = { alwaysTrueInvoked, alwaysTrue2Invoked, alwaysFalseInvoked, alwaysFalse2Invoked };
IntPredicate alwaysTrue = x -> {
alwaysTrueInvoked.set(true);
assertEquals(x, arg);
return true;
};
IntPredicate alwaysTrue2 = x -> {
alwaysTrue2Invoked.set(true);
assertEquals(x, arg);
return true;
};
IntPredicate alwaysFalse = x -> {
alwaysFalseInvoked.set(true);
assertEquals(x, arg);
return false;
};
IntPredicate alwaysFalse2 = x -> {
alwaysFalse2Invoked.set(true);
assertEquals(x, arg);
return false;
};
// true || true
resetToFalse(invocationState);
assertTrue(alwaysTrue.or(alwaysTrue2).test(arg));
assertTrue(alwaysTrueInvoked.get() && !alwaysTrue2Invoked.get());
// true || false
resetToFalse(invocationState);
assertTrue(alwaysTrue.or(alwaysFalse).test(arg));
assertTrue(alwaysTrueInvoked.get() && !alwaysFalseInvoked.get());
// false || false
resetToFalse(invocationState);
assertFalse(alwaysFalse.or(alwaysFalse2).test(arg));
assertTrue(alwaysFalseInvoked.get() && alwaysFalse2Invoked.get());
// false || true
resetToFalse(invocationState);
assertTrue(alwaysFalse.or(alwaysTrue).test(arg));
assertTrue(alwaysFalseInvoked.get() && alwaysTrueInvoked.get());
}
use of java.util.function.IntPredicate in project torodb by torodb.
the class SmartRetrierTest method setUp.
@Before
public void setUp() {
IntPredicate predicate = i -> i >= MAX_EXECUTIONS;
retrier = new SmartRetrier(predicate, predicate, predicate, predicate, (i, millis) -> 2 * millis);
}
use of java.util.function.IntPredicate in project neo4j by neo4j.
the class MultipleIndexPopulator method indexAllNodes.
public StoreScan<IndexPopulationFailedKernelException> indexAllNodes() {
int[] labelIds = labelIds();
int[] propertyKeyIds = propertyKeyIds();
IntPredicate propertyKeyIdFilter = (propertyKeyId) -> contains(propertyKeyIds, propertyKeyId);
storeScan = storeView.visitNodes(labelIds, propertyKeyIdFilter, new NodePopulationVisitor(), null, false);
storeScan.configure(populations);
return storeScan;
}
use of java.util.function.IntPredicate in project jdk8u_jdk by JetBrains.
the class MatchOpTest method testIntStream.
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntStream(String name, TestData.OfInt data) {
for (IntPredicate p : INT_PREDICATES) {
setContext("p", p);
for (Kind kind : Kind.values()) {
setContext("kind", kind);
exerciseTerminalOps(data, intKinds.get(kind).apply(p));
exerciseTerminalOps(data, s -> s.filter(ipFalse), intKinds.get(kind).apply(p));
exerciseTerminalOps(data, s -> s.filter(ipEven), intKinds.get(kind).apply(p));
}
}
}
Aggregations