How to remove duplicate and null from the list.

Hi All,

I have a list which contains duplicates and null value. How to remove null and duplicates to get unique list without null? I tried but I am getting NullPointerError

List l = new ArrayList();
l.add(1);
l.add(2);
l.add(2);
l.add(6);
l.add(null);
l.add(null);

	Set<Integer> s = null;
	if(l != null){
	 s = new TreeSet<Integer>(l);
	}
	
	for(Integer ii: s){
		System.out.println(ii);
	}

Appreciate Your help!

Regards,
Meharaj