Class FileLabelMap<T>
Object
FileLabelMap<T>
- Type Parameters:
T- the type of the file identifier
A map that associates file identifiers with labels, typically loaded from a CSV file.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new file identifier and label pair to the map.entrySet()Gets the entry set of the internal map.Gets the label associated with a file identifier.labels()Gets a set of all unique labels in the map.static FileLabelMap<String> readFromCSV(Path csvPath, boolean quotedStrings) Reads aFileLabelMapfrom a CSV file.
-
Method Details
-
readFromCSV
public static FileLabelMap<String> readFromCSV(Path csvPath, boolean quotedStrings) throws CSVReaderException Reads aFileLabelMapfrom a CSV file.- Parameters:
csvPath- thePathto the CSV filequotedStrings- whether strings in the CSV are quoted- Returns:
- a new
FileLabelMapinstance populated with data from the CSV - Throws:
CSVReaderException- if there's an error reading the CSV file
-
add
Adds a new file identifier and label pair to the map.- Parameters:
fileId- the file identifierlabel- the label associated with the file identifier
-
get
Gets the label associated with a file identifier.- Parameters:
fileId- the file identifier- Returns:
- the label associated with the file identifier, or null if not found
-
labels
Gets a set of all unique labels in the map.- Returns:
- a
Setof all labels
-
entrySet
Gets the entry set of the internal map.- Returns:
- a
Setof map entries containing file identifiers and labels
-