This commit is contained in:
Gary Gregory 2021-10-22 10:33:29 -04:00
commit 4d1290d1a0
3 changed files with 7 additions and 7 deletions

View File

@ -270,10 +270,10 @@ public final class CSVRecord implements Serializable, Iterable<String> {
if (getHeaderMapRaw() == null) {
return map;
}
getHeaderMapRaw().entrySet().forEach(entry -> {
final int col = entry.getValue().intValue();
getHeaderMapRaw().forEach((key, value) -> {
final int col = value;
if (col < values.length) {
map.put(entry.getKey(), values[col]);
map.put(key, values[col]);
}
});
return map;
@ -314,7 +314,7 @@ public final class CSVRecord implements Serializable, Iterable<String> {
* @return A new Map. The map is empty if the record has no headers.
*/
public Map<String, String> toMap() {
return putIn(new LinkedHashMap<String, String>(values.length));
return putIn(new LinkedHashMap<>(values.length));
}
/**

View File

@ -413,6 +413,7 @@ final class Lexer implements Closeable {
token.type = TOKEN;
break;
}
// continue
if (isEscape(ch)) {
if (isEscapeDelimiter()) {
token.content.append(delimiter);
@ -424,11 +425,10 @@ final class Lexer implements Closeable {
token.content.append((char) unescaped);
}
}
ch = reader.read(); // continue
} else {
token.content.append((char) ch);
ch = reader.read(); // continue
}
ch = reader.read(); // continue
}
if (ignoreSurroundingSpaces) {

View File

@ -207,7 +207,7 @@ public class CSVRecordTest {
this.recordWithHeader.putIn(map);
this.validateMap(map, false);
// Test that we can compile with assignment to the same map as the param.
final TreeMap<String, String> map2 = recordWithHeader.putIn(new TreeMap<String, String>());
final TreeMap<String, String> map2 = recordWithHeader.putIn(new TreeMap<>());
this.validateMap(map2, false);
}