mirror of
https://github.com/apache/commons-collections.git
synced 2025-02-17 23:44:48 +00:00
[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…
x
Reference in New Issue
Block a user