January 2013
Intermediate to advanced
328 pages
8h 5m
English
Our goal is to build a listener that loads comma-separated-value (CSV) data into a nice “list of maps” data structure. This is the kind of thing that any data format reader or even a configuration file reader would do. We’ll collect the fields of each row into a map that associates a header name with a value. So, given the following input:
| | Details,Month,Amount |
| | Mid Bonus,June,"$2,000" |
| | ,January,"""zippo""" |
| | Total Bonuses,"","$5,000" |
we’d like to see the following list of maps printed out:
| | [{Details=Mid Bonus, Month=June, Amount="$2,000"}, |
| | {Details=, Month=January, Amount="""zippo"""}, |
| | {Details=Total Bonuses, Month="", Amount="$5,000"}] |
To get precise methods within our listener, let’s label each of the ...
Read now
Unlock full access