Skip to content
Permalink
Browse files
Use streams.
Remove unused imports.
  • Loading branch information
garydgregory committed Jul 6, 2021
1 parent 9de125e commit 589f8224456b718b20aa758fe53b21173dd55b2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
@@ -102,9 +102,7 @@ public CSVPrinter(final Appendable out, final CSVFormat format) throws IOExcepti
// It seems a pain to have to track whether the header has already been printed or not.
if (format.getHeaderComments() != null) {
for (final String line : format.getHeaderComments()) {
if (line != null) {
this.printComment(line);
}
this.printComment(line);
}
}
if (format.getHeader() != null && !format.getSkipHeaderRecord()) {
@@ -195,7 +193,7 @@ public void print(final Object value) throws IOException {
* If an I/O error occurs
*/
public void printComment(final String comment) throws IOException {
if (!format.isCommentMarkerSet()) {
if (comment == null || !format.isCommentMarkerSet()) {
return;
}
if (!newRecord) {
@@ -23,7 +23,6 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.stream.Stream;

@@ -271,12 +270,12 @@ public <M extends Map<String, String>> M putIn(final M map) {
if (getHeaderMapRaw() == null) {
return map;
}
for (final Entry<String, Integer> entry : getHeaderMapRaw().entrySet()) {
getHeaderMapRaw().entrySet().forEach(entry -> {
final int col = entry.getValue().intValue();
if (col < values.length) {
map.put(entry.getKey(), values[col]);
}
}
});
return map;
}

0 comments on commit 589f822

Please sign in to comment.