Question: this method is giving me a checkstyle error on eclipse saying ''return count is 6 (Max allowed is 3) how would i fix this so

this method is giving me a checkstyle error on eclipse saying ''return count is 6 (Max allowed is 3)" how would i fix this so that the code does the same thing its doing now? please HELP!

@Override public Direction chooseDirection(final Map theNeighbors) { if (theNeighbors.containsKey(getDirection()) && theNeighbors.get(getDirection()) == Terrain.TRAIL) { return getDirection(); } if (theNeighbors.containsValue(Terrain.TRAIL)) { for (Map.Entry entry: theNeighbors.entrySet()) { if (entry.getValue() == Terrain.TRAIL) { return entry.getKey(); } } } if (theNeighbors.get(getDirection()) == Terrain.STREET || theNeighbors.get(getDirection()) == Terrain.LIGHT) { return getDirection(); } if (theNeighbors.get(getDirection().left()) == Terrain.STREET || theNeighbors.get(getDirection()) == Terrain.LIGHT) { return getDirection().left(); } if (theNeighbors.get(getDirection().right()) == Terrain.STREET || theNeighbors.get(getDirection()) == Terrain.LIGHT) { return getDirection().right(); } return getDirection().reverse(); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!