Advertisement
Guest User

Untitled

a guest
Mar 7th, 2013
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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;
  25.             hash += hash * 31 + this.y;
  26.  
  27.             return hash;
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement