如何通过HashCode()对HashSet进行排序

时间:2018-02-04 14:42:02

标签: sorting hashcode

HashSet<Employee> hs= new HashSet<Employee>();
    Employee e1 = new Employee("Tatha",20,6000);
    Employee e2 = new Employee("Amar",30,9000);
    Employee e3 = new Employee("Aziz",25,15000);
    Employee e4 = new Employee("Tatha",20,6000);

    hs.add(e1);
    hs.add(e2);
    hs.add(e3);
    hs.add(e4);

如何按EmpID排序?在hashCode()方法

0 个答案:

没有答案