Skip to content

Commit 14f906d

Browse files
committed
chore:adds more comments for clarity
1 parent e6bc03e commit 14f906d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/generator/JsonFileGenerator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void printGeneratedColoums() {
7373
public List<ValueGenerator> mapColumnTypeToGenerator(Map<String, Class> providerFileData) {
7474

7575
List<ValueGenerator> generators = new ArrayList<>();
76-
76+
// Initialize the list with null values to ensure it has 7 elements
7777
for (int i = 0; i < 7; i++) {
7878
generators.add(new IntValueGenerator());
7979
}
@@ -82,9 +82,10 @@ public List<ValueGenerator> mapColumnTypeToGenerator(Map<String, Class> provider
8282

8383
Class columnType = entry.getValue();
8484
String columnName = entry.getKey();
85+
// Extracts the index from the column name (e.g., "column1" -> 0) to place the generator in the correct position
8586
Integer columnIndex = columnName.charAt(columnName.length() - 1) - '1';
8687
System.out.println(columnIndex);
87-
// Gets the entry value amd checks its type to add the corresponding generator
88+
// Gets the entry value amd checks its type to add the corresponding generator and set the values to its index so the list can be in the correct order
8889
if (columnType == Integer.class) {
8990
generators.set(columnIndex, new IntValueGenerator());
9091

0 commit comments

Comments
 (0)