Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-csv.git
This commit is contained in:
commit
4d1290d1a0
|
@ -270,10 +270,10 @@ public final class CSVRecord implements Serializable, Iterable<String> {
|
||||||
if (getHeaderMapRaw() == null) {
|
if (getHeaderMapRaw() == null) {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
getHeaderMapRaw().entrySet().forEach(entry -> {
|
getHeaderMapRaw().forEach((key, value) -> {
|
||||||
final int col = entry.getValue().intValue();
|
final int col = value;
|
||||||
if (col < values.length) {
|
if (col < values.length) {
|
||||||
map.put(entry.getKey(), values[col]);
|
map.put(key, values[col]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return map;
|
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.
|
* @return A new Map. The map is empty if the record has no headers.
|
||||||
*/
|
*/
|
||||||
public Map<String, String> toMap() {
|
public Map<String, String> toMap() {
|
||||||
return putIn(new LinkedHashMap<String, String>(values.length));
|
return putIn(new LinkedHashMap<>(values.length));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -413,6 +413,7 @@ final class Lexer implements Closeable {
|
||||||
token.type = TOKEN;
|
token.type = TOKEN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// continue
|
||||||
if (isEscape(ch)) {
|
if (isEscape(ch)) {
|
||||||
if (isEscapeDelimiter()) {
|
if (isEscapeDelimiter()) {
|
||||||
token.content.append(delimiter);
|
token.content.append(delimiter);
|
||||||
|
@ -424,11 +425,10 @@ final class Lexer implements Closeable {
|
||||||
token.content.append((char) unescaped);
|
token.content.append((char) unescaped);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ch = reader.read(); // continue
|
|
||||||
} else {
|
} else {
|
||||||
token.content.append((char) ch);
|
token.content.append((char) ch);
|
||||||
ch = reader.read(); // continue
|
|
||||||
}
|
}
|
||||||
|
ch = reader.read(); // continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ignoreSurroundingSpaces) {
|
if (ignoreSurroundingSpaces) {
|
||||||
|
|
|
@ -207,7 +207,7 @@ public class CSVRecordTest {
|
||||||
this.recordWithHeader.putIn(map);
|
this.recordWithHeader.putIn(map);
|
||||||
this.validateMap(map, false);
|
this.validateMap(map, false);
|
||||||
// Test that we can compile with assignment to the same map as the param.
|
// 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);
|
this.validateMap(map2, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue