Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/main/java/org/apache/commons/csv/CSVRecord.java
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,10 @@ public <M extends Map<String, String>> M putIn(final M map) {
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;
Expand Down Expand Up @@ -314,7 +314,7 @@ public List<String> toList() {
* @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));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/apache/commons/csv/Lexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ private Token parseSimpleToken(final Token token, int ch) throws IOException {
token.type = TOKEN;
break;
}
// continue
if (isEscape(ch)) {
if (isEscapeDelimiter()) {
token.content.append(delimiter);
Expand All @@ -424,11 +425,10 @@ private Token parseSimpleToken(final Token token, int ch) throws IOException {
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) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/apache/commons/csv/CSVRecordTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public void testPutInMap() {
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);
}

Expand Down