parseData
public static void parseData(String filename,
Set<String> characters,
Map<String,List<String>> books)
throws MarvelParser.MalformedDataException
Reads the Marvel Universe dataset.
Each line of the input file contains a character name and a comic
book the character appeared in, separated by a tab character
- Parameters:
filename
- the file that will be read
characters
- list in which all character names will be stored;
typically empty when the routine is called
books
- map from titles of comic books to characters that
appear in them; typically empty when the routine is called
- Throws:
MarvelParser.MalformedDataException
- if the file is not well-formed:
each line contains exactly two tokens separated by a tab,
or else starting with a # symbol to indicate a comment line.
- Requires:
- filename is a valid file path
- Effects:
-
- fills characters with a list of all unique character names
- fills books with a map from each comic book to all characters
appearing in it
- Modifies:
- characters, books