Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Test {
- private int id;
- private int age;
- public Test(int id, int age) {
- this.id = id;
- this.age = age;
- }
- public boolean equals(Object o) {
- Test otherTest = (Test) o;
- return otherTest.id == this.id;
- }
- public String toString() {
- return "айди - " + this.id;
- }
- @Override
- public int hashCode() {
- return this.id * 12345;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement