I've been looking through the implementations of the Set interface available in JDK 5 and can't find any that prohibits null values. Does such an implementation exist?
It says in the Set interface API documentation that a Set contains at most one null. It says some implementations prohibit nulls, but not which. Suggest, maybe, you write a wrapper class around a HashSet and for all the add methods throw an Exception (probably NullPointerException) if the element is null.
Thanks for the suggestions. I should have mentioned that I'm looking for a generified Set that prohibits nulls, so given that extra requirement, the Apache commons implementation is unsuitable.