SHOW:
|
|
- or go back to the newest paste.
1 | @Override | |
2 | public boolean equals(Object obj){ | |
3 | if (obj == null) | |
4 | return false; | |
5 | if (obj == this) | |
6 | return true; | |
7 | if (obj.getClass() != getClass()) | |
8 | return false; | |
9 | ||
10 | Coord a = (Coord)obj; | |
11 | ||
12 | if(a.x == this.x && a.y == this.y){ | |
13 | return true; | |
14 | } | |
15 | else{ | |
16 | return false; | |
17 | } | |
18 | } | |
19 | ||
20 | @Override | |
21 | public int hashCode() { | |
22 | int hash = 1; | |
23 | ||
24 | - | hash = hash * 17 + this.x; |
24 | + | hash += hash * 17 + this.x; |
25 | - | hash = hash * 31 + this.y; |
25 | + | hash += hash * 31 + this.y; |
26 | ||
27 | - | return hash; |
27 | + | return hash; |
28 | } |