|
|
@@ -17,7 +17,7 @@ final class DiamondPrinter {
|
|
17
|
17
|
List<String> printToList(final char chr) {
|
|
18
|
18
|
final int nRows = 2 * ((int) chr - A_INT) + 1;
|
|
19
|
19
|
|
|
20
|
|
- final List<String> topRows = new ArrayList<>();
|
|
|
20
|
+ final List<String> result = new ArrayList<>();
|
|
21
|
21
|
|
|
22
|
22
|
// Populate the top rows.
|
|
23
|
23
|
for (int nRow = 0; nRow < (nRows + 1) / 2; nRow++) {
|
|
|
@@ -27,15 +27,15 @@ final class DiamondPrinter {
|
|
27
|
27
|
final String rightHalfOfRow = reverse(leftHalfOfRow.substring(0, leftHalfOfRow.length() - 1));
|
|
28
|
28
|
final String fullRow = leftHalfOfRow + rightHalfOfRow;
|
|
29
|
29
|
|
|
30
|
|
- topRows.add(fullRow);
|
|
|
30
|
+ result.add(fullRow);
|
|
31
|
31
|
}
|
|
32
|
32
|
|
|
33
|
33
|
// Populate the bottom rows by 'reflecting' the top rows.
|
|
34
|
34
|
for (int nRow = (nRows - 1) / 2 - 1; nRow >= 0; nRow--) {
|
|
35
|
|
- topRows.add(topRows.get(nRow));
|
|
|
35
|
+ result.add(result.get(nRow));
|
|
36
|
36
|
}
|
|
37
|
37
|
|
|
38
|
|
- return topRows;
|
|
|
38
|
+ return result;
|
|
39
|
39
|
}
|
|
40
|
40
|
|
|
41
|
41
|
}
|