public Set < Point > diff ( Maze2D to ) { char [ ] [ ] maze1 = this . getMazeCharArray ( ) ; char [ ] [ ] maze2 = to . getMazeCharArray ( ) ; Set < Point > differentLocations = new HashSet < Point > ( ) ; for ( int row = 0 ; row < this . rows ; row ++ ) { for ( int column = 0 ; column < this . columns ; column ++ ) { if ( maze1 [ row ] [ column ] != maze2 [ row ] [ column ] ) { differentLocations . add ( new Point ( column , row ) ) ; } } } return differentLocations ; }
Returns a set of points that are different with respect this maze . Both mazes must have same size .