src/share/classes/java/util/function/DoublePredicate.java
Print this page
rev 7047 : 8004015: Additional static and instance utils for functional interfaces.
Reviewed-by: briangoetz
*** 38,101 ****
public interface DoublePredicate {
/**
* Returns {@code true} if the input value matches some criteria.
*
! * @param value the value to be tested.
* @return {@code true} if the input value matches some criteria, otherwise
! * {@code false}.
*/
! public boolean test(double value);
/**
* Returns a predicate which evaluates to {@code true} only if this
* predicate and the provided predicate both evaluate to {@code true}. If
* this predicate returns {@code false} then the remaining predicate is not
* evaluated.
*
! * @param p a predicate which will be logically-ANDed with this predicate.
* @return a new predicate which returns {@code true} only if both
! * predicates return {@code true}.
*/
! public default DoublePredicate and(DoublePredicate p) {
Objects.requireNonNull(p);
return (value) -> test(value) && p.test(value);
}
/**
* Returns a predicate which negates the result of this predicate.
*
* @return a new predicate who's result is always the opposite of this
! * predicate.
*/
! public default DoublePredicate negate() {
return (value) -> !test(value);
}
/**
* Returns a predicate which evaluates to {@code true} if either this
* predicate or the provided predicate evaluates to {@code true}. If this
* predicate returns {@code true} then the remaining predicate is not
* evaluated.
*
! * @param p a predicate which will be logically-ANDed with this predicate.
* @return a new predicate which returns {@code true} if either predicate
! * returns {@code true}.
*/
! public default DoublePredicate or(DoublePredicate p) {
Objects.requireNonNull(p);
return (value) -> test(value) || p.test(value);
}
-
- /**
- * Returns a predicate that evaluates to {@code true} if both or neither of
- * the component predicates evaluate to {@code true}.
- *
- * @param p a predicate which will be logically-XORed with this predicate.
- * @return a predicate that evaluates to {@code true} if all or none of the
- * component predicates evaluate to {@code true}.
- */
- public default DoublePredicate xor(DoublePredicate p) {
- Objects.requireNonNull(p);
- return (value) -> test(value) ^ p.test(value);
- }
}
--- 38,90 ----
public interface DoublePredicate {
/**
* Returns {@code true} if the input value matches some criteria.
*
! * @param value the value to be tested
* @return {@code true} if the input value matches some criteria, otherwise
! * {@code false}
*/
! boolean test(double value);
/**
* Returns a predicate which evaluates to {@code true} only if this
* predicate and the provided predicate both evaluate to {@code true}. If
* this predicate returns {@code false} then the remaining predicate is not
* evaluated.
*
! * @param p a predicate which will be logically-ANDed with this predicate
* @return a new predicate which returns {@code true} only if both
! * predicates return {@code true}
! * @throws NullPointerException if p is null
*/
! default DoublePredicate and(DoublePredicate p) {
Objects.requireNonNull(p);
return (value) -> test(value) && p.test(value);
}
/**
* Returns a predicate which negates the result of this predicate.
*
* @return a new predicate who's result is always the opposite of this
! * predicate
*/
! default DoublePredicate negate() {
return (value) -> !test(value);
}
/**
* Returns a predicate which evaluates to {@code true} if either this
* predicate or the provided predicate evaluates to {@code true}. If this
* predicate returns {@code true} then the remaining predicate is not
* evaluated.
*
! * @param p a predicate which will be logically-ANDed with this predicate
* @return a new predicate which returns {@code true} if either predicate
! * returns {@code true}
! * @throws NullPointerException if p is null
*/
! default DoublePredicate or(DoublePredicate p) {
Objects.requireNonNull(p);
return (value) -> test(value) || p.test(value);
}
}