I wrote user type as below
class Item {
int first;
int second;
public boolean equals(Item p) {
if(first == p.first && second == p.second )
return true;
else if(first == p.second && second == p.first)
return true;
else
return false;
}
public int hashcode() {
return Objects.hash(first, second);
}
public void set(Object first, Object second) {
this.first = Integer.parseInt(first.toString());
this.second = Integer.parseInt(second.toString());
}
}
However, It doesn't work at all. Did I design the duplicate test incorrectly?