src/main/java/cursor/rybak/game/MazeSetUp.java
/**
     * retrieve from full path only our concrete location
     * and its neighbors
     *
     * @param fullPath full line
     * @param location certain location
     * @return list of adjacent fields
     */
retrieve from full path only our concrete location
and its neighbors

@param fullPath full line
@param location certain location
@return list of adjacent fields
retrieve from full path only our concrete location and its neighbors @param fullPath full line @param location certain location @return list of adjacent fields
private static List<Location> listOfNeighbors(List<Location> fullPath, Location location) {
        int locationIndex = fullPath.indexOf(location);
        int startIndex = locationIndex == 0 ? locationIndex : locationIndex - 1;
        int lastIndex = locationIndex + 2 > fullPath.size() ? fullPath.size() : locationIndex + 2;
        return fullPath.subList(startIndex, lastIndex);
    }
private static List < Location > listOfNeighbors ( List < Location > fullPath , Location location ) { int locationIndex = fullPath . indexOf ( location ) ; int startIndex = locationIndex == 0 ? locationIndex : locationIndex - 1 ; int lastIndex = locationIndex + 2 > fullPath . size ( ) ? fullPath . size ( ) : locationIndex + 2 ; return fullPath . subList ( startIndex , lastIndex ) ; }
retrieve from full path only our concrete location
 and its neighbors
retrieve from full path only our concrete location and its neighbors