Fix typo, extract getHeaderMapRaw to var

This commit is contained in:
Jakub Kupczyk 2023-06-24 14:51:28 +02:00
parent 0d4bcdbb93
commit 1da5a8b089
1 changed files with 5 additions and 4 deletions

View File

@ -88,7 +88,7 @@ public final class CSVRecord implements Serializable, Iterable<String> {
}
/**
* Returns a value by name. If multiple instances of the header name exists, only the last occurence is returned.
* Returns a value by name. If multiple instances of the header name exists, only the last occurrence is returned.
*
* <p>
* Note: This requires a field mapping obtained from the original parser.
@ -267,10 +267,11 @@ public final class CSVRecord implements Serializable, Iterable<String> {
* @since 1.9.0
*/
public <M extends Map<String, String>> M putIn(final M map) {
if (getHeaderMapRaw() == null) {
final Map<String, Integer> rawHeaderMap = getHeaderMapRaw();
if (rawHeaderMap == null) {
return map;
}
getHeaderMapRaw().forEach((key, value) -> {
rawHeaderMap.forEach((key, value) -> {
if (value < values.length) {
map.put(key, values[value]);
}
@ -312,7 +313,7 @@ public final class CSVRecord implements Serializable, Iterable<String> {
/**
* Copies this record into a new Map of header name to record value. If multiple instances of a header name exists,
* only the last occurence is mapped.
* only the last occurrence is mapped.
*
* <p>
* Editing the map does not update this instance.