Skip to main content

Practice ยท 2 of 3

CSV Writer + Round-Trip

Implement the writing side: - static String writeRow(List<String> fields) โ€” joins with commas, wrapping a field in double quotes only when it contains a comma or quote; inside quoted fields, " becomes "". - static List<String> roundTrip(List<String> fields) โ€” returns parseRow(writeRow(fields)) (you may re-implement the scanner or inline it). Round-trip identity is the real contract: parse(write(x)) == x for any field content โ€” including commas and quotes.

Difficulty: intermediate

Back to lesson: Practice: I/O & Formats Lab