This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
You must implement (override) hashCode() method in PersonClass. HashSet uses hashcodes to store/search objects. hashCode must return the same value for identical objects. In your Person class hashCode() from Object is used, which by default returns different values for each individual object, and therefore HashSet treats both "jane" persons as different. Try simple hashCode below , it should work:
[ August 26, 2008: Message edited by: Ireneusz Kordal ]