Skip to content
Permalink
Browse files
* Replace For loop with map.forEach (#172)
* Use diamond type <>
* Extract commons expressions
  • Loading branch information
arturobernalg committed Oct 22, 2021
1 parent 9d7f830 commit 4e90cdfdafa3ad4fa1946cd72c7cb968dad39279
Showing 3 changed files with 7 additions and 7 deletions.
@@ -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;
@@ -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));
}

/**
@@ -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);
@@ -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) {
@@ -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);
}

0 comments on commit 4e90cdf

Please sign in to comment.