Skip to content

Instantly share code, notes, and snippets.

@mailtoharshit
Created August 28, 2012 01:11
Show Gist options
  • Save mailtoharshit/3494052 to your computer and use it in GitHub Desktop.
Save mailtoharshit/3494052 to your computer and use it in GitHub Desktop.
public class PairNumbers {
Integer x,y;
public PairNumbers(Integer a, Integer b) {
x=a;
y=b;
}
public Boolean equals(Object obj) {
if (obj instanceof PairNumbers) {
PairNumbers p = (PairNumbers)obj;
return ((x==p.x) && (y==p.y));
}
return false;
}
public Integer hashCode() {
return (31 * x) ^ y;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment