I\'ve always loved trees, that nice O(n*log(n))
and the tidiness of them. However, every software engineer I\'ve ever known has asked me pointedly why I would u
1.HashSet allows null object.
2.TreeSet will not allow null object. If you try to add null value it will throw a NullPointerException.
3.HashSet is much faster than TreeSet.
e.g.
TreeSet ts = new TreeSet();
ts.add(null); // throws NullPointerException
HashSet hs = new HashSet();
hs.add(null); // runs fine