Skip to content

Instantly share code, notes, and snippets.

@kleberksms
Created March 13, 2019 17:21
Show Gist options
  • Select an option

  • Save kleberksms/79462b7ed4dc327ccd712ef86744531b to your computer and use it in GitHub Desktop.

Select an option

Save kleberksms/79462b7ed4dc327ccd712ef86744531b to your computer and use it in GitHub Desktop.
One level of indentation per method
class Board
{
...
String board()
{
StringBuffer buf = new StringBuffer();
collectRows(buf);
return buf.toString();
}
void collectRows(StringBuffer buf)
{
for (int i = 0; i < 10; i++)
{
collectRow(buf, i);
}
}
void collectRow(StringBuffer buf, int row)
{
for (int i = 0; i < 10; i++)
{
buf.append(data[row][i]);
}
buf.append("\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment