priyaaank / MarsRover

Mars Rover problem solution to demonstrate OO concepts in action
Other
98 stars 55 forks source link

StringBuffer used in Coordinates class's toString method() #1

Closed shweta-code closed 8 years ago

shweta-code commented 8 years ago

As I see the problem , there is no requirement of Multi-Threaded environment and also there is no such code written for it. Therefore StringBuilder should be used as it has high slightly high performance.

priyaaank commented 8 years ago

Which particular section of the code do you think will benefit from an StringBuilder implementation? Can you please point me to that?

shweta-code commented 8 years ago

I think StringBuilder should be used.

priyaaank commented 8 years ago

Exactly where in the code should StringBuilder be used?

shweta-code commented 8 years ago

This is the piece of code:

@Override public String toString() { StringBuffer coordinateOutput = new StringBuffer(); coordinateOutput.append(xCoordinate); coordinateOutput.append(" "); coordinateOutput.append(yCoordinate); return coordinateOutput.toString(); }

priyaaank commented 8 years ago

Thanks. That is a reasonable suggestion. I'll make the change. Alternatively feel free to submit a pull request.

shweta-code commented 8 years ago

Priyank , I am not able to push. Permission denied.

marsroverdeniedpermission

priyaaank commented 8 years ago

Yes, you won't be able to push. However you can fork the repo and commit on your version of repo and submit a pull request. More info here

shweta-code commented 8 years ago

I have created a pull request. https://github.com/priyaaank/MarsRover/pull/2 You can go ahead with merge.

priyaaank commented 8 years ago

Thank you!