Error:TreeMap的containsValue(),始终返回false


代码很简单,写一个Student学生对象,用treeMap存储

treeMap中key是学号,value是student对象

问题:用treeMap.containsValue()测试,始终返回false

答案:student对象没重写equals()和hashcode()方法。

无语。。。