mirror of
https://github.com/apache/commons-csv.git
synced 2025-02-17 07:26:32 +00:00
Use streams.
Remove unused imports.
This commit is contained in:
parent
9de125e4f1
commit
589f822445
@ -102,9 +102,7 @@ public final class CSVPrinter implements Flushable, Closeable {
|
||||
// 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 final class CSVPrinter implements Flushable, Closeable {
|
||||
* 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.Iterator;
|
||||
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 final class CSVRecord implements Serializable, Iterable<String> {
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user