The field values are never null. Empty fields are represented as empty strings.
CsvReader
| Modifier and Type | Field and Description |
|---|---|
| private final String[] |
| Access | Constructor and Description |
|---|---|
| pack-priv | NamedCsvRecord(final long startingLineNumber, final String[] fields, final boolean comment, final String[] header)
|
| Modifier and Type | Method and Description |
|---|---|
| private int | |
| public Optional | Returns: AnOptional containing the value of the field if found,
or an Optional#EMPTY if the field is not present. Never returns null.case-sensitive name of the field to be retrieved name)Retrieves the value of a field by its case-sensitive name, considering the first occurrence in case of duplicates. |
| public List | Returns: the field values (empty list if record doesn't contain that field), nevernullcase-sensitive name of the field to collect values for name)Collects all field values with the given name (case-sensitive) in the order they appear in the header. |
| private int | |
| public String | |
| public Map | Returns: an ordered map of header names and field values of this record, nevernullConstructs an ordered map, associating header names with corresponding field values of this record, considering the first occurrence in case of duplicates. |
| public Map | Returns: an unordered map of header names and field values of this record, nevernullConstructs an unordered map, associating header names with an ordered list of corresponding field values in this record. |
| public List | |
| public String | toString()
Overrides de. Returns a string representation of the object. |
| header | back to summary |
|---|---|
| private final String[] header | |
| NamedCsvRecord | back to summary |
|---|---|
pack-priv NamedCsvRecord(final long startingLineNumber, final String[] fields, final boolean comment, final String[] header)
| |
| commonSize | back to summary |
|---|---|
| private int commonSize() | |
| findField | back to summary |
|---|---|
| public Optional Retrieves the value of a field by its case-sensitive name, considering the first occurrence in case of duplicates. This method is equivalent to
| |
| findFields | back to summary |
|---|---|
| public List Collects all field values with the given name (case-sensitive) in the order they appear in the header.
| |
| findHeaderIndex | back to summary |
|---|---|
| private int findHeaderIndex(final String name) | |
| getField | back to summary |
|---|---|
| public String getField(final String name) Retrieves the value of a field by its case-sensitive name, considering the first occurrence in case of duplicates. This method is equivalent to
| |
| getFieldsAsMap | back to summary |
|---|---|
| public Map Constructs an ordered map, associating header names with corresponding field values of this record, considering the first occurrence in case of duplicates. The constructed map will only contain entries for fields that have a key and a value. No map entry will have a
If you need to collect all fields with the same name (duplicate header), use
| |
| getFieldsAsMapList | back to summary |
|---|---|
| public Map Constructs an unordered map, associating header names with an ordered list of corresponding field values in this record. The constructed map will only contain entries for fields that have a key and a value. No map entry will have a
If you don't have to handle duplicate headers, you may simply use
| |
| getHeader | back to summary |
|---|---|
| public List Retrieves the header names of this record. The header names are returned in the order they appear in the CSV file. Note that the header names are not necessarily unique.
If you need to collect all fields with the same name (duplicate header), use Note that records for commented lines ( | |
| toString | back to summary |
|---|---|
| public String toString() Overrides de. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |