/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main
(String[] args
) { List<Employee> list = new ArrayList<>();
list.add(new Employee(123, "zMadhu", "1000$", 1));
list.add(new Employee(332, "bSudhan", "2000$", 2));
list.add(new Employee(54, "cKongarass", "3000$", 3));
list.add(new Employee(54, "xKongarass", "3000$", 4));
list.add(new Employee(54, "aKongarass", "3000$", 5));
Set<Employee> em = new HashSet<>(list);
}
}
class Employee {
private int id;
private int key;
public Employee
(int id,
String name,
String salary,
int key
) { super();
this.id = id;
this.name = name;
this.salary = salary;
this.key = key;
}
@Override
public boolean equals
(Object o
) { if (this == o) return true;
if (!(o instanceof Employee)) return false;
Employee employee = (Employee) o;
return id == employee.id;
}
@Override
public int hashCode() {
return id;
}
@Override
return id + "";
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLnV0aWwuQXJyYXlMaXN0OwppbXBvcnQgamF2YS51dGlsLkhhc2hTZXQ7CmltcG9ydCBqYXZhLnV0aWwuTGlzdDsKaW1wb3J0IGphdmEudXRpbC5TZXQ7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpIHsKICAgICAgICBMaXN0PEVtcGxveWVlPiBsaXN0ID0gbmV3IEFycmF5TGlzdDw+KCk7CiAgICAgICAgbGlzdC5hZGQobmV3IEVtcGxveWVlKDEyMywgInpNYWR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AgICBFbXBsb3llZSBlbXBsb3llZSA9IChFbXBsb3llZSkgbzsKCiAgICAgICAgcmV0dXJuIGlkID09IGVtcGxveWVlLmlkOwogICAgfQoKICAgIEBPdmVycmlkZQogICAgcHVibGljIGludCBoYXNoQ29kZSgpIHsKICAgICAgICByZXR1cm4gaWQ7CiAgICB9CgogICAgQE92ZXJyaWRlCiAgICBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgewogICAgICAgIHJldHVybiBpZCArICIiOwogICAgfQp9