Checking the neighbor of the current cell This is just checking the parameter you enter is a neighbour of the current Cell (which is obtained using getRow() and getColumn()). 

Is there an easier way of doing this? How could I make this more compact and efficient?

public boolean isNeighbourOf(Cell c){

 boolean check = false;

 //check for not neighbours
 if(c.getRow() == getRow() &amp;&amp; c.getColumn() == getColumn()){
     check = false;
 }

 else if(c.getRow() == getRow() - 1 &amp;&amp; c.getColumn() == getColumn() - 1){
     check = false;
 }

 else if(c.getRow() == getRow() + 1 &amp;&amp; c.getColumn() == getColumn() - 1){
     check = false;
 }

 else  if(c.getRow() == getRow() - 1 &amp;&amp; c.getColumn() == getColumn() + 1){
     check = false;
 }

 else if(c.getRow() == getRow() + 1 &amp;&amp; c.getColumn() == getColumn() + 1){
     check = false;
 }

 //check for neighbours
  else if(c.getRow() == getRow() - 1 &amp;&amp; c.getColumn() == getColumn()){
     check = true;
 }
  else if(c.getRow() == getRow() + 1 &amp;&amp; c.getColumn() == getColumn()){
         check = true;
  }
  else if(c.getRow() == getRow() &amp;&amp; c.getColumn() == getColumn() + 1){
         check = true;
  }
  else if(c.getRow() == getRow() &amp;&amp; c.getColumn() == getColumn() - 1){
         check = true;
  }
  return check;
}
return Math.abs(c.getRow   () - getRow   ()) +
       Math.abs(c.getColumn() - getColumn()) == 1;


You want to be in the same row and one column apart, or in the same column and one row apart. Computing the absolute value of the difference in row and column numbers tells you how far apart the cells are irrespective of orientation. For horizontal and vertical neighbors these must add up to 1; that is, one of them must be 1 and the other must be 0.