Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Mar 7th, 2013  |  syntax: Java  |  size: 0.52 KB  |  views: 31  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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.         }