[COLLECTIONS-400] Added missing null check, thanks to Shin Hwei Tan.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1311344 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
68673c6c52
commit
b9b6f31089
|
@ -782,6 +782,9 @@ public class CollectionUtils {
|
|||
* @since Commons Collections 3.2
|
||||
*/
|
||||
public static <T> boolean addIgnoreNull(Collection<T> collection, T object) {
|
||||
if (collection == null) {
|
||||
throw new NullPointerException("The collection must not be null");
|
||||
}
|
||||
return (object != null && collection.add(object));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue