Beancomparator not working with null values
<p>My requirements is to sort list of Customer type beans according to <code>customername</code> property in that bean... for that i used <code>beancomparator</code>.it is working fine when <code>customername</code> field is not <code>null</code>.
It is throwing <code>NullPointerException</code> when the field is <code>null</code>..please help me out..</p>

<p>my code is</p>

<pre><code>public class customer{
private String customername;
}

main()
{
list&lt;customer&gt; list=new arraylist();
//list is filled with customertype beans
comparator&lt;customer&gt; comp=new beancomparator(customername);
collections.sort(list,comp);//throwing error when customername is null...
}
</code></pre>
