Просмотр исходного кода

diamond: fix var name in example

Stuart Kent 9 лет назад
Родитель
Сommit
d7d221b38d
1 измененных файлов: 4 добавлений и 4 удалений
  1. 4
    4
      exercises/diamond/src/example/java/DiamondPrinter.java

+ 4
- 4
exercises/diamond/src/example/java/DiamondPrinter.java Просмотреть файл

17
     List<String> printToList(final char chr) {
17
     List<String> printToList(final char chr) {
18
         final int nRows = 2 * ((int) chr - A_INT) + 1;
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
         // Populate the top rows.
22
         // Populate the top rows.
23
         for (int nRow = 0; nRow < (nRows + 1) / 2; nRow++) {
23
         for (int nRow = 0; nRow < (nRows + 1) / 2; nRow++) {
27
             final String rightHalfOfRow = reverse(leftHalfOfRow.substring(0, leftHalfOfRow.length() - 1));
27
             final String rightHalfOfRow = reverse(leftHalfOfRow.substring(0, leftHalfOfRow.length() - 1));
28
             final String fullRow        = leftHalfOfRow + rightHalfOfRow;
28
             final String fullRow        = leftHalfOfRow + rightHalfOfRow;
29
 
29
 
30
-            topRows.add(fullRow);
30
+            result.add(fullRow);
31
         }
31
         }
32
 
32
 
33
         // Populate the bottom rows by 'reflecting' the top rows.
33
         // Populate the bottom rows by 'reflecting' the top rows.
34
         for (int nRow = (nRows - 1) / 2 - 1; nRow >= 0; nRow--) {
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
 }