8204172: Predicate::not should explicitly mention "NullPointerException - if target is null"
Reviewed-by: sundar, psandoz, dfuchs
This commit is contained in:
parent
5bf8a6f44b
commit
02db4b67cc
@ -119,6 +119,8 @@ public interface Predicate<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a predicate that is the negation of the supplied predicate.
|
* Returns a predicate that is the negation of the supplied predicate.
|
||||||
|
* This is accomplished by returning result of the calling
|
||||||
|
* {@code target.negate()}.
|
||||||
*
|
*
|
||||||
* @param <T> the type of arguments to the specified predicate
|
* @param <T> the type of arguments to the specified predicate
|
||||||
* @param target predicate to negate
|
* @param target predicate to negate
|
||||||
@ -126,10 +128,13 @@ public interface Predicate<T> {
|
|||||||
* @return a predicate that negates the results of the supplied
|
* @return a predicate that negates the results of the supplied
|
||||||
* predicate
|
* predicate
|
||||||
*
|
*
|
||||||
|
* @throws NullPointerException if target is null
|
||||||
|
*
|
||||||
* @since 11
|
* @since 11
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
static <T> Predicate<T> not(Predicate<? super T> target) {
|
static <T> Predicate<T> not(Predicate<? super T> target) {
|
||||||
|
Objects.requireNonNull(target);
|
||||||
return (Predicate<T>)target.negate();
|
return (Predicate<T>)target.negate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user