1、HashSet的contains返回true,當且僅當equals返回true并且hashCode返回相等的值?;
2、list.contains(o),系統會對list中的每個元素e調用o.equals(e),方法,加入list中有n個元素,那么會調用n次o.equals(e),只要有一次o.equals(e)返回了true,那么list.contains(o)返回true,否則返回false。
1、HashSet的contains返回true,當且僅當equals返回true并且hashCode返回相等的值?;
2、list.contains(o),系統會對list中的每個元素e調用o.equals(e),方法,加入list中有n個元素,那么會調用n次o.equals(e),只要有一次o.equals(e)返回了true,那么list.contains(o)返回true,否則返回false。