Java Crazyness - Contains fails when equals passes
问题 This is the most crazy thing I have seen in java (1.6): Set<ActionPlan> actionPlans = assessment.getActionPlans(); //getActionPlans() returns a java.util.HashSet<ActionPlan> ActionPlan actionPlan = actionPlans.iterator().next(); assertTrue(actionPlan1.equals(actionPlan)); assertEquals(actionPlan1.hashCode(), actionPlan.hashCode()); assertTrue(actionPlans.contains(actionPlan1)); The first two asserts pass but the last one fails. I'm not giving you details on the ActionPlan and Assessment