class Pair{
int first;
int second;
Pair(int first,int second){
this.first=first;
this.second=second;
}
public boolean equals(Object o) {
if (o instanceof Pair) {
Pair p = (Pair)o;
return p.first == first && p.second == second;
}
return false;
}
public int hashCode() {
return new Integer(first).hashCode() * 31 + new Integer(second).hashCode();
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter