Monday 9 July 2012

Set remove(null) method throws an error

"System.NullPointerException: Argument 1 cannot be null" will be received :-- You can also Test by below example

Set <Integer> testSet = new Set <Integer>(); 
testSet.add(1); 
testSet.add(2);
testSet.add(null);  
testSet.add(3); 

testSet.remove(3);
testSet.remove(null);



Error is: "System.NullPointerException: Argument 1 cannot be null It is thrown by the line: testSet.remove(null)"

No comments:

Post a Comment