在hashSet中,如果我们比较的是对象,要对equals方法进行重写,以Student为例,写在Student类中,this,和stu分别代表什么,哪一个指的是后传入的对象,怎么理解更加容易 
 
------------------------------------------------------------------ 
public int compareTo(Student stu) { 
                int num = this.name.length() - stu.name.length(); 
                int num2 = num == 0 ? this.name.compareTo(stu.name) : num; 
                return num2 == 0 ? (this.age - stu.age) : num2; 
        } 
 
------------------------------------------------------------------- 
 |   
        
 
    
    
    
     
 
 |