Under what condition does the `Collections.addAll()` method throw a `NullPointerException`? The official docs mention:

> 
> NullPointerException - if the specified collection contains a null element and this collection does not permit null elements, or if the specified collection is null
> 
> 
> 

How do I make sure that this **"Collection does not permit null elements"**

```
public class CollectionImpl {

public void checkList(){

    List<String> var1 = new ArrayList<String>();
     var1.add("One");
     var1.add("Two");
     var1.add("Three");

     System.out.println("var1 : " + var1);

     try{
         if(Collections.addAll(var1,"Four" , "Five" , null , "1")){
            System.out.println("True"); 
         }
     }
     catch(NullPointerException e){
         System.out.println("Caught Null Pointer Exception" + e);
     }
     catch(IllegalArgumentException e){
         System.out.println("Caught IllegalArgument Exception" + e);
     }
     finally{
         System.out.println("var1 : " + var1);
     }
}

```

**OUTPUT**

```
var1 : [1, 2, null]
True
var1 : [1, 2, null, 4, 5, null, 6]

```