/** * Returns a new predicate that negates the result of this predicate. * * @return the predicate, "NOT this" */ public default ObjDoublePredicate<T> negate() { return (obj, value) -> !test(obj, value); }
/** * Returns a new predicate that negates the result of this predicate. * * @return the predicate, "NOT this" */ public default ObjIntPredicate<T> negate() { return (obj, value) -> !test(obj, value); }
/** * Returns a new predicate that negates the result of this predicate. * * @return the predicate, "NOT this" */ public default ObjLongPredicate<T> negate() { return (obj, value) -> !test(obj, value); }
public void test_negate() { ObjDoublePredicate<String> fn1 = (a, b) -> b > 3; ObjDoublePredicate<String> negate = fn1.negate(); assertEquals(fn1.test("a", 2.3d), false); assertEquals(fn1.test("a", 3.2d), true); assertEquals(negate.test("a", 2.3d), true); assertEquals(negate.test("a", 3.2d), false); }
/** * Applies an action to each value in the array. * <p> * This is used to perform an action on the contents of this array. * The action receives both the index and the value. * For example, the action could print out the array. * <pre> * base.forEach((index, value) -> System.out.println(index + ": " + value)); * </pre> * <p> * This instance is immutable and unaffected by this method. * * @param action the action to be applied */ public void forEach(IntIntConsumer action) { for (int i = 0; i < array.length; i++) { action.accept(i, array[i]); } }
/** * Applies an action to each value in the array. * <p> * This is used to perform an action on the contents of this array. * The action receives both the index and the value. * For example, the action could print out the array. * <pre> * base.forEach((index, value) -> System.out.println(index + ": " + value)); * </pre> * <p> * This instance is immutable and unaffected by this method. * * @param action the action to be applied */ public void forEach(IntDoubleConsumer action) { for (int i = 0; i < array.length; i++) { action.accept(i, array[i]); } }
@Test(expectedExceptions = NullPointerException.class) public void test_or_null() { ObjLongPredicate<String> fn1 = (a, b) -> b > 3; fn1.or(null); }
@Test(expectedExceptions = NullPointerException.class) public void test_and_null() { ObjLongPredicate<String> fn1 = (a, b) -> b > 3; fn1.and(null); }
@Test(expectedExceptions = NullPointerException.class) public void test_and_null() { ObjDoublePredicate<String> fn1 = (a, b) -> b > 3; fn1.and(null); }
@Test(expectedExceptions = NullPointerException.class) public void test_andThen_null() { ObjLongFunction<Integer, String> fn1 = (a, b) -> a + "=" + b; fn1.andThen(null); }
@Test(expectedExceptions = NullPointerException.class) public void test_andThen_null() { ObjIntFunction<Integer, String> fn1 = (a, b) -> a + "=" + b; fn1.andThen(null); }
@Test(expectedExceptions = NullPointerException.class) public void test_or_null() { ObjIntPredicate<String> fn1 = (a, b) -> b > 3; fn1.or(null); }
@Test(expectedExceptions = NullPointerException.class) public void test_andThen_null() { ObjDoubleFunction<Integer, String> fn1 = (a, b) -> a + "=" + b; fn1.andThen(null); }
@Test(expectedExceptions = NullPointerException.class) public void test_and_null() { ObjIntPredicate<String> fn1 = (a, b) -> b > 3; fn1.and(null); }
@Test(expectedExceptions = NullPointerException.class) public void test_or_null() { ObjDoublePredicate<String> fn1 = (a, b) -> b > 3; fn1.or(null); }