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 TypeMethodDescriptionvoid
Adds 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 aFileLabelMap
from a CSV file.
-
Method Details
-
readFromCSV
public static FileLabelMap<String> readFromCSV(Path csvPath, boolean quotedStrings) throws CSVReaderException Reads aFileLabelMap
from a CSV file.- Parameters:
csvPath
- thePath
to the CSV filequotedStrings
- whether strings in the CSV are quoted- Returns:
- a new
FileLabelMap
instance 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
Set
of all labels
-
entrySet
Gets the entry set of the internal map.- Returns:
- a
Set
of map entries containing file identifiers and labels
-